summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-12-06 23:13:00 +0200
committerVicent Marti <tanoku@gmail.com>2010-12-06 23:36:21 +0200
commita44fc1d413bc1e2f0ed82aff60ce2069c33d2eda (patch)
tree115f8e574fe27959e5311819b8d72d4ea41cd941 /src/index.c
parentf591833095ad9a3bbff42c76531131f7ec6a2954 (diff)
downloadlibgit2-a44fc1d413bc1e2f0ed82aff60ce2069c33d2eda.tar.gz
Fix type-conversion warnings
The types in the git_index_entry struct are now system-defaults, and get truncated to uint32_t's when written back on the index. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/index.c b/src/index.c
index 3c2bbf8cf..6fdb46e18 100644
--- a/src/index.c
+++ b/src/index.c
@@ -61,9 +61,14 @@ struct index_extension {
uint32_t extension_size;
};
+struct entry_time {
+ uint32_t seconds;
+ uint32_t nanoseconds;
+};
+
struct entry_short {
- git_index_time ctime;
- git_index_time mtime;
+ struct entry_time ctime;
+ struct entry_time mtime;
uint32_t dev;
uint32_t ino;
uint32_t mode;
@@ -76,8 +81,8 @@ struct entry_short {
};
struct entry_long {
- git_index_time ctime;
- git_index_time mtime;
+ struct entry_time ctime;
+ struct entry_time mtime;
uint32_t dev;
uint32_t ino;
uint32_t mode;
@@ -497,10 +502,10 @@ static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffe
source = (const struct entry_short *)(buffer);
- dest->ctime.seconds = ntohl(source->ctime.seconds);
- dest->ctime.nanoseconds = ntohl(source->ctime.nanoseconds);
- dest->mtime.seconds = ntohl(source->mtime.seconds);
- dest->mtime.nanoseconds = ntohl(source->mtime.nanoseconds);
+ dest->ctime.seconds = (time_t)ntohl(source->ctime.seconds);
+ dest->ctime.nanoseconds = (time_t)ntohl(source->ctime.nanoseconds);
+ dest->mtime.seconds = (time_t)ntohl(source->mtime.seconds);
+ dest->mtime.nanoseconds = (time_t)ntohl(source->mtime.nanoseconds);
dest->dev = ntohl(source->dev);
dest->ino = ntohl(source->ino);
dest->mode = ntohl(source->mode);
@@ -692,7 +697,7 @@ int git_index__write(git_index *index, git_filelock *file)
return GIT_ENOMEM;
#define WRITE_WORD(_word) {\
- uint32_t network_word = htonl((_word));\
+ uint32_t network_word = htonl(((uint32_t)(_word)));\
git_filelock_write(file, &network_word, 4);\
git_hash_update(digest, &network_word, 4);\
}