tree: widen struct tree.size and parse_tree_buffer() to size_t

Final piece of the tree topic. struct tree.size already receives
its values from size_t-shaped sources (odb_read_object() in
repo_parse_tree_gently() and in reflog.c::tree_is_complete()),
so on Windows it was already silently truncating anything past
4 GiB. Switch the field and parse_tree_buffer()'s size parameter
to size_t.

All readers feed tree->size into init_tree_desc(), which was
widened earlier in this topic; the existing parse_object_buffer()
caller in object.c keeps its unsigned long parameter, which
promotes cleanly.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2026-06-05 21:27:35 +02:00
parent 01c4367a16
commit b10cb43c9c
2 changed files with 3 additions and 3 deletions

2
tree.c
View File

@@ -172,7 +172,7 @@ struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
return object_as_type(obj, OBJ_TREE, 0);
}
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
int parse_tree_buffer(struct tree *item, void *buffer, size_t size)
{
if (item->object.parsed)
return 0;

4
tree.h
View File

@@ -10,14 +10,14 @@ struct strbuf;
struct tree {
struct object object;
void *buffer;
unsigned long size;
size_t size;
};
extern const char *tree_type;
struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
int parse_tree_buffer(struct tree *item, void *buffer, size_t size);
#define parse_tree_gently(t, q) repo_parse_tree_gently(the_repository, t, q)
int repo_parse_tree_gently(struct repository *r, struct tree *item,