Skip to content

Commit b0d974d

Browse files
committed
Merge branch 'tg/index-struct-sizes'
The code that reads from a region that mmaps an on-disk index assumed that "int"/"short" are always 32/16 bits. * tg/index-struct-sizes: read-cache: use fixed width integer types
2 parents 20419de + 7800c1e commit b0d974d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

cache.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
101101

102102
#define CACHE_SIGNATURE 0x44495243 /* "DIRC" */
103103
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;
107107
};
108108

109109
#define INDEX_FORMAT_LB 2
@@ -115,8 +115,8 @@ struct cache_header {
115115
* check it for equality in the 32 bits we save.
116116
*/
117117
struct cache_time {
118-
unsigned int sec;
119-
unsigned int nsec;
118+
uint32_t sec;
119+
uint32_t nsec;
120120
};
121121

122122
struct stat_data {

read-cache.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,14 +1230,14 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall
12301230
struct ondisk_cache_entry {
12311231
struct cache_time ctime;
12321232
struct cache_time mtime;
1233-
unsigned int dev;
1234-
unsigned int ino;
1235-
unsigned int mode;
1236-
unsigned int uid;
1237-
unsigned int gid;
1238-
unsigned int size;
1233+
uint32_t dev;
1234+
uint32_t ino;
1235+
uint32_t mode;
1236+
uint32_t uid;
1237+
uint32_t gid;
1238+
uint32_t size;
12391239
unsigned char sha1[20];
1240-
unsigned short flags;
1240+
uint16_t flags;
12411241
char name[FLEX_ARRAY]; /* more */
12421242
};
12431243

@@ -1249,15 +1249,15 @@ struct ondisk_cache_entry {
12491249
struct ondisk_cache_entry_extended {
12501250
struct cache_time ctime;
12511251
struct cache_time mtime;
1252-
unsigned int dev;
1253-
unsigned int ino;
1254-
unsigned int mode;
1255-
unsigned int uid;
1256-
unsigned int gid;
1257-
unsigned int size;
1252+
uint32_t dev;
1253+
uint32_t ino;
1254+
uint32_t mode;
1255+
uint32_t uid;
1256+
uint32_t gid;
1257+
uint32_t size;
12581258
unsigned char sha1[20];
1259-
unsigned short flags;
1260-
unsigned short flags2;
1259+
uint16_t flags;
1260+
uint16_t flags2;
12611261
char name[FLEX_ARRAY]; /* more */
12621262
};
12631263

0 commit comments

Comments
 (0)