commit 17ce8c9ec7b5fc669fe3c1285c29b5b6fd1a409a
parent a4d8cc9e561103401fde97b8d79179763b0ba2b4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 15 Nov 2020 21:24:15 +0100
use size_t to count lines
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -594,11 +594,11 @@ writefooter(FILE *fp)
{
}
-int
+size_t
writeblobgph(FILE *fp, const git_blob *blob)
{
size_t n = 0, i, j, prev;
- const char *nfmt = "%6d ";
+ const char *nfmt = "%6zu ";
const char *s = git_blob_rawcontent(blob);
git_off_t len = git_blob_rawsize(blob);
@@ -968,11 +968,11 @@ 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;
- int lc = 0;
+ size_t lc = 0;
FILE *fp;
if (strlcpy(tmp, fpath, sizeof(tmp)) >= sizeof(tmp))
@@ -1052,8 +1052,8 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
git_off_t filesize;
const char *entryname;
char buf[256], 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++) {
@@ -1094,7 +1094,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
gphlink(fp, buf, strlen(buf));
fputs(" ", fp);
if (lc > 0)
- fprintf(fp, "%7dL", lc);
+ fprintf(fp, "%7zuL", lc);
else
fprintf(fp, "%7juB", (uintmax_t)filesize);
fprintf(fp, "|%s/", relpath);