From 65dd06b7acff7ad14ec40c8616597426c49bc48d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:14 -1000 Subject: 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. --- source/ui-tree.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/ui-tree.c') 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, "%lu\n", lineno, lineno, lineno); + strbuf_addf(numbers, "%zu\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("\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, ""); else - htmlf("", size); + htmlf("", size); html("
%04lx", offset); + strbuf_addf(&row, "
%04zx", 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("-%lu%zu