summaryrefslogtreecommitdiff
path: root/pack-check.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-03-06 20:44:19 -0500
committerJunio C Hamano <junkio@cox.net>2007-03-07 11:02:33 -0800
commit326bf396778bc9ab8f9e253bb514e7f41ef1502b (patch)
tree41a09c2642dbd03db6b6b6cf3394e048b7661800 /pack-check.c
parent3a55602eeca4ac8670e8698a7187e18b95683344 (diff)
downloadgit-326bf396778bc9ab8f9e253bb514e7f41ef1502b.tar.gz
Use uint32_t for all packed object counts.
As we permit up to 2^32-1 objects in a single packfile we cannot use a signed int to represent the object offset within a packfile, after 2^31-1 objects we will start seeing negative indexes and error out or compute bad addresses within the mmap'd index. This is a minor cleanup that does not introduce any significant logic changes. It is roach free. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pack-check.c b/pack-check.c
index f248ac8c7a..7c82f6795e 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -9,7 +9,8 @@ static int verify_packfile(struct packed_git *p,
SHA_CTX ctx;
unsigned char sha1[20];
unsigned long offset = 0, pack_sig = p->pack_size - 20;
- int nr_objects, err, i;
+ uint32_t nr_objects, i;
+ int err;
/* Note that the pack header checks are actually performed by
* use_pack when it first opens the pack file. If anything
@@ -40,7 +41,7 @@ static int verify_packfile(struct packed_git *p,
* we do not do scan-streaming check on the pack file.
*/
nr_objects = num_packed_objects(p);
- for (i = err = 0; i < nr_objects; i++) {
+ for (i = 0, err = 0; i < nr_objects; i++) {
unsigned char sha1[20];
void *data;
enum object_type type;
@@ -74,8 +75,7 @@ static int verify_packfile(struct packed_git *p,
static void show_pack_info(struct packed_git *p)
{
- int nr_objects, i;
- unsigned int chain_histogram[MAX_CHAIN];
+ uint32_t nr_objects, i, chain_histogram[MAX_CHAIN];
nr_objects = num_packed_objects(p);
memset(chain_histogram, 0, sizeof(chain_histogram));