Skip to content

Commit

Permalink
Merge branch 'tg/index-struct-sizes'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Sep 9, 2013
2 parents 20419de + 7800c1e commit b0d974d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);

#define CACHE_SIGNATURE 0x44495243 /* "DIRC" */
struct cache_header {
unsigned int hdr_signature;
unsigned int hdr_version;
unsigned int hdr_entries;
uint32_t hdr_signature;
uint32_t hdr_version;
uint32_t hdr_entries;
};

#define INDEX_FORMAT_LB 2
Expand All @@ -115,8 +115,8 @@ struct cache_header {
* check it for equality in the 32 bits we save.
*/
struct cache_time {
unsigned int sec;
unsigned int nsec;
uint32_t sec;
uint32_t nsec;
};

struct stat_data {
Expand Down
30 changes: 15 additions & 15 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,14 +1230,14 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall
struct ondisk_cache_entry {
struct cache_time ctime;
struct cache_time mtime;
unsigned int dev;
unsigned int ino;
unsigned int mode;
unsigned int uid;
unsigned int gid;
unsigned int size;
uint32_t dev;
uint32_t ino;
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint32_t size;
unsigned char sha1[20];
unsigned short flags;
uint16_t flags;
char name[FLEX_ARRAY]; /* more */
};

Expand All @@ -1249,15 +1249,15 @@ struct ondisk_cache_entry {
struct ondisk_cache_entry_extended {
struct cache_time ctime;
struct cache_time mtime;
unsigned int dev;
unsigned int ino;
unsigned int mode;
unsigned int uid;
unsigned int gid;
unsigned int size;
uint32_t dev;
uint32_t ino;
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint32_t size;
unsigned char sha1[20];
unsigned short flags;
unsigned short flags2;
uint16_t flags;
uint16_t flags2;
char name[FLEX_ARRAY]; /* more */
};

Expand Down

0 comments on commit b0d974d

Please sign in to comment.