aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiltjo Posthuma <[email protected]>2020-11-15 20:59:34 +0100
committerHiltjo Posthuma <[email protected]>2020-11-15 21:01:50 +0100
commitfc5ef41165df39d6def252e5230a63cc6839bfc1 (patch)
tree208c66df2869c3d1b8a8a1d2469b9e75f21fffe2
parent4f60446c011b45e862540c97b684c62fd8dc3c60 (diff)
downloadstagit-fc5ef41165df39d6def252e5230a63cc6839bfc1.tar.gz
stagit-fc5ef41165df39d6def252e5230a63cc6839bfc1.zip
use size_t to count lines
-rw-r--r--stagit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/stagit.c b/stagit.c
index 4c5ca50..13f5705 100644
--- a/stagit.c
+++ b/stagit.c
@@ -500,11 +500,11 @@ writefooter(FILE *fp)
fputs("</div>\n</body>\n</html>\n", fp);
}
-int
+size_t
writeblobhtml(FILE *fp, const git_blob *blob)
{
size_t n = 0, i, prev;
- const char *nfmt = "<a href=\"#l%d\" class=\"line\" id=\"l%d\">%7d</a> ";
+ const char *nfmt = "<a href=\"#l%zu\" class=\"line\" id=\"l%zu\">%7zu</a> ";
const char *s = git_blob_rawcontent(blob);
git_off_t len = git_blob_rawsize(blob);
@@ -884,12 +884,12 @@ writeatom(FILE *fp, int all)
return 0;
}
-int
+size_t
writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t filesize)
{
char tmp[PATH_MAX] = "", *d;
const char *p;
- int lc = 0;
+ size_t lc = 0;
FILE *fp;
if (strlcpy(tmp, fpath, sizeof(tmp)) >= sizeof(tmp))
@@ -977,8 +977,8 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
git_off_t filesize;
const char *entryname;
char filepath[PATH_MAX], entrypath[PATH_MAX];
- size_t count, i;
- int lc, r, ret;
+ size_t count, i, lc;
+ int r, ret;
count = git_tree_entrycount(tree);
for (i = 0; i < count; i++) {
@@ -1020,7 +1020,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
xmlencode(fp, entrypath, strlen(entrypath));
fputs("</a></td><td class=\"num\" align=\"right\">", fp);
if (lc > 0)
- fprintf(fp, "%dL", lc);
+ fprintf(fp, "%zuL", lc);
else
fprintf(fp, "%juB", (uintmax_t)filesize);
fputs("</td></tr>\n", fp);