From 6e81ca91fa8e62ca6fb5ba41c45bbd6a605d514c Mon Sep 17 00:00:00 2001 From: Stéphane Aulery Date: Sat, 8 Nov 2014 18:00:26 +0100 Subject: Fix cppcheck warning %d in format string requires 'int' but the argument type is 'unsigned int' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Aulery Signed-off-by: Gerd Hoffmann --- browser.c | 4 ++-- fbi.c | 2 +- filebutton.c | 4 ++-- ida.c | 14 +++++++------- op.c | 2 +- sane.c | 2 +- selections.c | 2 +- wr/write-ps.c | 12 ++++++------ 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/browser.c b/browser.c index 7b6ac4d..34322e5 100644 --- a/browser.c +++ b/browser.c @@ -117,10 +117,10 @@ browser_statfiles(XtPointer clientdata) /* update status line */ if (h->filter) { - snprintf(line, sizeof(line), "%d dirs, %d/%d files [%s]", + snprintf(line, sizeof(line), "%u dirs, %u/%u files [%s]", h->dirs,h->sfiles,h->afiles,h->filter); } else { - snprintf(line, sizeof(line), "%d dirs, %d files", + snprintf(line, sizeof(line), "%u dirs, %u files", h->dirs,h->afiles); } str = XmStringGenerate(line, NULL, XmMULTIBYTE_TEXT, NULL); diff --git a/fbi.c b/fbi.c index d7c5cb0..59f25ac 100644 --- a/fbi.c +++ b/fbi.c @@ -1140,7 +1140,7 @@ static char *make_info(struct ida_image *img, float scale) static char linebuffer[128]; snprintf(linebuffer, sizeof(linebuffer), - "%s%.0f%% %dx%d %d/%d", + "%s%.0f%% %ux%u %d/%d", fcurrent->tag ? "* " : "", scale*100, img->i.width, img->i.height, diff --git a/filebutton.c b/filebutton.c index 3f922e2..b09d730 100644 --- a/filebutton.c +++ b/filebutton.c @@ -233,7 +233,7 @@ fileinfo_loader(XtPointer clientdata) } file->loader->done(file->wdata); if (debug) - fprintf(stderr,"LOADED: %s [%dx%d]\n", + fprintf(stderr,"LOADED: %s [%ux%u]\n", file->filename, file->wimg.i.width, file->wimg.i.height); /* resize image */ @@ -269,7 +269,7 @@ fileinfo_loader(XtPointer clientdata) } desc_resize.done(file->wdata); if (debug) - fprintf(stderr,"SCALED: %s [%dx%d]\n", + fprintf(stderr,"SCALED: %s [%ux%u]\n", file->filename,file->simg.i.width,file->simg.i.height); /* scale once more (small icon) */ diff --git a/ida.c b/ida.c index 520cf42..2a1885f 100644 --- a/ida.c +++ b/ida.c @@ -726,13 +726,13 @@ resize_shell(void) else base = ida->file; title = malloc(strlen(base)+128); - len = sprintf(title,"%s (%dx%d", base, + len = sprintf(title,"%s (%ux%u", base, ida->img.i.width, ida->img.i.height); if (ida->img.i.dpi) - len += sprintf(title+len," | %d dpi", + len += sprintf(title+len," | %u dpi", ida->img.i.dpi); if (ida->img.i.npages > 1) - len += sprintf(title+len," | page %d/%d", + len += sprintf(title+len," | page %d/%u", cpage+1, ida->img.i.npages); len += sprintf(title+len," | %d%%)", viewer_i2s(ida->zoom,100)); XtVaSetValues(app_shell, XtNtitle,title, @@ -1593,7 +1593,7 @@ resize_sync_cb(Widget widget, XtPointer client_data, XtPointer calldata) /* radio buttons pressed */ if (h->size == widget && XmToggleButtonGetState(h->size)) { XmToggleButtonSetState(h->res,0,False); - sprintf(buf,"%d", ida->img.i.dpi); + sprintf(buf,"%u", ida->img.i.dpi); h->rupdate++; XmTextSetString(h->tr,buf); XtVaSetValues(h->tr,XmNsensitive,False,NULL); @@ -1671,11 +1671,11 @@ resize_ac(Widget widget, XEvent *event, String *params, Cardinal *num) h->label = XtVaCreateManagedWidget("label", xmLabelWidgetClass, rc, NULL); - sprintf(buf,"%d",ida->img.i.width); + sprintf(buf,"%u",ida->img.i.width); XmTextSetString(h->tx,buf); - sprintf(buf,"%d",ida->img.i.height); + sprintf(buf,"%u",ida->img.i.height); XmTextSetString(h->ty,buf); - sprintf(buf,"%d",ida->img.i.dpi); + sprintf(buf,"%u",ida->img.i.dpi); XmTextSetString(h->tr,buf); XtVaSetValues(h->tr,XmNsensitive,False,NULL); XmToggleButtonSetState(h->lock,1,False); diff --git a/op.c b/op.c index b4e95fe..862d297 100644 --- a/op.c +++ b/op.c @@ -215,7 +215,7 @@ op_autocrop_init(struct ida_image *src, struct ida_rect *unused, free(img.data); if (debug) - fprintf(stderr,"y: %d-%d/%d -- x: %d-%d/%d\n", + fprintf(stderr,"y: %d-%d/%u -- x: %d-%d/%u\n", rect.y1, rect.y2, img.i.height, rect.x1, rect.x2, img.i.width); diff --git a/sane.c b/sane.c index 911134d..6ce75f2 100644 --- a/sane.c +++ b/sane.c @@ -243,7 +243,7 @@ sane_idainit(FILE *fp, char *filename, unsigned int page, struct ida_image_info info->dpi = dpi; h->buf = malloc(h->parm.bytes_per_line * BUF_LINES); if (debug) - fprintf(stderr,"sane: scanning %dx%d %s\n",info->width,info->height, + fprintf(stderr,"sane: scanning %ux%u %s\n",info->width,info->height, (h->parm.format == SANE_FRAME_GRAY) ? "gray" : "color"); return h; diff --git a/selections.c b/selections.c index 10a2617..26edf20 100644 --- a/selections.c +++ b/selections.c @@ -307,7 +307,7 @@ selection_convert(Widget widget, XtPointer ignore, XtPointer call_data) } else if (ccs->target == MIME_IMAGE_PPM) { /* xfer image data directly */ cdata = XtMalloc(sel->img.i.width * sel->img.i.height * 3 + 32); - n = sprintf(cdata,"P6\n%d %d\n255\n", + n = sprintf(cdata,"P6\n%u %u\n255\n", sel->img.i.width, sel->img.i.height); memcpy(cdata+n, sel->img.data, sel->img.i.width*sel->img.i.height*3); ccs->value = cdata; diff --git a/wr/write-ps.c b/wr/write-ps.c index 914a896..ee34988 100644 --- a/wr/write-ps.c +++ b/wr/write-ps.c @@ -415,20 +415,20 @@ ps_write(FILE *fp, struct ida_image *img) fprintf(fp,header, /* includes bbox */ xoff,yoff,xoff+width,yoff+height); fprintf(fp,"\n" - "/pix %d string def\n" - "/grays %d string def\n" + "/pix %u string def\n" + "/grays %u string def\n" "/npixls 0 def\n" "/rgbindx 0 def\n" "\n", img->i.width*3,img->i.width); fwrite(ColorImage,strlen(ColorImage),1,fp); - fprintf(fp,"%d %d translate\n",xoff,yoff); - fprintf(fp,"%d %d scale\n",width,height); + fprintf(fp,"%u %u translate\n",xoff,yoff); + fprintf(fp,"%u %u scale\n",width,height); fprintf(fp,"\n" - "%d %d 8\n" - "[%d 0 0 -%d 0 %d]\n" + "%u %u 8\n" + "[%u 0 0 -%u 0 %u]\n" "{currentfile pix readhexstring pop}\n" "false 3 colorimage\n", iwidth,iheight,iwidth,iheight,iheight); -- cgit