mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-25 19:43:19 -05:00
write_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 <philipoakley@iee.email> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
68bb0cce98
commit
254707b032
@@ -1795,7 +1795,7 @@ static void write_object_file_prepare(const struct git_hash_algo *algo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void write_object_file_prepare_literally(const struct git_hash_algo *algo,
|
static void write_object_file_prepare_literally(const struct git_hash_algo *algo,
|
||||||
const void *buf, unsigned long len,
|
const void *buf, size_t len,
|
||||||
const char *type, struct object_id *oid,
|
const char *type, struct object_id *oid,
|
||||||
char *hdr, int *hdrlen)
|
char *hdr, int *hdrlen)
|
||||||
{
|
{
|
||||||
@@ -2218,7 +2218,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
|
|||||||
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
|
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_object_file_literally(const void *buf, unsigned long len,
|
int write_object_file_literally(const void *buf, size_t len,
|
||||||
const char *type, struct object_id *oid,
|
const char *type, struct object_id *oid,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ static inline int write_object_file(const void *buf, unsigned long len,
|
|||||||
return write_object_file_flags(buf, len, type, oid, 0);
|
return write_object_file_flags(buf, len, type, oid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_object_file_literally(const void *buf, unsigned long len,
|
int write_object_file_literally(const void *buf, size_t len,
|
||||||
const char *type, struct object_id *oid,
|
const char *type, struct object_id *oid,
|
||||||
unsigned flags);
|
unsigned flags);
|
||||||
int stream_loose_object(struct input_stream *in_stream, size_t len,
|
int stream_loose_object(struct input_stream *in_stream, size_t len,
|
||||||
|
|||||||
Reference in New Issue
Block a user