Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
90d4d2f0
Commit
90d4d2f0
authored
Jan 11, 2010
by
Ramsay Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: Use an 64-bit file offset type
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
a1c0728d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
6 deletions
+29
-6
src/common.h
+18
-0
src/fileops.c
+9
-3
src/fileops.h
+0
-1
src/win32/map.c
+2
-2
No files found.
src/common.h
View file @
90d4d2f0
...
...
@@ -25,6 +25,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef GIT_WIN32
...
...
@@ -51,6 +52,23 @@ typedef SSIZE_T ssize_t;
# define R_OK 4
/* read mode check */
# endif
#if defined(__MINGW32__)
# define off_t off64_t
# define lseek _lseeki64
# define stat _stati64
# define fstat _fstati64
#elif defined(_MSC_VER)
typedef
__int64
off64_t
;
# define off_t off64_t
# define lseek _lseeki64
# define stat _stat64
# define fstat _fstat64
#endif
#else
# include <unistd.h>
...
...
src/fileops.c
View file @
90d4d2f0
...
...
@@ -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
;
}
...
...
src/fileops.h
View file @
90d4d2f0
...
...
@@ -9,7 +9,6 @@
#include "common.h"
#include "map.h"
#include "dir.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
...
...
src/win32/map.c
View file @
90d4d2f0
...
...
@@ -77,9 +77,9 @@ int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, off_t offse
return
GIT_ERROR
;
}
assert
(
sizeof
(
off_t
)
==
8
);
off_low
=
(
DWORD
)(
page_start
);
if
(
sizeof
(
off_t
)
>
4
)
off_hi
=
(
DWORD
)(
page_start
>>
32
);
off_hi
=
(
DWORD
)(
page_start
>>
32
);
out
->
data
=
MapViewOfFile
(
out
->
fmh
,
view_prot
,
off_hi
,
off_low
,
len
);
if
(
!
out
->
data
)
{
/* errno = ? */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment