mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-21 20:34:17 +00:00
Merge pull request #2466 from jacquesg/win2003-platform-sdk
Windows compatibility fixes
This commit is contained in:
commit
a6d7e16634
@ -13,6 +13,7 @@
|
|||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#else
|
#else
|
||||||
|
# include <winsock2.h>
|
||||||
# include <ws2tcpip.h>
|
# include <ws2tcpip.h>
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma comment(lib, "ws2_32")
|
# pragma comment(lib, "ws2_32")
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#ifndef INCLUDE_strlen_h__
|
#ifndef INCLUDE_strlen_h__
|
||||||
#define INCLUDE_strlen_h__
|
#define INCLUDE_strlen_h__
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__)
|
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__) ||\
|
||||||
|
(defined(_MSC_VER) && _MSC_VER < 1500)
|
||||||
# define NO_STRNLEN
|
# define NO_STRNLEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
10
src/trace.h
10
src/trace.h
@ -46,8 +46,16 @@ GIT_INLINE(void) git_trace__write_fmt(
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
GIT_INLINE(void) git_trace__null(
|
||||||
|
git_trace_level_t level,
|
||||||
|
const char *fmt, ...)
|
||||||
|
{
|
||||||
|
GIT_UNUSED(level);
|
||||||
|
GIT_UNUSED(fmt);
|
||||||
|
}
|
||||||
|
|
||||||
#define git_trace_level() ((void)0)
|
#define git_trace_level() ((void)0)
|
||||||
#define git_trace(lvl, ...) ((void)0)
|
#define git_trace git_trace__null
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -613,7 +613,8 @@ void git__qsort_r(
|
|||||||
defined(__OpenBSD__) || defined(__NetBSD__) || \
|
defined(__OpenBSD__) || defined(__NetBSD__) || \
|
||||||
defined(__gnu_hurd__) || defined(__ANDROID_API__) || \
|
defined(__gnu_hurd__) || defined(__ANDROID_API__) || \
|
||||||
defined(__sun) || defined(__CYGWIN__) || \
|
defined(__sun) || defined(__CYGWIN__) || \
|
||||||
(__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)
|
(__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) || \
|
||||||
|
(defined(_MSC_VER) && _MSC_VER < 1500)
|
||||||
git__insertsort_r(els, nel, elsize, NULL, cmp, payload);
|
git__insertsort_r(els, nel, elsize, NULL, cmp, payload);
|
||||||
#elif defined(GIT_WIN32)
|
#elif defined(GIT_WIN32)
|
||||||
git__qsort_r_glue glue = { cmp, payload };
|
git__qsort_r_glue glue = { cmp, payload };
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# define R_OK 4 /* read mode check */
|
# define R_OK 4 /* read mode check */
|
||||||
|
|
||||||
# define lseek _lseeki64
|
# define lseek _lseeki64
|
||||||
# define stat _stat64
|
# define stat __stat64
|
||||||
# define fstat _fstat64
|
# define fstat _fstat64
|
||||||
|
|
||||||
/* stat: file mode type testing macros */
|
/* stat: file mode type testing macros */
|
||||||
@ -38,7 +38,7 @@
|
|||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
|
|
||||||
/* define snprintf using variadic macro support if available */
|
/* define snprintf using variadic macro support if available */
|
||||||
#if _MSC_VER >= 1400
|
#if _MSC_VER >= 1500
|
||||||
# define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__)
|
# define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
# define EAFNOSUPPORT (INT_MAX-1)
|
# define EAFNOSUPPORT (INT_MAX-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
||||||
# define p_ftruncate(fd, sz) _chsize_s(fd, sz)
|
# define p_ftruncate(fd, sz) _chsize_s(fd, sz)
|
||||||
#else /* MinGW */
|
#else /* MinGW */
|
||||||
# define p_ftruncate(fd, sz) _chsize(fd, sz)
|
# define p_ftruncate(fd, sz) _chsize(fd, sz)
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
# define FILE_NAME_NORMALIZED 0
|
# define FILE_NAME_NORMALIZED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef IO_REPARSE_TAG_SYMLINK
|
||||||
|
#define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Options which we always provide to _wopen.
|
/* Options which we always provide to _wopen.
|
||||||
*
|
*
|
||||||
* _O_BINARY - Raw access; no translation of CR or LF characters
|
* _O_BINARY - Raw access; no translation of CR or LF characters
|
||||||
@ -543,7 +547,7 @@ char *p_realpath(const char *orig_path, char *buffer)
|
|||||||
|
|
||||||
int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
|
int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (count == 0 ||
|
if (count == 0 ||
|
||||||
@ -570,7 +574,7 @@ int p_snprintf(char *buffer, size_t count, const char *format, ...)
|
|||||||
|
|
||||||
int p_mkstemp(char *tmp_path)
|
int p_mkstemp(char *tmp_path)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
||||||
if (_mktemp_s(tmp_path, strlen(tmp_path) + 1) != 0)
|
if (_mktemp_s(tmp_path, strlen(tmp_path) + 1) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user