X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/82a883ede7e47616aba041a5eb36e08666ef9177..1b09cbd303d889ec2636127584d57b7f1b70c25e:/ui-stats.c diff --git a/ui-stats.c b/ui-stats.c index 50c2540..2a0c174 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -1,10 +1,14 @@ -#include - #include "cgit.h" #include "html.h" #include "ui-shared.h" #include "ui-stats.h" +#ifdef NO_C99_FORMAT +#define SZ_FMT "%u" +#else +#define SZ_FMT "%zu" +#endif + #define MONTHS 6 struct authorstat { @@ -283,10 +287,10 @@ void print_combined_authorrow(struct string_list *authors, int from, int to, if (date) subtotal += (size_t)date->util; } - htmlf("%d", centerclass, subtotal); + htmlf("%ld", centerclass, subtotal); total += subtotal; } - htmlf("%d", rightclass, total); + htmlf("%ld", rightclass, total); } void print_authors(struct string_list *authors, int top, @@ -335,16 +339,16 @@ void print_authors(struct string_list *authors, int top, if (!date) html("0"); else { - htmlf("%d", date->util); + htmlf(""SZ_FMT"", (size_t)date->util); total += (size_t)date->util; } } - htmlf("%d", total); + htmlf("%ld", total); } if (top < authors->nr) print_combined_authorrow(authors, top, authors->nr - 1, - "Others (%d)", "left", "", "sum", period); + "Others (%ld)", "left", "", "sum", period); print_combined_authorrow(authors, 0, authors->nr - 1, "Total", "total", "sum", "sum", period); @@ -367,7 +371,7 @@ void cgit_show_stats(struct cgit_context *ctx) i = cgit_find_stats_period(code, &period); if (!i) { - cgit_print_error(fmt("Unknown statistics type: %c", code)); + cgit_print_error(fmt("Unknown statistics type: %c", code[0])); return; } if (i > ctx->repo->max_stats) {