Skip to content

Commit 67deefb

Browse files
PhilipOakleyvdye
authored andcommitted
hash_object_file_literally(): use size_t
The previous commit adds a test that demonstrates a problem in the `hash-object --literally` command, manifesting in an unnecessary file size limit on systems using the LLP64 data model (which includes Windows). Walking the affected code path is `cmd_hash_object()` >> `hash_fd()` >> `hash_literally()` >> `hash_object_file_literally()`. The function `hash_object_file_literally()` is the first with a file length parameter (via a mem buffer). This commit changes the type of that parameter to the LLP64 compatible `size_t` type. There are no other uses of the function. The `strbuf` type is already `size_t` compatible. Note: The hash-object test does not yet pass. Subsequent commits will continue to walk the call tree's lower level functions to identify further fixes. Signed-off-by: Philip Oakley <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent f154e75 commit 67deefb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

object-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
20242024
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
20252025
}
20262026

2027-
int hash_object_file_literally(const void *buf, unsigned long len,
2027+
int hash_object_file_literally(const void *buf, size_t len,
20282028
const char *type, struct object_id *oid,
20292029
unsigned flags)
20302030
{

object-store.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static inline int write_object_file(const void *buf, unsigned long len,
258258
return write_object_file_flags(buf, len, type, oid, 0);
259259
}
260260

261-
int hash_object_file_literally(const void *buf, unsigned long len,
261+
int hash_object_file_literally(const void *buf, size_t len,
262262
const char *type, struct object_id *oid,
263263
unsigned flags);
264264

0 commit comments

Comments
 (0)