@matheusbsbs / matheus-bagliano / commits / ebea9dd4f1
Fork 0

Use fixed-size integers when writing out the index in fast-import.

Currently the pack .idx file format uses 32-bit unsigned integers for the fan-out table and the object offsets. We had previously defined these as 'unsigned int', but not every system will define that type to be a 32 bit value. To ensure maximum portability we should always use 'uint32_t'. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 18, 2007 at 11:30 UTC ebea9dd4f1b62cb3c8302f10aaca3af0231e9818
2 files changed +3 -2
fast-import.c
+2 -2
@@ -672,7 +672,7 @@ static char* create_index(void)
672 struct sha1file *f;
673 struct object_entry **idx, **c, **last, *e;
674 struct object_entry_pool *o;
675 - unsigned int array[256];
675 + uint32_t array[256];
676 int i, idx_fd;
677
678 /* Build the sorted table of object IDs. */
@@ -709,7 +709,7 @@ static char* create_index(void)
709 sha1write(f, array, 256 * sizeof(int));
710 SHA1_Init(&ctx);
711 for (c = idx; c != last; c++) {
712 - unsigned int offset = htonl((*c)->offset);
712 + uint32_t offset = htonl((*c)->offset);
713 sha1write(f, &offset, 4);
714 sha1write(f, (*c)->sha1, sizeof((*c)->sha1));
715 SHA1_Update(&ctx, (*c)->sha1, 20);
git-compat-util.h
+1
@@ -46,6 +46,7 @@
46 #include <arpa/inet.h>
47 #include <netdb.h>
48 #include <pwd.h>
49 +#include <stdint.h>
50 #include <grp.h>
51
52 #ifndef NO_ICONV