8000 Move `git_off_t` to `git_object_size_t` by ethomson · Pull Request #5123 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Move git_off_t to git_object_size_t #5123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
ethomson committed Nov 22, 2019
commit 6c13cf6dacf5f5f2f5ba4f28b3632f3f9df29b7c
6 changes: 3 additions & 3 deletions src/futils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,15 +1110,15 @@ 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;

stamp->mtime.tv_sec = st.st_mtime;
#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;
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/futils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
0