diff options
| author | Ramsay Jones <ramsay@ramsay1.demon.co.uk> | 2010-01-11 19:27:50 +0000 |
|---|---|---|
| committer | Ramsay Jones <ramsay@ramsay1.demon.co.uk> | 2010-01-20 20:15:57 +0000 |
| commit | 90d4d2f0fc362beabbbf76b4ffda0828229c198d (patch) | |
| tree | 0f6d2f4cd1a1391a98c6a89e2ee6a69c0afc0c9d /src/fileops.c | |
| parent | a1c0728d12b170e1e643f219fab53b03cd4e1b09 (diff) | |
| download | libgit2-90d4d2f0fc362beabbbf76b4ffda0828229c198d.tar.gz | |
win32: Use an 64-bit file offset type
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Diffstat (limited to 'src/fileops.c')
| -rw-r--r-- | src/fileops.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/fileops.c b/src/fileops.c index 5de89cbd8..b2dea1ed6 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -69,7 +69,8 @@ off_t gitfo_size(git_file fd) int gitfo_read_file(gitfo_buf *obj, const char *path) { git_file fd; - off_t len; + size_t len; + off_t size; unsigned char *buff; assert(obj && path && *path); @@ -77,8 +78,13 @@ int gitfo_read_file(gitfo_buf *obj, const char *path) if ((fd = gitfo_open(path, O_RDONLY)) < 0) return GIT_ERROR; - if (((len = gitfo_size(fd)) < 0) - || ((buff = git__malloc(len + 1)) == NULL)) { + if (((size = gitfo_size(fd)) < 0) || !git__is_sizet(size+1)) { + gitfo_close(fd); + return GIT_ERROR; + } + len = (size_t) size; + + if ((buff = git__malloc(len + 1)) == NULL) { gitfo_close(fd); return GIT_ERROR; } |
