Use fixed-size integers for the on-disk pack structure.
Plain integer types without a fixed size can vary between platforms. Even though all common platforms use 32-bit ints, there is no guarantee that this won't change at some point. Furthermore, specifying an integer type with explicit size makes the definition of structures more obvious. Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Simon 'corecode' Schubert committed
Jan 17, 2007 at 09:07 UTC
bb7910319412aea9fecc3625dfcae23da84ee5f1
2 files changed
+4
-3
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
#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
51
#include <grp.h>
52
#define _ALL_SOURCE 1
pack.h
+3
-3
@@ -10,9 +10,9 @@
10
#define PACK_VERSION 2
11
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
12
struct pack_header {
13
- unsigned int hdr_signature;
14
- unsigned int hdr_version;
15
- unsigned int hdr_entries;
13
+ uint32_t hdr_signature;
14
+ uint32_t hdr_version;
15
+ uint32_t hdr_entries;
16
};
17
18
/*