Skip to content

Commit

Permalink
fix more printf-style params
Browse files Browse the repository at this point in the history
  • Loading branch information
nabijaczleweli authored and flatcap committed Nov 4, 2023
1 parent 44812af commit a39a752
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion config/bool.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int bool_native_set(const struct ConfigSet *cs, void *var,
{
if ((value < 0) || (value > 1))
{
buf_printf(err, _("Invalid boolean value: %ld"), value);
buf_printf(err, _("Invalid boolean value: %ld"), (long) value);
return CSR_ERR_INVALID | CSR_INV_TYPE;
}

Expand Down
2 changes: 1 addition & 1 deletion config/enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int enum_native_set(const struct ConfigSet *cs, void *var,
const char *name = mutt_map_get_name(value, ed->lookup);
if (!name)
{
buf_printf(err, _("Invalid enum value: %ld"), value);
buf_printf(err, _("Invalid enum value: %ld"), (long) value);
return CSR_ERR_INVALID | CSR_INV_TYPE;
}

Expand Down
2 changes: 1 addition & 1 deletion config/number.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int number_native_set(const struct ConfigSet *cs, void *var,
{
if ((value < SHRT_MIN) || (value > SHRT_MAX))
{
buf_printf(err, _("Invalid number: %ld"), value);
buf_printf(err, _("Invalid number: %ld"), (long) value);
return CSR_ERR_INVALID | CSR_INV_TYPE;
}

Expand Down
2 changes: 1 addition & 1 deletion config/quad.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int quad_native_set(const struct ConfigSet *cs, void *var,
{
if ((value < 0) || (value >= (mutt_array_size(QuadValues) - 1)))
{
buf_printf(err, _("Invalid quad value: %ld"), value);
buf_printf(err, _("Invalid quad value: %ld"), (long) value);
return CSR_ERR_INVALID | CSR_INV_TYPE;
}

Expand Down
2 changes: 1 addition & 1 deletion config/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static int sort_native_set(const struct ConfigSet *cs, void *var,

if (!str)
{
buf_printf(err, _("Invalid sort type: %ld"), value);
buf_printf(err, _("Invalid sort type: %ld"), (long) value);
return CSR_ERR_INVALID | CSR_INV_TYPE;
}

Expand Down
2 changes: 1 addition & 1 deletion conn/connaccount.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ char *mutt_account_getoauthbearer(struct ConnAccount *cac, bool xoauth2)

if ((!xoauth2 && (token_size > 512)) || (xoauth2 && (token_size > 4096)))
{
mutt_error(_("OAUTH token is too big: %ld"), token_size);
mutt_error(_("OAUTH token is too big: %ld"), (long) token_size);
FREE(&token);
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions conn/zstrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int zstrm_read(struct Connection *conn, char *buf, size_t len)
zctx->read.z.next_out = (Bytef *) buf;

zrc = inflate(&zctx->read.z, Z_SYNC_FLUSH);
mutt_debug(LL_DEBUG5, "rc=%d, consumed %u/%u bytes, produced %lu/%lu bytes\n",
mutt_debug(LL_DEBUG5, "rc=%d, consumed %u/%u bytes, produced %zu/%zu bytes\n",
zrc, zctx->read.pos - zctx->read.z.avail_in, zctx->read.pos,
len - zctx->read.z.avail_out, len);

Expand Down Expand Up @@ -243,7 +243,7 @@ static int zstrm_write(struct Connection *conn, const char *buf, size_t count)
/* push out produced data to the underlying stream */
zctx->write.pos = zctx->write.len - zctx->write.z.avail_out;
char *wbufp = zctx->write.buf;
mutt_debug(LL_DEBUG5, "deflate consumed %lu/%lu bytes\n",
mutt_debug(LL_DEBUG5, "deflate consumed %zu/%zu bytes\n",
count - zctx->write.z.avail_in, count);
while (zctx->write.pos > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion envelope/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static int draw_envelope_addr(int field, struct AddressList *al,
width_left -= addr_len;
}
mutt_debug(LL_DEBUG3, "%d addresses remaining\n", count);
mutt_debug(LL_DEBUG3, "%ld lines remaining\n", max_lines - lines_used);
mutt_debug(LL_DEBUG3, "%zd lines remaining\n", max_lines - lines_used);
}
mutt_list_free(&list);
buf_pool_release(&buf);
Expand Down
8 changes: 4 additions & 4 deletions imap/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static void cmd_parse_capability(struct ImapAccountData *adata, char *s)
if (len != 0 && ((s[len] == '\0') || isspace(s[len])))
{
adata->capabilities |= (1 << i);
mutt_debug(LL_DEBUG3, " Found capability \"%s\": %lu\n", Capabilities[i], i);
mutt_debug(LL_DEBUG3, " Found capability \"%s\": %zu\n", Capabilities[i], i);
break;
}
}
Expand Down Expand Up @@ -1151,7 +1151,7 @@ int imap_cmd_step(struct ImapAccountData *adata)
{
mutt_mem_realloc(&adata->buf, adata->blen + IMAP_CMD_BUFSIZE);
adata->blen = adata->blen + IMAP_CMD_BUFSIZE;
mutt_debug(LL_DEBUG3, "grew buffer to %lu bytes\n", adata->blen);
mutt_debug(LL_DEBUG3, "grew buffer to %zu bytes\n", adata->blen);
}

/* back up over '\0' */
Expand All @@ -1177,7 +1177,7 @@ int imap_cmd_step(struct ImapAccountData *adata)
{
mutt_mem_realloc(&adata->buf, IMAP_CMD_BUFSIZE);
adata->blen = IMAP_CMD_BUFSIZE;
mutt_debug(LL_DEBUG3, "shrank buffer to %lu bytes\n", adata->blen);
mutt_debug(LL_DEBUG3, "shrank buffer to %zu bytes\n", adata->blen);
}

adata->lastread = mutt_date_now();
Expand Down Expand Up @@ -1410,7 +1410,7 @@ void imap_cmd_finish(struct ImapAccountData *adata)
if (!(mdata->reopen & IMAP_EXPUNGE_PENDING))
mdata->check_status |= IMAP_NEWMAIL_PENDING;

mutt_debug(LL_DEBUG2, "Fetching new mails from %ld to %u\n",
mutt_debug(LL_DEBUG2, "Fetching new mails from %zd to %u\n",
max_msn + 1, mdata->new_mail_count);
imap_read_headers(adata->mailbox, max_msn + 1, mdata->new_mail_count, false);
}
Expand Down
2 changes: 1 addition & 1 deletion mutt_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int level_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef,
{
if ((value < 0) || (value >= LL_MAX))
{
buf_printf(err, _("Invalid value for option %s: %ld"), cdef->name, value);
buf_printf(err, _("Invalid value for option %s: %ld"), cdef->name, (long) value);
return CSR_ERR_INVALID;
}

Expand Down
2 changes: 1 addition & 1 deletion nntp/nntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ static int nntp_date(struct NntpAccountData *adata, time_t *now)
*now = timegm(&tm);
if (*now >= 0)
{
mutt_debug(LL_DEBUG1, "server time is %lu\n", *now);
mutt_debug(LL_DEBUG1, "server time is %llu\n", (unsigned long long) *now);
return 0;
}
}
Expand Down
8 changes: 4 additions & 4 deletions notmuch/notmuch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2090,13 +2090,13 @@ static enum MxStatus nm_mbox_check(struct Mailbox *m)

if (mdata->mtime.tv_sec >= mtime)
{
mutt_debug(LL_DEBUG2, "nm: check unnecessary (db=%lu mailbox=%lu)\n", mtime,
mdata->mtime.tv_sec);
mutt_debug(LL_DEBUG2, "nm: check unnecessary (db=%llu mailbox=%llu)\n",
(unsigned long long) mtime, (unsigned long long) mdata->mtime.tv_sec);
return MX_STATUS_OK;
}

mutt_debug(LL_DEBUG1, "nm: checking (db=%lu mailbox=%lu)\n", mtime,
mdata->mtime.tv_sec);
mutt_debug(LL_DEBUG1, "nm: checking (db=%llu mailbox=%llu)\n",
(unsigned long long) mtime, (unsigned long long) mdata->mtime.tv_sec);

notmuch_query_t *q = get_query(m, false);
if (!q)
Expand Down
6 changes: 3 additions & 3 deletions pager/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ static int format_line(struct MuttWindow *win, struct Line **lines, int line_num
{
if (k == ICONV_ILLEGAL_SEQ)
memset(&mbstate, 0, sizeof(mbstate));
mutt_debug(LL_DEBUG1, "mbrtowc returned %lu; errno = %d\n", k, errno);
mutt_debug(LL_DEBUG1, "mbrtowc returned %zu; errno = %d\n", k, errno);
if ((col + 4) > wrap_cols)
break;
col += 4;
Expand Down Expand Up @@ -970,15 +970,15 @@ static int format_line(struct MuttWindow *win, struct Line **lines, int line_num
break;
col += 2;
if (ansi)
mutt_window_printf(win, "^%c", ('@' + wc) & 0x7f);
mutt_window_printf(win, "^%c", (char) (('@' + wc) & 0x7f));
}
else if (wc < 0x100)
{
if ((col + 4) > wrap_cols)
break;
col += 4;
if (ansi)
mutt_window_printf(win, "\\%03o", wc);
mutt_window_printf(win, "\\%03lo", (long) wc);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions rfc3676.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ static void print_flowed_line(char *line, struct State *state, int ql,
width = quote_width(state, ql);
last = line[mutt_str_len(line) - 1];

mutt_debug(LL_DEBUG5, "f=f: line [%s], width = %ld, spaces = %lu\n", line,
mutt_debug(LL_DEBUG5, "f=f: line [%s], width = %ld, spaces = %zu\n", line,
(long) width, fst->spaces);

for (words = 0; (p = mutt_str_sep(&line, " "));)
{
mutt_debug(LL_DEBUG5, "f=f: word [%s], width: %lu, remaining = [%s]\n", p,
mutt_debug(LL_DEBUG5, "f=f: word [%s], width: %zu, remaining = [%s]\n", p,
fst->width, line);

/* remember number of spaces */
Expand All @@ -268,7 +268,7 @@ static void print_flowed_line(char *line, struct State *state, int ql,
if (!(!fst->spaces && fst->delsp && (last != ' ')) && (w < width) &&
(w + fst->width + fst->spaces > width))
{
mutt_debug(LL_DEBUG3, "f=f: break line at %lu, %lu spaces left\n",
mutt_debug(LL_DEBUG3, "f=f: break line at %zu, %zu spaces left\n",
fst->width, fst->spaces);
/* only honor trailing spaces for format=flowed replies */
const bool c_text_flowed = cs_subset_bool(NeoMutt->sub, "text_flowed");
Expand Down
4 changes: 2 additions & 2 deletions send/smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,13 @@ static int smtp_get_auth_response(struct Connection *conn, struct Buffer *input_
if (*smtp_rc != SMTP_READY)
break;

const char *smtp_response = buf_string(input_buf) + 3;
const char *smtp_response = input_buf->data + 3;
if (*smtp_response)
{
smtp_response++;
buf_addstr(response_buf, smtp_response);
}
} while (buf_string(input_buf)[3] == '-');
} while (input_buf->data[3] == '-');

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions test/config/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int validator_fail(const struct ConfigSet *cs, const struct ConfigDef *cdef,
if (value > 1000000)
buf_printf(result, "%s: %s, (ptr)", __func__, cdef->name);
else
buf_printf(result, "%s: %s, %ld", __func__, cdef->name, value);
buf_printf(result, "%s: %s, %zd", __func__, cdef->name, value);
return CSR_ERR_INVALID;
}

Expand All @@ -55,7 +55,7 @@ int validator_warn(const struct ConfigSet *cs, const struct ConfigDef *cdef,
if (value > 1000000)
buf_printf(result, "%s: %s, (ptr)", __func__, cdef->name);
else
buf_printf(result, "%s: %s, %ld", __func__, cdef->name, value);
buf_printf(result, "%s: %s, %zd", __func__, cdef->name, value);
return CSR_SUCCESS | CSR_SUC_WARNING;
}

Expand All @@ -65,7 +65,7 @@ int validator_succeed(const struct ConfigSet *cs, const struct ConfigDef *cdef,
if (value > 1000000)
buf_printf(result, "%s: %s, (ptr)", __func__, cdef->name);
else
buf_printf(result, "%s: %s, %ld", __func__, cdef->name, value);
buf_printf(result, "%s: %s, %zd", __func__, cdef->name, value);
return CSR_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion test/config/slist.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void slist_dump(const struct Slist *list, struct Buffer *buf)
if (!list || !buf)
return;

buf_printf(buf, "[%ld] ", list->count);
buf_printf(buf, "[%zu] ", list->count);

struct ListNode *np = NULL;
STAILQ_FOREACH(np, &list->head, entries)
Expand Down

0 comments on commit a39a752

Please sign in to comment.