@matheusbsbs / matheus-bagliano / commits / 1b9bc5a7b7
Fork 0

Fix pack-index issue on 64-bit platforms a bit more portably.

Apparently <stdint.h> is not enough for uint32_t on OpenBSD; use "unsigned int" -- hopefully that would stay 32-bit on every platform we care about, at least until we update the pack-index file format. Our sha1 routines optimized for architectures use uint32_t and expects '#include <stdint.h>' to be enough, so OpenBSD on arm or ppc might have similar issues down the road, I dunno. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed May 15, 2006 at 12:52 UTC 1b9bc5a7b7434d771726011613a00cb202bd9f44
2 files changed +2 -4
pack-objects.c
+1 -2
@@ -10,7 +10,6 @@
10 #include "tree-walk.h"
11 #include <sys/time.h>
12 #include <signal.h>
13 -#include <stdint.h>
13
14 static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list";
15
@@ -157,7 +156,7 @@ static void prepare_pack_revindex(struct pack_revindex *rix)
156
157 rix->revindex = xmalloc(sizeof(unsigned long) * (num_ent + 1));
158 for (i = 0; i < num_ent; i++) {
160 - uint32_t hl = *((uint32_t *)(index + 24 * i));
159 + unsigned int hl = *((unsigned int *)(index + 24 * i));
160 rix->revindex[i] = ntohl(hl);
161 }
162 /* This knows the pack format -- the 20-byte trailer
sha1_file.c
+1 -2
@@ -13,7 +13,6 @@
13 #include "commit.h"
14 #include "tag.h"
15 #include "tree.h"
16 -#include <stdint.h>
16
17 #ifndef O_NOATIME
18 #if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -1127,7 +1126,7 @@ int find_pack_entry_one(const unsigned char *sha1,
1126 int mi = (lo + hi) / 2;
1127 int cmp = memcmp(index + 24 * mi + 4, sha1, 20);
1128 if (!cmp) {
1130 - e->offset = ntohl(*((uint32_t *)(index + 24 * mi)));
1129 + e->offset = ntohl(*((unsigned int *)(index + 24 * mi)));
1130 memcpy(e->sha1, sha1, 20);
1131 e->p = p;
1132 return 1;