Re: [PATCH v3 02/24] read-cache: use fixed width integer types

2013-08-20 Thread Thomas Gummerer
Junio C Hamano  writes:

> Thomas Gummerer  writes:
>
>> Use the fixed width integer types uint16_t and uint32_t for ondisk
>> structures, because unsigned short and unsigned int do not hae a
>> guaranteed size.
>
> This sounds like an independent fix to me.  I'd queue this early
> independent from the rest of the series.
>
> Thanks.

Sounds good to me.  Thanks.

>>
>> Signed-off-by: Thomas Gummerer 
>> ---
>>  cache.h  | 10 +-
>>  read-cache.c | 30 +++---
>>  2 files changed, 20 insertions(+), 20 deletions(-)
>>
>> diff --git a/cache.h b/cache.h
>> index bd6fb9f..9ef778a 100644
>> --- a/cache.h
>> +++ b/cache.h
>> @@ -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
>> @@ -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 {
>> diff --git a/read-cache.c b/read-cache.c
>> index ceaf207..0df5b31 100644
>> --- a/read-cache.c
>> +++ b/read-cache.c
>> @@ -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 */
>>  };
>>  
>> @@ -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 */
>>  };
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 02/24] read-cache: use fixed width integer types

2013-08-20 Thread Junio C Hamano
Thomas Gummerer  writes:

> Use the fixed width integer types uint16_t and uint32_t for ondisk
> structures, because unsigned short and unsigned int do not hae a
> guaranteed size.

This sounds like an independent fix to me.  I'd queue this early
independent from the rest of the series.

Thanks.

>
> Signed-off-by: Thomas Gummerer 
> ---
>  cache.h  | 10 +-
>  read-cache.c | 30 +++---
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/cache.h b/cache.h
> index bd6fb9f..9ef778a 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -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
> @@ -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 {
> diff --git a/read-cache.c b/read-cache.c
> index ceaf207..0df5b31 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -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 */
>  };
>  
> @@ -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 */
>  };
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 02/24] read-cache: use fixed width integer types

2013-08-18 Thread Eric Sunshine
On Sun, Aug 18, 2013 at 3:41 PM, Thomas Gummerer  wrote:
> Use the fixed width integer types uint16_t and uint32_t for ondisk
> structures, because unsigned short and unsigned int do not hae a

s/hae/have/

> guaranteed size.
>
> Signed-off-by: Thomas Gummerer 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html