sha1_file.c: use type off_t* for object_info->disk_sizep
This field, filled by sha1_object_info() contains the on-disk size of an object, which could go over 4GB limit of unsigned long on 32-bit systems. Use off_t for it instead and update all callers. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
211c61c6cf
commit
166df26f28
@ -131,7 +131,7 @@ struct expand_data {
|
|||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
unsigned long disk_size;
|
off_t disk_size;
|
||||||
const char *rest;
|
const char *rest;
|
||||||
unsigned char delta_base_sha1[20];
|
unsigned char delta_base_sha1[20];
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
|
|||||||
if (data->mark_query)
|
if (data->mark_query)
|
||||||
data->info.disk_sizep = &data->disk_size;
|
data->info.disk_sizep = &data->disk_size;
|
||||||
else
|
else
|
||||||
strbuf_addf(sb, "%lu", data->disk_size);
|
strbuf_addf(sb, "%"PRIuMAX, (uintmax_t)data->disk_size);
|
||||||
} else if (is_atom("rest", atom, len)) {
|
} else if (is_atom("rest", atom, len)) {
|
||||||
if (data->mark_query)
|
if (data->mark_query)
|
||||||
data->split_on_whitespace = 1;
|
data->split_on_whitespace = 1;
|
||||||
|
2
cache.h
2
cache.h
@ -1502,7 +1502,7 @@ struct object_info {
|
|||||||
/* Request */
|
/* Request */
|
||||||
enum object_type *typep;
|
enum object_type *typep;
|
||||||
unsigned long *sizep;
|
unsigned long *sizep;
|
||||||
unsigned long *disk_sizep;
|
off_t *disk_sizep;
|
||||||
unsigned char *delta_base_sha1;
|
unsigned char *delta_base_sha1;
|
||||||
struct strbuf *typename;
|
struct strbuf *typename;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user