]> granicus.if.org Git - neomutt/commitdiff
cppcheck: printf format
authorRichard Russon <rich@flatcap.org>
Tue, 3 Apr 2018 12:49:15 +0000 (13:49 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 3 Apr 2018 12:49:15 +0000 (13:49 +0100)
mh.c
newsrc.c
nntp.c

diff --git a/mh.c b/mh.c
index 09451589538c0ceb15564d173228019d3f843ca5..35e47ea8fd71567da66260382734cae99c40352e 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -1709,7 +1709,7 @@ static int mh_commit_msg(struct Context *ctx, struct Message *msg,
   while (true)
   {
     hi++;
-    snprintf(tmp, sizeof(tmp), "%d", hi);
+    snprintf(tmp, sizeof(tmp), "%u", hi);
     snprintf(path, sizeof(path), "%s/%s", ctx->path, tmp);
     if (mutt_file_safe_rename(msg->path, path) == 0)
     {
index b652d3faea4643a5406845cd5b3e947729129d68..1aed7228841049662d049226a01faffb2c89bace 100644 (file)
--- a/newsrc.c
+++ b/newsrc.c
@@ -471,9 +471,9 @@ int nntp_newsrc_update(struct NntpServer *nserv)
       if (j)
         buf[off++] = ',';
       if (nntp_data->newsrc_ent[j].first == nntp_data->newsrc_ent[j].last)
-        snprintf(buf + off, buflen - off, "%d", nntp_data->newsrc_ent[j].first);
+        snprintf(buf + off, buflen - off, "%u", nntp_data->newsrc_ent[j].first);
       else if (nntp_data->newsrc_ent[j].first < nntp_data->newsrc_ent[j].last)
-        snprintf(buf + off, buflen - off, "%d-%d",
+        snprintf(buf + off, buflen - off, "%u-%u",
                  nntp_data->newsrc_ent[j].first, nntp_data->newsrc_ent[j].last);
       off += strlen(buf + off);
     }
@@ -639,7 +639,7 @@ int nntp_active_save_cache(struct NntpServer *nserv)
       buflen *= 2;
       mutt_mem_realloc(&buf, buflen);
     }
-    snprintf(buf + off, buflen - off, "%s %d %d %c%s%s\n", nntp_data->group,
+    snprintf(buf + off, buflen - off, "%s %u %u %c%s%s\n", nntp_data->group,
              nntp_data->last_message, nntp_data->first_message,
              nntp_data->allowed ? 'y' : 'n', nntp_data->desc ? " " : "",
              nntp_data->desc ? nntp_data->desc : "");
@@ -712,7 +712,7 @@ void nntp_hcache_update(struct NntpData *nntp_data, header_cache_t *hc)
         if (current >= nntp_data->first_message && current <= nntp_data->last_message)
           continue;
 
-        snprintf(buf, sizeof(buf), "%d", current);
+        snprintf(buf, sizeof(buf), "%u", current);
         mutt_debug(2, "mutt_hcache_delete %s\n", buf);
         mutt_hcache_delete(hc, buf, strlen(buf));
       }
diff --git a/nntp.c b/nntp.c
index 3f2f7b3ed21fb6eec832ea14becf4b65002df340..219ddb718f09fd56daadd7debb3c867b8518e602 100644 (file)
--- a/nntp.c
+++ b/nntp.c
@@ -1144,7 +1144,7 @@ static int parse_overview_line(char *line, void *data)
     char buf[16];
 
     /* try to replace with header from cache */
-    snprintf(buf, sizeof(buf), "%d", anum);
+    snprintf(buf, sizeof(buf), "%u", anum);
     void *hdata = mutt_hcache_fetch(fc->hc, buf, strlen(buf));
     if (hdata)
     {
@@ -1243,7 +1243,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
     if (!ctx->quiet)
       mutt_message(_("Fetching list of articles..."));
     if (nntp_data->nserv->hasLISTGROUPrange)
-      snprintf(buf, sizeof(buf), "LISTGROUP %s %d-%d\r\n", nntp_data->group, first, last);
+      snprintf(buf, sizeof(buf), "LISTGROUP %s %u-%u\r\n", nntp_data->group, first, last);
     else
       snprintf(buf, sizeof(buf), "LISTGROUP %s\r\n", nntp_data->group);
     rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_numbers, &fc);
@@ -1258,7 +1258,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
         if (fc.messages[current - first])
           continue;
 
-        snprintf(buf, sizeof(buf), "%d", current);
+        snprintf(buf, sizeof(buf), "%u", current);
         if (nntp_data->bcache)
         {
           mutt_debug(2, "#1 mutt_bcache_del %s\n", buf);
@@ -1289,7 +1289,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
       mutt_progress_update(&fc.progress, current - first + 1, -1);
 
 #ifdef USE_HCACHE
-    snprintf(buf, sizeof(buf), "%d", current);
+    snprintf(buf, sizeof(buf), "%u", current);
 #endif
 
     /* delete header from cache that does not exist on server */
@@ -1354,7 +1354,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
         break;
       }
 
-      snprintf(buf, sizeof(buf), "HEAD %d\r\n", current);
+      snprintf(buf, sizeof(buf), "HEAD %u\r\n", current);
       rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_tempfile, fp);
       if (rc)
       {
@@ -1373,7 +1373,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
         /* no such article */
         if (nntp_data->bcache)
         {
-          snprintf(buf, sizeof(buf), "%d", current);
+          snprintf(buf, sizeof(buf), "%u", current);
           mutt_debug(2, "#3 mutt_bcache_del %s\n", buf);
           mutt_bcache_del(nntp_data->bcache, buf);
         }
@@ -1416,7 +1416,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
   if (current <= last && rc == 0 && !nntp_data->deleted)
   {
     char *cmd = nntp_data->nserv->hasOVER ? "OVER" : "XOVER";
-    snprintf(buf, sizeof(buf), "%s %d-%d\r\n", cmd, current, last);
+    snprintf(buf, sizeof(buf), "%s %u-%u\r\n", cmd, current, last);
     rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, parse_overview_line, &fc);
     if (rc > 0)
     {
@@ -1901,7 +1901,7 @@ static int check_mailbox(struct Context *ctx)
         if (anum >= first && anum <= nntp_data->last_loaded)
           messages[anum - first] = 1;
 
-        snprintf(buf, sizeof(buf), "%d", anum);
+        snprintf(buf, sizeof(buf), "%u", anum);
         hdata = mutt_hcache_fetch(hc, buf, strlen(buf));
         if (hdata)
         {
@@ -1947,7 +1947,7 @@ static int check_mailbox(struct Context *ctx)
       if (messages[anum - first])
         continue;
 
-      snprintf(buf, sizeof(buf), "%d", anum);
+      snprintf(buf, sizeof(buf), "%u", anum);
       hdata = mutt_hcache_fetch(hc, buf, strlen(buf));
       if (hdata)
       {
@@ -2470,7 +2470,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid)
   cc.child = mutt_mem_malloc(sizeof(anum_t) * cc.max);
 
   /* fetch numbers of child messages */
-  snprintf(buf, sizeof(buf), "XPAT References %d-%d *%s*\r\n",
+  snprintf(buf, sizeof(buf), "XPAT References %u-%u *%s*\r\n",
            nntp_data->first_message, nntp_data->last_loaded, msgid);
   rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_children, &cc);
   if (rc)