read-cache: use fixed width integer types
Use the fixed width integer types uint16_t and uint32_t for on-disk structures; unsigned short and unsigned int do not have a guaranteed size. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Gummerer committed
Aug 18, 2013 at 21:41 UTC
7800c1ebcc12a7b667a2c76de109a85d272051a0
2 files changed
+20
-20
cache.h
+5
-5
@@ -101,9 +101,9 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
101
102
#define CACHE_SIGNATURE 0x44495243 /* "DIRC" */
103
struct cache_header {
104
- unsigned int hdr_signature;
105
- unsigned int hdr_version;
106
- unsigned int hdr_entries;
104
+ uint32_t hdr_signature;
105
+ uint32_t hdr_version;
106
+ uint32_t hdr_entries;
107
};
108
109
#define INDEX_FORMAT_LB 2
@@ -115,8 +115,8 @@ struct cache_header {
115
* check it for equality in the 32 bits we save.
116
*/
117
struct cache_time {
118
- unsigned int sec;
119
- unsigned int nsec;
118
+ uint32_t sec;
119
+ uint32_t nsec;
120
};
121
122
struct stat_data {
read-cache.c
+15
-15
@@ -1229,14 +1229,14 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall
1229
struct ondisk_cache_entry {
1230
struct cache_time ctime;
1231
struct cache_time mtime;
1232
- unsigned int dev;
1233
- unsigned int ino;
1234
- unsigned int mode;
1235
- unsigned int uid;
1236
- unsigned int gid;
1237
- unsigned int size;
1232
+ uint32_t dev;
1233
+ uint32_t ino;
1234
+ uint32_t mode;
1235
+ uint32_t uid;
1236
+ uint32_t gid;
1237
+ uint32_t size;
1238
unsigned char sha1[20];
1239
- unsigned short flags;
1239
+ uint16_t flags;
1240
char name[FLEX_ARRAY]; /* more */
1241
};
1242
@@ -1248,15 +1248,15 @@ struct ondisk_cache_entry {
1248
struct ondisk_cache_entry_extended {
1249
struct cache_time ctime;
1250
struct cache_time mtime;
1251
- unsigned int dev;
1252
- unsigned int ino;
1253
- unsigned int mode;
1254
- unsigned int uid;
1255
- unsigned int gid;
1256
- unsigned int size;
1251
+ uint32_t dev;
1252
+ uint32_t ino;
1253
+ uint32_t mode;
1254
+ uint32_t uid;
1255
+ uint32_t gid;
1256
+ uint32_t size;
1257
unsigned char sha1[20];
1258
- unsigned short flags;
1259
- unsigned short flags2;
1258
+ uint16_t flags;
1259
+ uint16_t flags2;
1260
char name[FLEX_ARRAY]; /* more */
1261
};
1262