stagit

git site generator
Contents

use size_t to count lines

Hiltjo Posthuma hiltjo@codemadness.org

commit: 8bc0a1b parent: 7de514d
1 files changed, 7 insertions(+), 7 deletions(-)
Mstagit.c+7-7
M · stagit.c +7, -7
 1@@ -500,11 +500,11 @@ writefooter(FILE *fp)
 2
fputs("</div>\n</body>\n</html>\n", fp);
 3 }
 4
 5-int
 6+size_t
 7 writeblobhtml(FILE *fp, const git_blob *blob)
 8 {
 9 size_t n = 0, i,
prev;
10- const char *nfmt = "<a href=\"#l%d\"
class=\"line\" id=\"l%d\">%7d</a> ";
11+ const char *nfmt =
"<a href=\"#l%zu\" class=\"line\"
id=\"l%zu\">%7zu</a> ";
12 const char *s = git_blob_rawcontent(blob);
13 git_off_t len =
git_blob_rawsize(blob);
14
15@@ -884,12 +884,12 @@ writeatom(FILE *fp, int all)
16 return 0;
17 }
18
19-int
20+size_t
21 writeblob(git_object *obj, const char *fpath, const
char *filename, git_off_t filesize)
22 {
23 char
tmp[PATH_MAX] = "", *d;
24 const char *p;
25- int lc = 0;
26+ size_t lc = 0;
27 FILE *fp;
28
29 if (strlcpy(tmp,
fpath, sizeof(tmp)) >= sizeof(tmp))
30@@ -977,8 +977,8 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
31 git_off_t filesize;
32 const char
*entryname;
33 char
filepath[PATH_MAX], entrypath[PATH_MAX];
34- size_t count, i;
35- int lc, r, ret;
36+ size_t count, i, lc;
37+ int r, ret;
38
39 count =
git_tree_entrycount(tree);
40 for (i = 0; i
< count; i++) {
41@@ -1020,7 +1020,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
42 xmlencode(fp, entrypath, strlen(entrypath));
43
fputs("</a></td><td class=\"num\"
align=\"right\">", fp);
44 if (lc >
0)
45- fprintf(fp, "%dL", lc);
46+ fprintf(fp,
"%zuL", lc);
47 else
48 fprintf(fp,
"%juB", (uintmax_t)filesize);
49
fputs("</td></tr>\n", fp);