From: Joerg Sonnenberger Date: Wed, 24 Mar 2010 17:52:30 +0000 (-0400) Subject: Use unsigned int for the link count to be consistent with archive_entry. X-Git-Tag: v3.0.0a~1137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=210f1882dbbc7535ed04c7a44078b0d302276f65;p=thirdparty%2Flibarchive.git Use unsigned int for the link count to be consistent with archive_entry. Compute hashes and buckets using size_t. Be consistent in the sparse freeing. SVN-Revision: 2055 --- diff --git a/libarchive/archive_entry_link_resolver.c b/libarchive/archive_entry_link_resolver.c index 3311c8b4d..b5a7ddda9 100644 --- a/libarchive/archive_entry_link_resolver.c +++ b/libarchive/archive_entry_link_resolver.c @@ -70,10 +70,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 200 struct links_entry { struct links_entry *next; struct links_entry *previous; - int links; /* # links not yet seen */ - int hash; struct archive_entry *canonical; struct archive_entry *entry; + size_t hash; + unsigned int links; /* # links not yet seen */ }; struct archive_entry_linkresolver { @@ -251,7 +251,7 @@ find_entry(struct archive_entry_linkresolver *res, struct archive_entry *entry) { struct links_entry *le; - int hash, bucket; + size_t hash, bucket; dev_t dev; int64_t ino; @@ -265,7 +265,7 @@ find_entry(struct archive_entry_linkresolver *res, dev = archive_entry_dev(entry); ino = archive_entry_ino64(entry); - hash = (int)(dev ^ ino); + hash = (size_t)(dev ^ ino); /* Try to locate this entry in the links cache. */ bucket = hash & (res->number_buckets - 1); @@ -307,6 +307,7 @@ next_entry(struct archive_entry_linkresolver *res) /* Free a held entry. */ if (res->spare != NULL) { archive_entry_free(res->spare->canonical); + archive_entry_free(res->spare->entry); free(res->spare); res->spare = NULL; } @@ -333,7 +334,7 @@ insert_entry(struct archive_entry_linkresolver *res, struct archive_entry *entry) { struct links_entry *le; - int hash, bucket; + size_t hash, bucket; /* Add this entry to the links cache. */ le = calloc(sizeof(struct links_entry), 1);