From: Eric Wong <e@80x24.org>
To: cgit@lists.zx2c4.com
Subject: [PATCH (resend)] ui-stats.c: fix warning on 32-bit
Date: Fri, 19 Mar 2021 20:19:31 +0000 [thread overview]
Message-ID: <20210319201931.GA17268@dcvr> (raw)
gcc 6.3.0-18 on Debian oldstable emits the following warning,
despite uintptr_t and "unsigned long" having the same size:
> ../ui-stats.c: In function ‘print_authors’:
> ../ui-stats.c:340:18: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat=]
> htmlf("<td>%lu</td>", (uintptr_t)date->util);
> ^
Signed-off-by: Eric Wong <e@80x24.org>
---
ui-stats.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui-stats.c b/ui-stats.c
index 09b3625..ad22dae 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -337,8 +337,10 @@ static void print_authors(struct string_list *authors, int top,
if (!date)
html("<td>0</td>");
else {
- htmlf("<td>%lu</td>", (uintptr_t)date->util);
- total += (uintptr_t)date->util;
+ uintptr_t util = (uintptr_t)date->util;
+
+ htmlf("<td>%"PRIuPTR"</td>", util);
+ total += util;
}
}
htmlf("<td class='sum'>%ld</td></tr>", total);
reply other threads:[~2021-03-19 20:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210319201931.GA17268@dcvr \
--to=e@80x24.org \
--cc=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).