windows: fix build on MinGW

This commit is contained in:
huxingyi 2014-08-10 13:18:59 +08:00 committed by Saúl Ibarra Corretgé
parent 09cb5b534e
commit ca4741b4a5
2 changed files with 15 additions and 3 deletions

View File

@ -39,6 +39,20 @@ typedef struct pollfd {
} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
#endif
#ifndef LOCALE_INVARIANT
# define LOCALE_INVARIANT 0x007f
#endif
#ifndef _malloca
# if defined(_DEBUG)
# define _malloca(size) malloc(size)
# define _freea(ptr) free(ptr)
# else
# define _malloca(size) alloca(size)
# define _freea(ptr)
# endif
#endif
#include <mswsock.h>
#include <ws2tcpip.h>
#include <windows.h>

View File

@ -800,10 +800,8 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
i++;
} else {
/* copy var from env_block */
DWORD r;
len = wcslen(*ptr_copy) + 1;
r = wmemcpy_s(ptr, (env_len - (ptr - dst)), *ptr_copy, len);
assert(!r);
wmemcpy(ptr, *ptr_copy, len);
ptr_copy++;
if (cmp == 0)
i++;