Upcast size_t variables to uintmax_t when printing

When printing variables which contain a size, today "unsigned long"
is used at many places.
In order to be able to change the type from "unsigned long" into size_t
some day in the future, we need to have a way to print 64 bit variables
on a system that has "unsigned long" defined to be 32 bit, like Win64.

Upcast all those variables into uintmax_t before they are printed.
This is to prepare for a bigger change, when "unsigned long"
will be converted into size_t for variables which may be > 4Gib.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Torsten Bögershausen
2018-11-11 08:05:04 +01:00
committed by Junio C Hamano
parent 8858448bb4
commit ca473cef91
11 changed files with 24 additions and 23 deletions

View File

@ -2095,9 +2095,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
die(_("object %s cannot be read"),
oid_to_hex(&trg_entry->idx.oid));
if (sz != trg_size)
die(_("object %s inconsistent object length (%lu vs %lu)"),
oid_to_hex(&trg_entry->idx.oid), sz,
trg_size);
die(_("object %s inconsistent object length (%"PRIuMAX" vs %"PRIuMAX")"),
oid_to_hex(&trg_entry->idx.oid), (uintmax_t)sz,
(uintmax_t)trg_size);
*mem_usage += sz;
}
if (!src->data) {
@ -2122,9 +2122,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
oid_to_hex(&src_entry->idx.oid));
}
if (sz != src_size)
die(_("object %s inconsistent object length (%lu vs %lu)"),
oid_to_hex(&src_entry->idx.oid), sz,
src_size);
die(_("object %s inconsistent object length (%"PRIuMAX" vs %"PRIuMAX")"),
oid_to_hex(&src_entry->idx.oid), (uintmax_t)sz,
(uintmax_t)src_size);
*mem_usage += sz;
}
if (!src->index) {