Commit 442ca3c9 442ca3c91e1f7cb18428a9b6d0fc5615bf62aa54 by Sergey Poznyakoff

Add typecasts to the arguments of printf-like functions where necessary.

1 parent cdf51934
...@@ -139,7 +139,7 @@ main (int argc, char **argv) ...@@ -139,7 +139,7 @@ main (int argc, char **argv)
139 header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); 139 header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL);
140 header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject), 140 header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject),
141 NULL); 141 NULL);
142 printf ("Message: %d\n", i); 142 printf ("Message: %lu\n", (unsigned long) i);
143 printf ("From: %s\n", from); 143 printf ("From: %s\n", from);
144 printf ("Subject: %s\n", subject); 144 printf ("Subject: %s\n", subject);
145 145
...@@ -148,8 +148,10 @@ main (int argc, char **argv) ...@@ -148,8 +148,10 @@ main (int argc, char **argv)
148 fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret)); 148 fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret));
149 exit (2); 149 exit (2);
150 } 150 }
151 printf ("Number of parts in message - %d\n", nparts); 151 printf ("Number of parts in message - %lu\n",
152 printf ("Total message size - %d\n", msize); 152 (unsigned long) nparts);
153 printf ("Total message size - %lu\n",
154 (unsigned long) msize);
153 message_display_parts (msg, 0); 155 message_display_parts (msg, 0);
154 } 156 }
155 mailbox_close (mbox); 157 mailbox_close (mbox);
...@@ -203,7 +205,8 @@ message_display_parts (message_t msg, int indent) ...@@ -203,7 +205,8 @@ message_display_parts (message_t msg, int indent)
203 header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), 205 header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type),
204 NULL); 206 NULL);
205 printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type); 207 printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type);
206 printf ("%*.*sMessage part size - %d\n", indent, indent, "", msize); 208 printf ("%*.*sMessage part size - %lu\n", indent, indent, "",
209 (unsigned long) msize);
207 encoding[0] = '\0'; 210 encoding[0] = '\0';
208 header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding, 211 header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding,
209 sizeof (encoding), NULL); 212 sizeof (encoding), NULL);
......
...@@ -316,7 +316,7 @@ mta_send (message_t msg) ...@@ -316,7 +316,7 @@ mta_send (message_t msg)
316 316
317 message_get_stream (msg, &stream); 317 message_get_stream (msg, &stream);
318 line = 0; 318 line = 0;
319 fprintf (diag, "%4d: ", line); 319 fprintf (diag, "%4lu: ", (unsigned long) line);
320 while (stream_read (stream, buffer, sizeof buffer - 1, off, &n) == 0 320 while (stream_read (stream, buffer, sizeof buffer - 1, off, &n) == 0
321 && n != 0) 321 && n != 0)
322 { 322 {
...@@ -328,7 +328,7 @@ mta_send (message_t msg) ...@@ -328,7 +328,7 @@ mta_send (message_t msg)
328 if (buffer[i] == '\n') 328 if (buffer[i] == '\n')
329 { 329 {
330 line++; 330 line++;
331 fprintf (diag, "%4d: ", line); 331 fprintf (diag, "%4lu: ", (unsigned long) line);
332 } 332 }
333 } 333 }
334 off += n; 334 off += n;
......
...@@ -559,7 +559,8 @@ var_read (int argc, char **argv, compose_env_t *env) ...@@ -559,7 +559,8 @@ var_read (int argc, char **argv, compose_env_t *env)
559 fputs (buf, ofile); 559 fputs (buf, ofile);
560 } 560 }
561 fclose (inf); 561 fclose (inf);
562 fprintf (stdout, "\"%s\" %d/%d\n", filename, lines, size); 562 fprintf (stdout, "\"%s\" %lu/%lu\n", filename,
563 (unsigned long) lines, (unsigned long) size);
563 free (filename); 564 free (filename);
564 return 0; 565 return 0;
565 } 566 }
...@@ -614,7 +615,8 @@ var_write (int argc, char **argv, compose_env_t *env) ...@@ -614,7 +615,8 @@ var_write (int argc, char **argv, compose_env_t *env)
614 fputs (buf, fp); 615 fputs (buf, fp);
615 } 616 }
616 fclose (fp); 617 fclose (fp);
617 fprintf (stdout, "\"%s\" %d/%d\n", filename, lines, size); 618 fprintf (stdout, "\"%s\" %lu/%lu\n", filename,
619 (unsigned long) lines, (unsigned long) size);
618 free (filename); 620 free (filename);
619 return 0; 621 return 0;
620 } 622 }
...@@ -719,7 +721,8 @@ var_pipe (int argc, char **argv, compose_env_t *env) ...@@ -719,7 +721,8 @@ var_pipe (int argc, char **argv, compose_env_t *env)
719 rc = 0; 721 rc = 0;
720 } 722 }
721 723
722 fprintf (stdout, "\"|%s\" in: %d/%d ", argv[1], lines, size); 724 fprintf (stdout, "\"|%s\" in: %lu/%lu ", argv[1],
725 (unsigned long) lines, (unsigned long) size);
723 if (rc) 726 if (rc)
724 { 727 {
725 fprintf (stdout, "no lines out\n"); 728 fprintf (stdout, "no lines out\n");
...@@ -741,7 +744,8 @@ var_pipe (int argc, char **argv, compose_env_t *env) ...@@ -741,7 +744,8 @@ var_pipe (int argc, char **argv, compose_env_t *env)
741 } 744 }
742 fclose (env->file); 745 fclose (env->file);
743 746
744 fprintf (stdout, "out: %d/%d\n", lines, size); 747 fprintf (stdout, "out: %lu/%lu\n",
748 (unsigned long) lines, (unsigned long) size);
745 } 749 }
746 750
747 /* Clean up the things */ 751 /* Clean up the things */
......
...@@ -1232,7 +1232,7 @@ section_name (msg_imap_t msg_imap) ...@@ -1232,7 +1232,7 @@ section_name (msg_imap_t msg_imap)
1232 char *tmp; 1232 char *tmp;
1233 char part[64]; 1233 char part[64];
1234 size_t partlen; 1234 size_t partlen;
1235 snprintf (part, sizeof part, "%u", msg_imap->part); 1235 snprintf (part, sizeof part, "%lu", (unsigned long) msg_imap->part);
1236 partlen = strlen (part); 1236 partlen = strlen (part);
1237 tmp = realloc (section, sectionlen + partlen + 2); 1237 tmp = realloc (section, sectionlen + partlen + 2);
1238 if (tmp == NULL) 1238 if (tmp == NULL)
......
...@@ -2178,9 +2178,11 @@ add_number (char **pset, size_t start, size_t end) ...@@ -2178,9 +2178,11 @@ add_number (char **pset, size_t start, size_t end)
2178 if (start == 0) 2178 if (start == 0)
2179 *buf = '\0'; 2179 *buf = '\0';
2180 else if (start != end) 2180 else if (start != end)
2181 snprintf (buf, sizeof buf, "%d:%d", start, end); 2181 snprintf (buf, sizeof buf, "%lu:%lu",
2182 (unsigned long) start,
2183 (unsigned long) end);
2182 else 2184 else
2183 snprintf (buf, sizeof buf, "%d", start); 2185 snprintf (buf, sizeof buf, "%lu", (unsigned long) start);
2184 2186
2185 if (set_len) 2187 if (set_len)
2186 tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */); 2188 tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */);
......
...@@ -1235,7 +1235,7 @@ mbox_envelope_date (envelope_t envelope, char *buf, size_t len, ...@@ -1235,7 +1235,7 @@ mbox_envelope_date (envelope_t envelope, char *buf, size_t len,
1235 1235
1236 static int 1236 static int
1237 mbox_envelope_sender (envelope_t envelope, char *buf, size_t len, 1237 mbox_envelope_sender (envelope_t envelope, char *buf, size_t len,
1238 size_t *pnwrite) 1238 size_t *pnwrite)
1239 { 1239 {
1240 message_t msg = envelope_get_owner (envelope); 1240 message_t msg = envelope_get_owner (envelope);
1241 mbox_message_t mum = message_get_owner (msg); 1241 mbox_message_t mum = message_get_owner (msg);
...@@ -1602,7 +1602,8 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize, ...@@ -1602,7 +1602,8 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize,
1602 if (first && is_expunging) 1602 if (first && is_expunging)
1603 { 1603 {
1604 n = sprintf (buffer, "X-IMAPbase: %lu %u\n", 1604 n = sprintf (buffer, "X-IMAPbase: %lu %u\n",
1605 mud->uidvalidity, mud->uidnext); 1605 (unsigned long) mud->uidvalidity,
1606 (unsigned) mud->uidnext);
1606 stream_write (mailbox->stream, buffer, n, *psize, &n); 1607 stream_write (mailbox->stream, buffer, n, *psize, &n);
1607 *psize += n; 1608 *psize += n;
1608 } 1609 }
...@@ -1643,7 +1644,7 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize, ...@@ -1643,7 +1644,7 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize,
1643 1644
1644 if (status == 0 || uid != 0) 1645 if (status == 0 || uid != 0)
1645 { 1646 {
1646 n = sprintf (suid, "X-UID: %d\n", uid); 1647 n = sprintf (suid, "X-UID: %u\n", (unsigned) uid);
1647 /* Put the UID. */ 1648 /* Put the UID. */
1648 status = stream_write (mailbox->stream, suid, n, *psize, &n); 1649 status = stream_write (mailbox->stream, suid, n, *psize, &n);
1649 if (status != 0) 1650 if (status != 0)
...@@ -1730,7 +1731,7 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize, ...@@ -1730,7 +1731,7 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize,
1730 } 1731 }
1731 while (nread > 0); 1732 while (nread > 0);
1732 n = 0; 1733 n = 0;
1733 stream_write (mailbox->stream, &nl, 1, *psize, &n); 1734 stream_write (mailbox->stream, &nl, 1, *psize, &n);
1734 *psize += n; 1735 *psize += n;
1735 } 1736 }
1736 1737
......
...@@ -195,9 +195,11 @@ _mh_message_name (struct _mh_message *mhm, int deleted) ...@@ -195,9 +195,11 @@ _mh_message_name (struct _mh_message *mhm, int deleted)
195 size_t len = strlen (mhm->mhd->name) + 32; 195 size_t len = strlen (mhm->mhd->name) + 32;
196 filename = malloc (len); 196 filename = malloc (len);
197 if (deleted) 197 if (deleted)
198 snprintf (filename, len, "%s/,%d", mhm->mhd->name, mhm->seq_number); 198 snprintf (filename, len, "%s/,%lu", mhm->mhd->name,
199 (unsigned long) mhm->seq_number);
199 else 200 else
200 snprintf (filename, len, "%s/%d", mhm->mhd->name, mhm->seq_number); 201 snprintf (filename, len, "%s/%lu", mhm->mhd->name,
202 (unsigned long) mhm->seq_number);
201 return filename; 203 return filename;
202 } 204 }
203 205
...@@ -557,7 +559,8 @@ _mh_message_save (struct _mh_data *mhd, struct _mh_message *mhm, int expunge) ...@@ -557,7 +559,8 @@ _mh_message_save (struct _mh_data *mhd, struct _mh_message *mhm, int expunge)
557 559
558 /* Add imapbase */ 560 /* Add imapbase */
559 if (!mhd->msg_head || (mhd->msg_head == mhm)) /*FIXME*/ 561 if (!mhd->msg_head || (mhd->msg_head == mhm)) /*FIXME*/
560 fprintf (fp, "X-IMAPbase: %lu %u\n", mhd->uidvalidity, _mh_next_seq(mhd)); 562 fprintf (fp, "X-IMAPbase: %lu %u\n",
563 (unsigned long) mhd->uidvalidity, (unsigned) _mh_next_seq(mhd));
561 564
562 message_get_envelope (msg, &env); 565 message_get_envelope (msg, &env);
563 if (envelope_date (env, buffer, sizeof buffer, &n) == 0 && n > 0) 566 if (envelope_date (env, buffer, sizeof buffer, &n) == 0 && n > 0)
......
...@@ -146,7 +146,7 @@ void ...@@ -146,7 +146,7 @@ void
146 mh_global_save_state () 146 mh_global_save_state ()
147 { 147 {
148 char buf[64]; 148 char buf[64];
149 snprintf (buf, sizeof buf, "%d", current_message); 149 snprintf (buf, sizeof buf, "%lu", (unsigned long) current_message);
150 mh_context_set_value (sequences, "cur", buf); 150 mh_context_set_value (sequences, "cur", buf);
151 mh_context_write (sequences); 151 mh_context_write (sequences);
152 152
......