mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-23 15:55:21 -05:00
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:
2
tree.c
2
tree.c
@@ -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
4
tree.h
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user