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>
Nguyễn Thái Ngọc Duy committed
Jul 13, 2016 at 17:43 UTC
166df26f2821ea23b7c269a32fd63be43a2a0bb9
2 files changed
+3
-3
builtin/cat-file.c
+2
-2
@@ -131,7 +131,7 @@ struct expand_data {
131
unsigned char sha1[20];
132
enum object_type type;
133
unsigned long size;
134
- unsigned long disk_size;
134
+ off_t disk_size;
135
const char *rest;
136
unsigned char delta_base_sha1[20];
137
@@ -184,7 +184,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
184
if (data->mark_query)
185
data->info.disk_sizep = &data->disk_size;
186
else
187
- strbuf_addf(sb, "%lu", data->disk_size);
187
+ strbuf_addf(sb, "%"PRIuMAX, (uintmax_t)data->disk_size);
188
} else if (is_atom("rest", atom, len)) {
189
if (data->mark_query)
190
data->split_on_whitespace = 1;
cache.h
+1
-1
@@ -1502,7 +1502,7 @@ struct object_info {
1502
/* Request */
1503
enum object_type *typep;
1504
unsigned long *sizep;
1505
- unsigned long *disk_sizep;
1505
+ off_t *disk_sizep;
1506
unsigned char *delta_base_sha1;
1507
struct strbuf *typename;
1508