summaryrefslogtreecommitdiffabout
path: root/ui-stats.c
Unidiff
Diffstat (limited to 'ui-stats.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-stats.c20
1 files changed, 12 insertions, 8 deletions
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 @@
1#include <string-list.h>
2
3#include "cgit.h" 1#include "cgit.h"
4#include "html.h" 2#include "html.h"
5#include "ui-shared.h" 3#include "ui-shared.h"
6#include "ui-stats.h" 4#include "ui-stats.h"
7 5
6#ifdef NO_C99_FORMAT
7#define SZ_FMT "%u"
8#else
9#define SZ_FMT "%zu"
10#endif
11
8#define MONTHS 6 12#define MONTHS 6
9 13
10struct authorstat { 14struct authorstat {
@@ -283,10 +287,10 @@ void print_combined_authorrow(struct string_list *authors, int from, int to,
283 if (date) 287 if (date)
284 subtotal += (size_t)date->util; 288 subtotal += (size_t)date->util;
285 } 289 }
286 htmlf("<td class='%s'>%d</td>", centerclass, subtotal); 290 htmlf("<td class='%s'>%ld</td>", centerclass, subtotal);
287 total += subtotal; 291 total += subtotal;
288 } 292 }
289 htmlf("<td class='%s'>%d</td></tr>", rightclass, total); 293 htmlf("<td class='%s'>%ld</td></tr>", rightclass, total);
290} 294}
291 295
292void print_authors(struct string_list *authors, int top, 296void print_authors(struct string_list *authors, int top,
@@ -335,16 +339,16 @@ void print_authors(struct string_list *authors, int top,
335 if (!date) 339 if (!date)
336 html("<td>0</td>"); 340 html("<td>0</td>");
337 else { 341 else {
338 htmlf("<td>%d</td>", date->util); 342 htmlf("<td>"SZ_FMT"</td>", (size_t)date->util);
339 total += (size_t)date->util; 343 total += (size_t)date->util;
340 } 344 }
341 } 345 }
342 htmlf("<td class='sum'>%d</td></tr>", total); 346 htmlf("<td class='sum'>%ld</td></tr>", total);
343 } 347 }
344 348
345 if (top < authors->nr) 349 if (top < authors->nr)
346 print_combined_authorrow(authors, top, authors->nr - 1, 350 print_combined_authorrow(authors, top, authors->nr - 1,
347 "Others (%d)", "left", "", "sum", period); 351 "Others (%ld)", "left", "", "sum", period);
348 352
349 print_combined_authorrow(authors, 0, authors->nr - 1, "Total", 353 print_combined_authorrow(authors, 0, authors->nr - 1, "Total",
350 "total", "sum", "sum", period); 354 "total", "sum", "sum", period);
@@ -367,7 +371,7 @@ void cgit_show_stats(struct cgit_context *ctx)
367 371
368 i = cgit_find_stats_period(code, &period); 372 i = cgit_find_stats_period(code, &period);
369 if (!i) { 373 if (!i) {
370 cgit_print_error(fmt("Unknown statistics type: %c", code)); 374 cgit_print_error(fmt("Unknown statistics type: %c", code[0]));
371 return; 375 return;
372 } 376 }
373 if (i > ctx->repo->max_stats) { 377 if (i > ctx->repo->max_stats) {