summaryrefslogtreecommitdiff
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-07-13 15:43:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-13 16:14:20 (GMT)
commit166df26f2821ea23b7c269a32fd63be43a2a0bb9 (patch)
tree3058361b91790c6e33afddcfe9c472f3d8a5b287 /builtin/cat-file.c
parent211c61c6cf56699fc7b520a0206d23f5e4a7261b (diff)
downloadgit-166df26f2821ea23b7c269a32fd63be43a2a0bb9.zip
git-166df26f2821ea23b7c269a32fd63be43a2a0bb9.tar.gz
git-166df26f2821ea23b7c269a32fd63be43a2a0bb9.tar.bz2
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>
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r--builtin/cat-file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 54db118..13ed944 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -131,7 +131,7 @@ struct expand_data {
unsigned char sha1[20];
enum object_type type;
unsigned long size;
- unsigned long disk_size;
+ off_t disk_size;
const char *rest;
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)
data->info.disk_sizep = &data->disk_size;
else
- strbuf_addf(sb, "%lu", data->disk_size);
+ strbuf_addf(sb, "%"PRIuMAX, (uintmax_t)data->disk_size);
} else if (is_atom("rest", atom, len)) {
if (data->mark_query)
data->split_on_whitespace = 1;