Re: [PATCH v2 4/7] odb: teach read_blob_entry to use size_t
- From
Carlo Arenas <carenas@gmail.com>
- Date
- Oct 28, 2021, 22:14 UTC
- Message-ID
- <CAPUEsphWBuQybeBe8bjaUFZ=k+5maYCxiY4wche4XLVFPph+fw@mail.gmail.com>
- In-Reply-To
- <3ffd3a001f742713eb0fde8508f876ff95103d82.1635454237.git.gitgitgadget@gmail.com>
On Thu, Oct 28, 2021 at 1:50 PM Matt Cooper via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 17 quoted lines
> diff --git a/entry.c b/entry.c
> index 711ee0693c7..4cb3942dbdc 100644
> --- a/entry.c
> +++ b/entry.c
> @@ -82,11 +82,13 @@ static int create_file(const char *path, unsigned int mode)
> return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
> }
>
> -void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)
> +void *read_blob_entry(const struct cache_entry *ce, size_t *size)
> {
> enum object_type type;
> - void *blob_data = read_object_file(&ce->oid, &type, size);
> + unsigned long ul;
> + void *blob_data = read_object_file(&ce->oid, &type, &ul);
>
> + *size = ul;Considering this unsigned long variable is obviously holding an incorrect value, might be worth adding a "TODO" comment here, mentioning it should be changed to a real size_t (probably after release, since it is obvious that change is too intrusive to need this as a kludge for now).
Carlo