diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2010-01-15 22:54:38 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2010-01-15 22:54:38 -0800 |
commit | a1449405df76225e608384d770f44b68f8f918fa (patch) | |
tree | c9e3e676e0d50c7945d3eb0ffc028b946cd6397e | |
parent | c55a10661a790fe834fc3dfd70c8e722e54c526c (diff) |
Replace remaining sprintf calls with snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r-- | xvidtune.c | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -370,13 +370,13 @@ SetLabel(fields i) XtVaSetValues(auto_apply_toggle, XtNstate, 0, NULL); if (i == Flags) - (void) sprintf (buf, "%04x", sdp->val); + (void) snprintf (buf, sizeof(buf), "%04x", sdp->val); else if (i >= PixelClock && i <= VSyncRate) - (void) sprintf (buf, "%6.2f", (float)sdp->val / 1000.0); + (void) snprintf (buf, sizeof(buf), "%6.2f", (float)sdp->val / 1000.0); else if (i == BlankDelay1 || i == BlankDelay2) { - (void) sprintf (buf, "%d", sdp->val); + (void) snprintf (buf, sizeof(buf), "%d", sdp->val); } else - (void) sprintf (buf, "%5d", sdp->val); + (void) snprintf (buf, sizeof(buf), "%5d", sdp->val); sdp->lastpercent = -1; if (i == Flags) { @@ -532,9 +532,10 @@ ShowCB(Widget w, XtPointer client, XtPointer call) Time time; char tmpbuf[16]; - sprintf(tmpbuf, "\"%dx%d\"", + snprintf(tmpbuf, sizeof(tmpbuf), "\"%dx%d\"", AppRes.field[HDisplay].val, AppRes.field[VDisplay].val); - sprintf(modebuf, "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d", + snprintf(modebuf, sizeof(modebuf), + "%-11s %6.2f %4d %4d %4d %4d %4d %4d %4d %4d", tmpbuf, (float)dot_clock/1000.0, AppRes.field[HDisplay].val, AppRes.field[HSyncStart].val, @@ -724,10 +725,10 @@ EditCB (Widget w, XtPointer client, XtPointer call) char tmp[6]; if (current < lower) { - (void) sprintf (tmp, "%5d", lower); + (void) snprintf (tmp, sizeof(tmp), "%5d", lower); current = lower; } else { - (void) sprintf (tmp, "%5d", upper); + (void) snprintf (tmp, sizeof(tmp), "%5d", upper); current = upper; } text.firstPos = 0; @@ -911,7 +912,7 @@ ScrollCB (Widget w, XtPointer client, XtPointer call) sdp->val = isValid(tmp_val, fieldindex); sdp->lastpercent = ipercent; - (void) sprintf (buf, "%5d", sdp->val); + (void) snprintf (buf, sizeof(buf), "%5d", sdp->val); XtVaSetValues (sdp->textwidget, XtNlabel, buf, NULL); if (sdp->val != tmp_val) { int base; @@ -965,9 +966,10 @@ CreateTyp ( wids[0] = XtCreateWidget (w1name, labelWidgetClass, form, NULL, 0); if (findex >= PixelClock && findex <= VSyncRate) - (void) snprintf(buf, 10, "%6.2f", (float)AppRes.field[findex].val / 1000.0); + (void) snprintf(buf, sizeof(buf), "%6.2f", + (float)AppRes.field[findex].val / 1000.0); else - (void) sprintf (buf, "%5d", AppRes.field[findex].val); + (void) snprintf (buf, sizeof(buf), "%5d", AppRes.field[findex].val); wids[1] = XtVaCreateWidget (w2name, labelWidgetClass, form, XtNlabel, buf, NULL); if (w3name != NULL) { @@ -1216,7 +1218,7 @@ CreateHierarchy(Widget top) NULL); XtAddCallback (w, XtNcallback, AdjustCB, (XtPointer)-VTotal); - (void) sprintf (buf, "%04x", AppRes.field[Flags].val); + (void) snprintf (buf, sizeof(buf), "%04x", AppRes.field[Flags].val); wids[0] = XtCreateWidget ("Flags-label", labelWidgetClass, forms[8], NULL, 0); wids[1] = XtVaCreateWidget ("Flags-text", asciiTextWidgetClass, @@ -1293,7 +1295,7 @@ CreateHierarchy(Widget top) s3form, NULL); XtAddCallback (wids[3], XtNcallback, ChangeBlankCB, (XtPointer)-BlankDelay1); - (void) sprintf (buf, "%d", AppRes.field[BlankDelay1].val); + (void) snprintf (buf, sizeof(buf), "%d", AppRes.field[BlankDelay1].val); wids[4] = XtVaCreateWidget("Blank1-text", asciiTextWidgetClass, s3form, XtNstring, buf, XtNtranslations, trans, NULL); AddCallback(wids[4], XtNcallback, BlankEditCB, (XPointer) BlankDelay1); @@ -1309,7 +1311,7 @@ CreateHierarchy(Widget top) s3form, NULL); XtAddCallback (wids[7], XtNcallback, ChangeBlankCB, (XtPointer)-BlankDelay2); - (void) sprintf (buf, "%d", AppRes.field[BlankDelay2].val); + (void) snprintf (buf, sizeof(buf), "%d", AppRes.field[BlankDelay2].val); wids[8] = XtVaCreateWidget("Blank2-text", asciiTextWidgetClass, s3form, XtNstring, buf, XtNtranslations, trans, NULL); AddCallback(wids[8], XtNcallback, BlankEditCB, (XPointer) BlankDelay2); |