2009-09-16 08:20:25 +00:00
|
|
|
#ifndef __MSVC__HEAD
|
|
|
|
#define __MSVC__HEAD
|
|
|
|
|
|
|
|
#include <direct.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include <malloc.h>
|
2011-10-31 19:12:43 +00:00
|
|
|
#include <io.h>
|
2009-09-16 08:20:25 +00:00
|
|
|
|
|
|
|
/* porting function */
|
|
|
|
#define inline __inline
|
|
|
|
#define __inline__ __inline
|
|
|
|
#define __attribute__(x)
|
2009-09-16 08:20:27 +00:00
|
|
|
#define strncasecmp _strnicmp
|
|
|
|
#define ftruncate _chsize
|
msvc: test-svn-fe: Fix linker "unresolved external" error
In particular, while linking test-svn-fe.exe, the linker complains
that the external symbol _strtoull is unresolved. A call to this
function was added in commit ddcc8c5b ("vcs-svn: skeleton of an svn
delta parser", 25-12-2010).
The NO_STRTOULL build variable attempts to provide support to old
systems which can't even declare 'unsigned long long' variables,
let alone provide the strtoll() or strtoull() functions. Setting
this build variable does not provide an implementation of these
functions. Rather, it simply allows the compat implementations
of strto{i,u}max() to use strtol() and strtoul() instead.
In order to fix the linker error on systems with NO_STRTOULL set,
currently MSVC and OSF1, we can substitute a call to strtoumax().
However, we can easily provide support for the strtoull() and
strtoll() functions on MSVC, since they are essentially already
available as _strtoui64() and _strtoi64(). This allows us to
remove NO_STRTOULL for MSVC.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Tested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-31 18:32:55 +00:00
|
|
|
#define strtoull _strtoui64
|
|
|
|
#define strtoll _strtoi64
|
2009-09-16 08:20:25 +00:00
|
|
|
|
|
|
|
static __inline int strcasecmp (const char *s1, const char *s2)
|
|
|
|
{
|
|
|
|
int size1 = strlen(s1);
|
|
|
|
int sisz2 = strlen(s2);
|
|
|
|
return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef ERROR
|
2010-01-15 20:12:19 +00:00
|
|
|
|
|
|
|
/* Use mingw_lstat() instead of lstat()/stat() and mingw_fstat() instead
|
|
|
|
* of fstat(). We add the declaration of these functions here, suppressing
|
|
|
|
* the corresponding declarations in mingw.h, so that we can use the
|
|
|
|
* appropriate structure type (and function) names from the msvc headers.
|
|
|
|
*/
|
|
|
|
#define stat _stat64
|
|
|
|
int mingw_lstat(const char *file_name, struct stat *buf);
|
|
|
|
int mingw_fstat(int fd, struct stat *buf);
|
|
|
|
#define fstat mingw_fstat
|
|
|
|
#define lstat mingw_lstat
|
2009-09-16 08:20:25 +00:00
|
|
|
#define _stat64(x,y) mingw_lstat(x,y)
|
2010-01-15 20:12:19 +00:00
|
|
|
#define ALREADY_DECLARED_STAT_FUNCS
|
|
|
|
|
|
|
|
#include "compat/mingw.h"
|
|
|
|
|
|
|
|
#undef ALREADY_DECLARED_STAT_FUNCS
|
2009-09-16 08:20:25 +00:00
|
|
|
|
|
|
|
#endif
|