List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH (resend)] ui-stats.c: fix warning on 32-bit
@ 2021-03-19 20:19 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-03-19 20:19 UTC (permalink / raw)
  To: cgit

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-19 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 20:19 [PATCH (resend)] ui-stats.c: fix warning on 32-bit Eric Wong

List for cgit developers and users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/cgit

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 cgit cgit/ http://inbox.vuxu.org/cgit \
		cgit@lists.zx2c4.com
	public-inbox-index cgit

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.cgit


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git