Commit 8be12026 by Edward Thomson

mmap: use a 64-bit signed type `off64_t` for mmap

Prefer `off64_t` to `git_off_t` for internal visibility.
parent 7e1cc296
......@@ -307,7 +307,7 @@ int git_futils_mv_withpath(const char *from, const char *to, const mode_t dirmod
return 0;
}
int git_futils_mmap_ro(git_map *out, git_file fd, git_off_t begin, size_t len)
int git_futils_mmap_ro(git_map *out, git_file fd, off64_t begin, size_t len)
{
return p_mmap(out, len, GIT_PROT_READ, GIT_MAP_SHARED, fd, begin);
}
......
......@@ -290,7 +290,7 @@ extern mode_t git_futils_canonical_mode(mode_t raw_mode);
extern int git_futils_mmap_ro(
git_map *out,
git_file fd,
git_off_t begin,
off64_t begin,
size_t len);
/**
......
......@@ -40,7 +40,7 @@ typedef struct { /* memory mapped buffer */
assert((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
assert((flags & GIT_MAP_FIXED) == 0); } while (0)
extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset);
extern int p_munmap(git_map *map);
#endif
......@@ -235,7 +235,7 @@ int git__mmap_alignment(size_t *alignment)
}
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset)
{
GIT_MMAP_VALIDATE(out, len, prot, flags);
......
......@@ -89,6 +89,18 @@
#define EAFNOSUPPORT (INT_MAX-1)
#endif
/* Provide a 64-bit size for offsets. */
#if defined(_MSC_VER)
typedef __int64 off64_t;
#elif defined(__HAIKU__)
typedef __haiku_std_int64 off64_t;
#elif defined(__APPLE__)
typedef __int64_t off64_t;
#else
typedef int64_t off64_t;
#endif
typedef int git_file;
/**
......
......@@ -50,7 +50,7 @@ int git__mmap_alignment(size_t *page_size)
return 0;
}
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset)
{
HANDLE fh = (HANDLE)_get_osfhandle(fd);
DWORD alignment = get_allocation_granularity();
......@@ -58,8 +58,8 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
DWORD view_prot = 0;
DWORD off_low = 0;
DWORD off_hi = 0;
git_off_t page_start;
git_off_t page_offset;
off64_t page_start;
off64_t page_offset;
GIT_MMAP_VALIDATE(out, len, prot, flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment