From c4001d92be61766d3494489b15590ca0147ee19d Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 6 Mar 2007 20:44:30 -0500 Subject: Use off_t when we really mean a file offset. Not all platforms have declared 'unsigned long' to be a 64 bit value, but we want to support a 64 bit packfile (or close enough anyway) in the near future as some projects are getting large enough that their packed size exceeds 4 GiB. By using off_t, the POSIX type that is declared to mean an offset within a file, we support whatever maximum file size the underlying operating system will handle. For most modern systems this is up around 2^60 or higher. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- pack-redundant.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pack-redundant.c') diff --git a/pack-redundant.c b/pack-redundant.c index edb5524fc..c8f7d9af7 100644 --- a/pack-redundant.c +++ b/pack-redundant.c @@ -396,9 +396,9 @@ static size_t get_pack_redundancy(struct pack_list *pl) return ret; } -static inline size_t pack_set_bytecount(struct pack_list *pl) +static inline off_t pack_set_bytecount(struct pack_list *pl) { - size_t ret = 0; + off_t ret = 0; while (pl) { ret += pl->pack->pack_size; ret += pl->pack->index_size; @@ -413,7 +413,7 @@ static void minimize(struct pack_list **min) *non_unique = NULL, *min_perm = NULL; struct pll *perm, *perm_all, *perm_ok = NULL, *new_perm; struct llist *missing; - size_t min_perm_size = (size_t)-1, perm_size; + off_t min_perm_size = 0, perm_size; int n; pl = local_packs; @@ -461,7 +461,7 @@ static void minimize(struct pack_list **min) perm = perm_ok; while (perm) { perm_size = pack_set_bytecount(perm->pl); - if (min_perm_size > perm_size) { + if (!min_perm_size || min_perm_size > perm_size) { min_perm_size = perm_size; min_perm = perm->pl; } -- cgit v1.2.1