filestamp: use `uint64_t` for object size Instead of using a signed type (`off_t`) use an unsigned `uint64_t` for the size of the files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/futils.c b/src/futils.c
index c508c74..7e100a9 100644
--- a/src/futils.c
+++ b/src/futils.c
@@ -1110,7 +1110,7 @@ int git_futils_filestamp_check(
#if defined(GIT_USE_NSEC)
stamp->mtime.tv_nsec == st.st_mtime_nsec &&
#endif
- stamp->size == (git_off_t)st.st_size &&
+ stamp->size == (uint64_t)st.st_size &&
stamp->ino == (unsigned int)st.st_ino)
return 0;
@@ -1118,7 +1118,7 @@ int git_futils_filestamp_check(
#if defined(GIT_USE_NSEC)
stamp->mtime.tv_nsec = st.st_mtime_nsec;
#endif
- stamp->size = (git_off_t)st.st_size;
+ stamp->size = (uint64_t)st.st_size;
stamp->ino = (unsigned int)st.st_ino;
return 1;
@@ -1146,7 +1146,7 @@ void git_futils_filestamp_set_from_stat(
#else
stamp->mtime.tv_nsec = 0;
#endif
- stamp->size = (git_off_t)st->st_size;
+ stamp->size = (uint64_t)st->st_size;
stamp->ino = (unsigned int)st->st_ino;
} else {
memset(stamp, 0, sizeof(*stamp));
diff --git a/src/futils.h b/src/futils.h
index e6fd22b..f97b156 100644
--- a/src/futils.h
+++ b/src/futils.h
@@ -330,7 +330,7 @@ extern int git_futils_fake_symlink(const char *new, const char *old);
*/
typedef struct {
struct timespec mtime;
- git_off_t size;
+ uint64_t size;
unsigned int ino;
} git_futils_filestamp;