summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-17 09:56:53 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-17 09:56:53 -0800
commit78ee6607ca35319c4785c5c48f7eed618e56d7d0 (patch)
treeb46ba754b1449a379f32f5da82d4a59dc10eeeb9
parent1992efbe9ae74d6edf679fd9e7f1f3072c834743 (diff)
convert sprintf calls to snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xfd.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/xfd.c b/xfd.c
index bf49d32..18f262f 100644
--- a/xfd.c
+++ b/xfd.c
@@ -316,11 +316,11 @@ main(int argc, char *argv[])
minn = GridFirstChar (fontGrid);
maxn = GridLastChar (fontGrid);
- sprintf (buf, xfd_resources.range_format,
- minn >> 8, minn & 0xff,
- minn >> 8, minn & 0xff,
- maxn >> 8, maxn & 0xff,
- maxn >> 8, maxn & 0xff);
+ snprintf (buf, sizeof(buf), xfd_resources.range_format,
+ minn >> 8, minn & 0xff,
+ minn >> 8, minn & 0xff,
+ maxn >> 8, maxn & 0xff,
+ maxn >> 8, maxn & 0xff);
i = 0;
XtSetArg (av[i], XtNlabel, buf); i++;
@@ -364,11 +364,11 @@ SelectChar(Widget w, XtPointer closure, XtPointer data)
{
XGlyphInfo extents;
XftTextExtents32 (XtDisplay (w), xft, &c, 1, &extents);
- sprintf (buf, xfd_resources.metrics_format,
- extents.xOff, - extents.x,
- extents.xOff - extents.width + extents.x,
- extents.y, extents.height - extents.y,
- xft->ascent, xft->descent);
+ snprintf (buf, sizeof(buf), xfd_resources.metrics_format,
+ extents.xOff, - extents.x,
+ extents.xOff - extents.width + extents.x,
+ extents.y, extents.height - extents.y,
+ xft->ascent, xft->descent);
}
}
else
@@ -389,26 +389,26 @@ SelectChar(Widget w, XtPointer closure, XtPointer data)
char2b.byte2 = p->thechar & 0xff;
XTextExtents16 (fs, &char2b, 1, &direction, &fontascent, &fontdescent,
&metrics);
- sprintf (buf, xfd_resources.metrics_format,
- metrics.width, metrics.lbearing, metrics.rbearing,
- metrics.ascent, metrics.descent, fontascent, fontdescent);
+ snprintf (buf, sizeof(buf), xfd_resources.metrics_format,
+ metrics.width, metrics.lbearing, metrics.rbearing,
+ metrics.ascent, metrics.descent, fontascent, fontdescent);
}
}
XtSetValues (metricsLabel, &arg, ONE);
if (has_char)
{
- sprintf (buf, xfd_resources.select_format,
- n >> 8, n & 0xff,
- n >> 8, n & 0xff,
- n >> 8, n & 0xff);
+ snprintf (buf, sizeof(buf), xfd_resources.select_format,
+ n >> 8, n & 0xff,
+ n >> 8, n & 0xff,
+ n >> 8, n & 0xff);
}
else
{
- sprintf (buf, xfd_resources.nochar_format,
- n >> 8, n & 0xff,
- n >> 8, n & 0xff,
- n >> 8, n & 0xff);
+ snprintf (buf, sizeof(buf), xfd_resources.nochar_format,
+ n >> 8, n & 0xff,
+ n >> 8, n & 0xff,
+ n >> 8, n & 0xff);
}
XtSetValues (selectLabel, &arg, ONE);
@@ -452,7 +452,8 @@ change_page(int page)
unsigned int col = (unsigned int) (newstart & 0xff);
XtSetArg (arg, XtNlabel, buf);
- sprintf (buf, xfd_resources.start_format, newstart, row, col);
+ snprintf (buf, sizeof(buf), xfd_resources.start_format,
+ newstart, row, col);
XtSetValues (startLabel, &arg, ONE);
}