Commit 63ad4394 by Vicent Martí

Merge pull request #253 from sschuberth/msvc10-fixes

Msvc10 fixes
parents e3f56a2b e6480970
...@@ -603,7 +603,7 @@ int gitfo_getcwd(char *buffer_out, size_t size) ...@@ -603,7 +603,7 @@ int gitfo_getcwd(char *buffer_out, size_t size)
} }
#ifdef GIT_WIN32 #ifdef GIT_WIN32
static inline time_t filetime_to_time_t(const FILETIME *ft) GIT_INLINE(time_t) filetime_to_time_t(const FILETIME *ft)
{ {
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime; long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */ winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
...@@ -627,7 +627,7 @@ static int do_lstat(const char *file_name, struct stat *buf) ...@@ -627,7 +627,7 @@ static int do_lstat(const char *file_name, struct stat *buf)
fMode |= S_IWRITE; fMode |= S_IWRITE;
if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
fMode |= _S_IFLNK; fMode |= S_IFLNK;
buf->st_ino = 0; buf->st_ino = 0;
buf->st_gid = 0; buf->st_gid = 0;
......
...@@ -98,6 +98,9 @@ extern int gitfo_mv_force(const char *from, const char *to); ...@@ -98,6 +98,9 @@ extern int gitfo_mv_force(const char *from, const char *to);
#ifdef GIT_WIN32 #ifdef GIT_WIN32
# define gitfo_lstat(p,b) gitfo_lstat__w32(p,b) # define gitfo_lstat(p,b) gitfo_lstat__w32(p,b)
# define gitfo_readlink(a, b, c) gitfo_readlink__w32(a, b, c) # define gitfo_readlink(a, b, c) gitfo_readlink__w32(a, b, c)
extern int gitfo_lstat__w32(const char *file_name, struct stat *buf);
extern int gitfo_readlink__w32(const char *link, char *target, size_t target_len);
#else #else
# define gitfo_lstat(p,b) lstat(p,b) # define gitfo_lstat(p,b) lstat(p,b)
# define gitfo_readlink(a, b, c) readlink(a, b, c) # define gitfo_readlink(a, b, c) readlink(a, b, c)
......
...@@ -142,8 +142,8 @@ unsigned int index_create_mode(unsigned int mode) ...@@ -142,8 +142,8 @@ unsigned int index_create_mode(unsigned int mode)
{ {
if (S_ISLNK(mode)) if (S_ISLNK(mode))
return S_IFLNK; return S_IFLNK;
if (S_ISDIR(mode) || (mode & S_IFMT) == 0160000) if (S_ISDIR(mode) || (mode & S_IFMT) == (S_IFLNK | S_IFDIR))
return 0160000; return (S_IFLNK | S_IFDIR);
return S_IFREG | ((mode & 0100) ? 0755 : 0644); return S_IFREG | ((mode & 0100) ? 0755 : 0644);
} }
......
...@@ -12,14 +12,17 @@ ...@@ -12,14 +12,17 @@
# define stat _stat64 # define stat _stat64
# define fstat _fstat64 # define fstat _fstat64
#define _S_IFLNK 0120000
/* stat: file mode type testing macros */ /* stat: file mode type testing macros */
# define _S_IFLNK 0120000
# define S_IFLNK _S_IFLNK
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) # define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) # define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
# define MAXPATHLEN MAX_PATH
/* case-insensitive string comparison */ /* case-insensitive string comparison */
# define strcasecmp _stricmp # define strcasecmp _stricmp
# define strncasecmp _strnicmp # define strncasecmp _strnicmp
......
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