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)
header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL);
header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject),
NULL);
printf ("Message: %d\n", i);
printf ("Message: %lu\n", (unsigned long) i);
printf ("From: %s\n", from);
printf ("Subject: %s\n", subject);
......@@ -148,8 +148,10 @@ main (int argc, char **argv)
fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret));
exit (2);
}
printf ("Number of parts in message - %d\n", nparts);
printf ("Total message size - %d\n", msize);
printf ("Number of parts in message - %lu\n",
(unsigned long) nparts);
printf ("Total message size - %lu\n",
(unsigned long) msize);
message_display_parts (msg, 0);
}
mailbox_close (mbox);
......@@ -203,7 +205,8 @@ message_display_parts (message_t msg, int indent)
header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type),
NULL);
printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type);
printf ("%*.*sMessage part size - %d\n", indent, indent, "", msize);
printf ("%*.*sMessage part size - %lu\n", indent, indent, "",
(unsigned long) msize);
encoding[0] = '\0';
header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding,
sizeof (encoding), NULL);
......
......@@ -316,7 +316,7 @@ mta_send (message_t msg)
message_get_stream (msg, &stream);
line = 0;
fprintf (diag, "%4d: ", line);
fprintf (diag, "%4lu: ", (unsigned long) line);
while (stream_read (stream, buffer, sizeof buffer - 1, off, &n) == 0
&& n != 0)
{
......@@ -328,7 +328,7 @@ mta_send (message_t msg)
if (buffer[i] == '\n')
{
line++;
fprintf (diag, "%4d: ", line);
fprintf (diag, "%4lu: ", (unsigned long) line);
}
}
off += n;
......
......@@ -559,7 +559,8 @@ var_read (int argc, char **argv, compose_env_t *env)
fputs (buf, ofile);
}
fclose (inf);
fprintf (stdout, "\"%s\" %d/%d\n", filename, lines, size);
fprintf (stdout, "\"%s\" %lu/%lu\n", filename,
(unsigned long) lines, (unsigned long) size);
free (filename);
return 0;
}
......@@ -614,7 +615,8 @@ var_write (int argc, char **argv, compose_env_t *env)
fputs (buf, fp);
}
fclose (fp);
fprintf (stdout, "\"%s\" %d/%d\n", filename, lines, size);
fprintf (stdout, "\"%s\" %lu/%lu\n", filename,
(unsigned long) lines, (unsigned long) size);
free (filename);
return 0;
}
......@@ -719,7 +721,8 @@ var_pipe (int argc, char **argv, compose_env_t *env)
rc = 0;
}
fprintf (stdout, "\"|%s\" in: %d/%d ", argv[1], lines, size);
fprintf (stdout, "\"|%s\" in: %lu/%lu ", argv[1],
(unsigned long) lines, (unsigned long) size);
if (rc)
{
fprintf (stdout, "no lines out\n");
......@@ -741,7 +744,8 @@ var_pipe (int argc, char **argv, compose_env_t *env)
}
fclose (env->file);
fprintf (stdout, "out: %d/%d\n", lines, size);
fprintf (stdout, "out: %lu/%lu\n",
(unsigned long) lines, (unsigned long) size);
}
/* Clean up the things */
......
......@@ -1232,7 +1232,7 @@ section_name (msg_imap_t msg_imap)
char *tmp;
char part[64];
size_t partlen;
snprintf (part, sizeof part, "%u", msg_imap->part);
snprintf (part, sizeof part, "%lu", (unsigned long) msg_imap->part);
partlen = strlen (part);
tmp = realloc (section, sectionlen + partlen + 2);
if (tmp == NULL)
......
......@@ -2178,9 +2178,11 @@ add_number (char **pset, size_t start, size_t end)
if (start == 0)
*buf = '\0';
else if (start != end)
snprintf (buf, sizeof buf, "%d:%d", start, end);
snprintf (buf, sizeof buf, "%lu:%lu",
(unsigned long) start,
(unsigned long) end);
else
snprintf (buf, sizeof buf, "%d", start);
snprintf (buf, sizeof buf, "%lu", (unsigned long) start);
if (set_len)
tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */);
......
......@@ -1602,7 +1602,8 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize,
if (first && is_expunging)
{
n = sprintf (buffer, "X-IMAPbase: %lu %u\n",
mud->uidvalidity, mud->uidnext);
(unsigned long) mud->uidvalidity,
(unsigned) mud->uidnext);
stream_write (mailbox->stream, buffer, n, *psize, &n);
*psize += n;
}
......@@ -1643,7 +1644,7 @@ mbox_append_message0 (mailbox_t mailbox, message_t msg, off_t *psize,
if (status == 0 || uid != 0)
{
n = sprintf (suid, "X-UID: %d\n", uid);
n = sprintf (suid, "X-UID: %u\n", (unsigned) uid);
/* Put the UID. */
status = stream_write (mailbox->stream, suid, n, *psize, &n);
if (status != 0)
......
......@@ -195,9 +195,11 @@ _mh_message_name (struct _mh_message *mhm, int deleted)
size_t len = strlen (mhm->mhd->name) + 32;
filename = malloc (len);
if (deleted)
snprintf (filename, len, "%s/,%d", mhm->mhd->name, mhm->seq_number);
snprintf (filename, len, "%s/,%lu", mhm->mhd->name,
(unsigned long) mhm->seq_number);
else
snprintf (filename, len, "%s/%d", mhm->mhd->name, mhm->seq_number);
snprintf (filename, len, "%s/%lu", mhm->mhd->name,
(unsigned long) mhm->seq_number);
return filename;
}
......@@ -557,7 +559,8 @@ _mh_message_save (struct _mh_data *mhd, struct _mh_message *mhm, int expunge)
/* Add imapbase */
if (!mhd->msg_head || (mhd->msg_head == mhm)) /*FIXME*/
fprintf (fp, "X-IMAPbase: %lu %u\n", mhd->uidvalidity, _mh_next_seq(mhd));
fprintf (fp, "X-IMAPbase: %lu %u\n",
(unsigned long) mhd->uidvalidity, (unsigned) _mh_next_seq(mhd));
message_get_envelope (msg, &env);
if (envelope_date (env, buffer, sizeof buffer, &n) == 0 && n > 0)
......
......@@ -146,7 +146,7 @@ void
mh_global_save_state ()
{
char buf[64];
snprintf (buf, sizeof buf, "%d", current_message);
snprintf (buf, sizeof buf, "%lu", (unsigned long) current_message);
mh_context_set_value (sequences, "cur", buf);
mh_context_write (sequences);
......