diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Hold object sizes in size_t as git 2.55 does
Git 2.55 moved object sizes from unsigned long to size_t. The two are
the same type on 64-bit hosts, but not on a 32-bit one, where GCC 14
rejects the mismatched pointers, so cgit stopped compiling there.
Diffstat (limited to 'source/ui-tree.c')
| -rw-r--r-- | source/ui-tree.c | 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 11 insertions, 11 deletions
diff --git a/source/ui-tree.c b/source/ui-tree.c index d023502..bee750c 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -58,15 +58,15 @@ struct only_child { * The anchors are handed over in batches rather than a write per line, and * never built whole, which would come to several times the blob's size. */ -static void add_linenumber(struct strbuf *numbers, unsigned long lineno) +static void add_linenumber(struct strbuf *numbers, size_t lineno) { - strbuf_addf(numbers, "<a id='n%lu' href='#n%lu'>%lu</a>\n", lineno, lineno, lineno); + strbuf_addf(numbers, "<a id='n%zu' href='#n%zu'>%zu</a>\n", lineno, lineno, lineno); } -static void print_linenumbers(const char *buf, unsigned long size) +static void print_linenumbers(const char *buf, size_t size) { struct strbuf numbers = STRBUF_INIT; - unsigned long lineno = 0, idx = 0; + size_t lineno = 0, idx = 0; if (size) { add_linenumber(&numbers, ++lineno); @@ -88,7 +88,7 @@ static void print_linenumbers(const char *buf, unsigned long size) strbuf_release(&numbers); } -static void print_text_buffer(const char *filename, char *buf, unsigned long size) +static void print_text_buffer(const char *filename, char *buf, size_t size) { html("<table class='blob'>\n"); @@ -126,9 +126,9 @@ static int is_graphic(unsigned char ch) return isprint(ch) && !isspace(ch); } -static void print_binary_buffer(char *buf, unsigned long size) +static void print_binary_buffer(char *buf, size_t size) { - unsigned long offset, idx; + size_t offset, idx; char ascii[HEXDUMP_ROW_BYTES + 1]; struct strbuf row = STRBUF_INIT; @@ -138,7 +138,7 @@ static void print_binary_buffer(char *buf, unsigned long size) // A row goes out in one write rather than a write per byte. for (offset = 0; offset < size; offset += HEXDUMP_ROW_BYTES, buf += HEXDUMP_ROW_BYTES) { strbuf_reset(&row); - strbuf_addf(&row, "<tr><td class='right'>%04lx</td><td class='hex'>", offset); + strbuf_addf(&row, "<tr><td class='right'>%04zx</td><td class='hex'>", offset); for (idx = 0; idx < HEXDUMP_ROW_BYTES && offset + idx < size; idx++) { int gap = idx == HEXDUMP_ROW_HALF ? HEXDUMP_GAP_WIDTH : 1; @@ -167,7 +167,7 @@ static bool print_object(const struct object_id *oid, const char *path, { enum object_type type; char *buf; - unsigned long size; + size_t size; bool is_binary; type = odb_read_object_info(the_repository->objects, oid, &size); @@ -280,7 +280,7 @@ static void print_ls_row(const struct object_id *oid, const char *pathname, struct strbuf linkpath = STRBUF_INIT; struct strbuf class = STRBUF_INIT; enum object_type type; - unsigned long size = 0; + size_t size = 0; char *buf; name = xstrdup(pathname); @@ -346,7 +346,7 @@ static void print_ls_row(const struct object_id *oid, const char *pathname, if (S_ISGITLINK(mode)) html("</td><td class='ls-size'>-</td>"); else - htmlf("</td><td class='ls-size'>%lu</td>", size); + htmlf("</td><td class='ls-size'>%zu</td>", size); html("<td class='ls-links'>"); cgit_log_link("log", NULL, "button", ctx.qry.head, walk->rev, fullpath.buf, |
