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>
This commit is contained in:
Thomas Gummerer 2013-08-18 21:41:51 +02:00 committed by Junio C Hamano
parent 4d06473928
commit 7800c1ebcc
2 changed files with 20 additions and 20 deletions

10
cache.h
View File

@ -101,9 +101,9 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
#define CACHE_SIGNATURE 0x44495243 /* "DIRC" */ #define CACHE_SIGNATURE 0x44495243 /* "DIRC" */
struct cache_header { struct cache_header {
unsigned int hdr_signature; uint32_t hdr_signature;
unsigned int hdr_version; uint32_t hdr_version;
unsigned int hdr_entries; uint32_t hdr_entries;
}; };
#define INDEX_FORMAT_LB 2 #define INDEX_FORMAT_LB 2
@ -115,8 +115,8 @@ struct cache_header {
* check it for equality in the 32 bits we save. * check it for equality in the 32 bits we save.
*/ */
struct cache_time { struct cache_time {
unsigned int sec; uint32_t sec;
unsigned int nsec; uint32_t nsec;
}; };
struct stat_data { struct stat_data {

View File

@ -1229,14 +1229,14 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall
struct ondisk_cache_entry { struct ondisk_cache_entry {
struct cache_time ctime; struct cache_time ctime;
struct cache_time mtime; struct cache_time mtime;
unsigned int dev; uint32_t dev;
unsigned int ino; uint32_t ino;
unsigned int mode; uint32_t mode;
unsigned int uid; uint32_t uid;
unsigned int gid; uint32_t gid;
unsigned int size; uint32_t size;
unsigned char sha1[20]; unsigned char sha1[20];
unsigned short flags; uint16_t flags;
char name[FLEX_ARRAY]; /* more */ char name[FLEX_ARRAY]; /* more */
}; };
@ -1248,15 +1248,15 @@ struct ondisk_cache_entry {
struct ondisk_cache_entry_extended { struct ondisk_cache_entry_extended {
struct cache_time ctime; struct cache_time ctime;
struct cache_time mtime; struct cache_time mtime;
unsigned int dev; uint32_t dev;
unsigned int ino; uint32_t ino;
unsigned int mode; uint32_t mode;
unsigned int uid; uint32_t uid;
unsigned int gid; uint32_t gid;
unsigned int size; uint32_t size;
unsigned char sha1[20]; unsigned char sha1[20];
unsigned short flags; uint16_t flags;
unsigned short flags2; uint16_t flags2;
char name[FLEX_ARRAY]; /* more */ char name[FLEX_ARRAY]; /* more */
}; };