summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-18 11:30:17 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-18 11:30:17 -0500
commitebea9dd4f1b62cb3c8302f10aaca3af0231e9818 (patch)
treed40420caaccc4575c5810c3498fa43a55849b4f5
parentAlways use struct pack_header for pack header in fast-import. (diff)
downloadtgif-ebea9dd4f1b62cb3c8302f10aaca3af0231e9818.tar.xz
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>
-rw-r--r--fast-import.c4
-rw-r--r--git-compat-util.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/fast-import.c b/fast-import.c
index fb7d912eff..7f519b4de3 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -672,7 +672,7 @@ static char* create_index(void)
struct sha1file *f;
struct object_entry **idx, **c, **last, *e;
struct object_entry_pool *o;
- unsigned int array[256];
+ uint32_t array[256];
int i, idx_fd;
/* Build the sorted table of object IDs. */
@@ -709,7 +709,7 @@ static char* create_index(void)
sha1write(f, array, 256 * sizeof(int));
SHA1_Init(&ctx);
for (c = idx; c != last; c++) {
- unsigned int offset = htonl((*c)->offset);
+ uint32_t offset = htonl((*c)->offset);
sha1write(f, &offset, 4);
sha1write(f, (*c)->sha1, sizeof((*c)->sha1));
SHA1_Update(&ctx, (*c)->sha1, 20);
diff --git a/git-compat-util.h b/git-compat-util.h
index 614583e56a..ac06963e8d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -46,6 +46,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <pwd.h>
+#include <stdint.h>
#include <grp.h>
#ifndef NO_ICONV