Commit 935dea2f authored by Kevin Koltzau's avatar Kevin Koltzau Committed by Alexandre Julliard

Fix warnings and errors in 64bit.

parent f5acfaad
...@@ -50,7 +50,15 @@ typedef unsigned short MSVCRT_wint_t; ...@@ -50,7 +50,15 @@ typedef unsigned short MSVCRT_wint_t;
typedef unsigned short MSVCRT_wctype_t; typedef unsigned short MSVCRT_wctype_t;
typedef unsigned short MSVCRT__ino_t; typedef unsigned short MSVCRT__ino_t;
typedef unsigned long MSVCRT__fsize_t; typedef unsigned long MSVCRT__fsize_t;
typedef unsigned int MSVCRT_size_t; #ifdef _WIN64
typedef unsigned __int64 MSVCRT_size_t;
typedef __int64 MSVCRT_intptr_t;
typedef unsigned __int64 MSVCRT_uintptr_t;
#else
typedef unsigned int MSVCRT_size_t;
typedef int MSVCRT_intptr_t;
typedef unsigned int MSVCRT_uintptr_t;
#endif
typedef unsigned int MSVCRT__dev_t; typedef unsigned int MSVCRT__dev_t;
typedef int MSVCRT__off_t; typedef int MSVCRT__off_t;
typedef long MSVCRT_clock_t; typedef long MSVCRT_clock_t;
...@@ -584,7 +592,7 @@ int _write(int,const void*,unsigned int); ...@@ -584,7 +592,7 @@ int _write(int,const void*,unsigned int);
int _getch(void); int _getch(void);
int _vsnwprintf(MSVCRT_wchar_t*,MSVCRT_size_t,const MSVCRT_wchar_t*,va_list); int _vsnwprintf(MSVCRT_wchar_t*,MSVCRT_size_t,const MSVCRT_wchar_t*,va_list);
int _ismbstrail(const unsigned char* start, const unsigned char* str); int _ismbstrail(const unsigned char* start, const unsigned char* str);
int _spawnve(int,const char*,const char* const *,const char* const *); MSVCRT_intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
void _searchenv(const char*,const char*,char*); void _searchenv(const char*,const char*,char*);
int _getdrive(void); int _getdrive(void);
char* _strdup(const char*); char* _strdup(const char*);
......
...@@ -35,14 +35,11 @@ ...@@ -35,14 +35,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/* INTERNAL: Spawn a child process */ /* INTERNAL: Spawn a child process */
static int msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env) static MSVCRT_intptr_t msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env)
{ {
STARTUPINFOA si; STARTUPINFOA si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
if (sizeof(HANDLE) != sizeof(int))
WARN("This call is unsuitable for your architecture\n");
if ((unsigned)flags > MSVCRT__P_DETACH) if ((unsigned)flags > MSVCRT__P_DETACH)
{ {
*MSVCRT__errno() = MSVCRT_EINVAL; *MSVCRT__errno() = MSVCRT_EINVAL;
...@@ -69,7 +66,7 @@ static int msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env) ...@@ -69,7 +66,7 @@ static int msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env)
GetExitCodeProcess(pi.hProcess,&pi.dwProcessId); GetExitCodeProcess(pi.hProcess,&pi.dwProcessId);
CloseHandle(pi.hProcess); CloseHandle(pi.hProcess);
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
return (int)pi.dwProcessId; return pi.dwProcessId;
case MSVCRT__P_DETACH: case MSVCRT__P_DETACH:
CloseHandle(pi.hProcess); CloseHandle(pi.hProcess);
pi.hProcess = 0; pi.hProcess = 0;
...@@ -77,7 +74,7 @@ static int msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env) ...@@ -77,7 +74,7 @@ static int msvcrt_spawn(int flags, const char* exe, char* cmdline, char* env)
case MSVCRT__P_NOWAIT: case MSVCRT__P_NOWAIT:
case MSVCRT__P_NOWAITO: case MSVCRT__P_NOWAITO:
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
return (int)pi.hProcess; return (MSVCRT_intptr_t)pi.hProcess;
case MSVCRT__P_OVERLAY: case MSVCRT__P_OVERLAY:
MSVCRT__exit(0); MSVCRT__exit(0);
} }
...@@ -186,7 +183,7 @@ static char* msvcrt_valisttos(const char* arg0, va_list alist, char delim) ...@@ -186,7 +183,7 @@ static char* msvcrt_valisttos(const char* arg0, va_list alist, char delim)
/********************************************************************* /*********************************************************************
* _cwait (MSVCRT.@) * _cwait (MSVCRT.@)
*/ */
int _cwait(int *status, int pid, int action) MSVCRT_intptr_t _cwait(int *status, MSVCRT_intptr_t pid, int action)
{ {
HANDLE hPid = (HANDLE)pid; HANDLE hPid = (HANDLE)pid;
int doserrno; int doserrno;
...@@ -201,7 +198,7 @@ int _cwait(int *status, int pid, int action) ...@@ -201,7 +198,7 @@ int _cwait(int *status, int pid, int action)
GetExitCodeProcess(hPid, &stat); GetExitCodeProcess(hPid, &stat);
*status = (int)stat; *status = (int)stat;
} }
return (int)pid; return pid;
} }
doserrno = GetLastError(); doserrno = GetLastError();
...@@ -222,11 +219,11 @@ int _cwait(int *status, int pid, int action) ...@@ -222,11 +219,11 @@ int _cwait(int *status, int pid, int action)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execl(const char* name, const char* arg0, ...) MSVCRT_intptr_t _execl(const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char * args; char * args;
int ret; MSVCRT_intptr_t ret;
va_start(ap, arg0); va_start(ap, arg0);
args = msvcrt_valisttos(arg0, ap, ' '); args = msvcrt_valisttos(arg0, ap, ' ');
...@@ -241,7 +238,7 @@ int _execl(const char* name, const char* arg0, ...) ...@@ -241,7 +238,7 @@ int _execl(const char* name, const char* arg0, ...)
/********************************************************************* /*********************************************************************
* _execle (MSVCRT.@) * _execle (MSVCRT.@)
*/ */
int _execle(const char* name, const char* arg0, ...) MSVCRT_intptr_t _execle(const char* name, const char* arg0, ...)
{ {
FIXME("stub\n"); FIXME("stub\n");
return -1; return -1;
...@@ -253,11 +250,11 @@ int _execle(const char* name, const char* arg0, ...) ...@@ -253,11 +250,11 @@ int _execle(const char* name, const char* arg0, ...)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execlp(const char* name, const char* arg0, ...) MSVCRT_intptr_t _execlp(const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char * args; char * args;
int ret; MSVCRT_intptr_t ret;
char fullname[MAX_PATH]; char fullname[MAX_PATH];
_searchenv(name, "PATH", fullname); _searchenv(name, "PATH", fullname);
...@@ -275,7 +272,7 @@ int _execlp(const char* name, const char* arg0, ...) ...@@ -275,7 +272,7 @@ int _execlp(const char* name, const char* arg0, ...)
/********************************************************************* /*********************************************************************
* _execlpe (MSVCRT.@) * _execlpe (MSVCRT.@)
*/ */
int _execlpe(const char* name, const char* arg0, ...) MSVCRT_intptr_t _execlpe(const char* name, const char* arg0, ...)
{ {
FIXME("stub\n"); FIXME("stub\n");
return -1; return -1;
...@@ -287,7 +284,7 @@ int _execlpe(const char* name, const char* arg0, ...) ...@@ -287,7 +284,7 @@ int _execlpe(const char* name, const char* arg0, ...)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execv(const char* name, char* const* argv) MSVCRT_intptr_t _execv(const char* name, char* const* argv)
{ {
return _spawnve(MSVCRT__P_OVERLAY, name, (const char* const*) argv, NULL); return _spawnve(MSVCRT__P_OVERLAY, name, (const char* const*) argv, NULL);
} }
...@@ -298,7 +295,7 @@ int _execv(const char* name, char* const* argv) ...@@ -298,7 +295,7 @@ int _execv(const char* name, char* const* argv)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execve(const char* name, char* const* argv, const char* const* envv) MSVCRT_intptr_t _execve(const char* name, char* const* argv, const char* const* envv)
{ {
return _spawnve(MSVCRT__P_OVERLAY, name, (const char* const*) argv, envv); return _spawnve(MSVCRT__P_OVERLAY, name, (const char* const*) argv, envv);
} }
...@@ -309,7 +306,7 @@ int _execve(const char* name, char* const* argv, const char* const* envv) ...@@ -309,7 +306,7 @@ int _execve(const char* name, char* const* argv, const char* const* envv)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execvpe(const char* name, char* const* argv, const char* const* envv) MSVCRT_intptr_t _execvpe(const char* name, char* const* argv, const char* const* envv)
{ {
char fullname[MAX_PATH]; char fullname[MAX_PATH];
...@@ -324,7 +321,7 @@ int _execvpe(const char* name, char* const* argv, const char* const* envv) ...@@ -324,7 +321,7 @@ int _execvpe(const char* name, char* const* argv, const char* const* envv)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _execvp(const char* name, char* const* argv) MSVCRT_intptr_t _execvp(const char* name, char* const* argv)
{ {
return _execvpe(name, argv, NULL); return _execvpe(name, argv, NULL);
} }
...@@ -335,11 +332,11 @@ int _execvp(const char* name, char* const* argv) ...@@ -335,11 +332,11 @@ int _execvp(const char* name, char* const* argv)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnl(int flags, const char* name, const char* arg0, ...) MSVCRT_intptr_t _spawnl(int flags, const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char * args; char * args;
int ret; MSVCRT_intptr_t ret;
va_start(ap, arg0); va_start(ap, arg0);
args = msvcrt_valisttos(arg0, ap, ' '); args = msvcrt_valisttos(arg0, ap, ' ');
...@@ -354,12 +351,12 @@ int _spawnl(int flags, const char* name, const char* arg0, ...) ...@@ -354,12 +351,12 @@ int _spawnl(int flags, const char* name, const char* arg0, ...)
/********************************************************************* /*********************************************************************
* _spawnle (MSVCRT.@) * _spawnle (MSVCRT.@)
*/ */
int _spawnle(int flags, const char* name, const char* arg0, ...) MSVCRT_intptr_t _spawnle(int flags, const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char *args, *envs = NULL; char *args, *envs = NULL;
const char * const *envp; const char * const *envp;
int ret; MSVCRT_intptr_t ret;
va_start(ap, arg0); va_start(ap, arg0);
args = msvcrt_valisttos(arg0, ap, ' '); args = msvcrt_valisttos(arg0, ap, ' ');
...@@ -385,11 +382,11 @@ int _spawnle(int flags, const char* name, const char* arg0, ...) ...@@ -385,11 +382,11 @@ int _spawnle(int flags, const char* name, const char* arg0, ...)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnlp(int flags, const char* name, const char* arg0, ...) MSVCRT_intptr_t _spawnlp(int flags, const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char * args; char * args;
int ret; MSVCRT_intptr_t ret;
char fullname[MAX_PATH]; char fullname[MAX_PATH];
_searchenv(name, "PATH", fullname); _searchenv(name, "PATH", fullname);
...@@ -407,12 +404,12 @@ int _spawnlp(int flags, const char* name, const char* arg0, ...) ...@@ -407,12 +404,12 @@ int _spawnlp(int flags, const char* name, const char* arg0, ...)
/********************************************************************* /*********************************************************************
* _spawnlpe (MSVCRT.@) * _spawnlpe (MSVCRT.@)
*/ */
int _spawnlpe(int flags, const char* name, const char* arg0, ...) MSVCRT_intptr_t _spawnlpe(int flags, const char* name, const char* arg0, ...)
{ {
va_list ap; va_list ap;
char *args, *envs = NULL; char *args, *envs = NULL;
const char * const *envp; const char * const *envp;
int ret; MSVCRT_intptr_t ret;
char fullname[MAX_PATH]; char fullname[MAX_PATH];
_searchenv(name, "PATH", fullname); _searchenv(name, "PATH", fullname);
...@@ -440,13 +437,13 @@ int _spawnlpe(int flags, const char* name, const char* arg0, ...) ...@@ -440,13 +437,13 @@ int _spawnlpe(int flags, const char* name, const char* arg0, ...)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnve(int flags, const char* name, const char* const* argv, MSVCRT_intptr_t _spawnve(int flags, const char* name, const char* const* argv,
const char* const* envv) const char* const* envv)
{ {
char * args = msvcrt_argvtos(argv,' '); char * args = msvcrt_argvtos(argv,' ');
char * envs = msvcrt_argvtos(envv,0); char * envs = msvcrt_argvtos(envv,0);
const char *fullname = name; const char *fullname = name;
int ret = -1; MSVCRT_intptr_t ret = -1;
FIXME(":not translating name %s to locate program\n",fullname); FIXME(":not translating name %s to locate program\n",fullname);
TRACE(":call (%s), params (%s), env (%s)\n",debugstr_a(name),debugstr_a(args), TRACE(":call (%s), params (%s), env (%s)\n",debugstr_a(name),debugstr_a(args),
...@@ -469,7 +466,7 @@ int _spawnve(int flags, const char* name, const char* const* argv, ...@@ -469,7 +466,7 @@ int _spawnve(int flags, const char* name, const char* const* argv,
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnv(int flags, const char* name, const char* const* argv) MSVCRT_intptr_t _spawnv(int flags, const char* name, const char* const* argv)
{ {
return _spawnve(flags, name, argv, NULL); return _spawnve(flags, name, argv, NULL);
} }
...@@ -480,7 +477,7 @@ int _spawnv(int flags, const char* name, const char* const* argv) ...@@ -480,7 +477,7 @@ int _spawnv(int flags, const char* name, const char* const* argv)
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnvpe(int flags, const char* name, const char* const* argv, MSVCRT_intptr_t _spawnvpe(int flags, const char* name, const char* const* argv,
const char* const* envv) const char* const* envv)
{ {
char fullname[MAX_PATH]; char fullname[MAX_PATH];
...@@ -494,7 +491,7 @@ int _spawnvpe(int flags, const char* name, const char* const* argv, ...@@ -494,7 +491,7 @@ int _spawnvpe(int flags, const char* name, const char* const* argv,
* Like on Windows, this function does not handle arguments with spaces * Like on Windows, this function does not handle arguments with spaces
* or double-quotes. * or double-quotes.
*/ */
int _spawnvp(int flags, const char* name, const char* const* argv) MSVCRT_intptr_t _spawnvp(int flags, const char* name, const char* const* argv)
{ {
return _spawnvpe(flags, name, argv, NULL); return _spawnvpe(flags, name, argv, NULL);
} }
...@@ -635,15 +632,15 @@ int MSVCRT_system(const char* cmd) ...@@ -635,15 +632,15 @@ int MSVCRT_system(const char* cmd)
/********************************************************************* /*********************************************************************
* _loaddll (MSVCRT.@) * _loaddll (MSVCRT.@)
*/ */
int _loaddll(const char* dllname) MSVCRT_intptr_t _loaddll(const char* dllname)
{ {
return (int)LoadLibraryA(dllname); return (MSVCRT_intptr_t)LoadLibraryA(dllname);
} }
/********************************************************************* /*********************************************************************
* _unloaddll (MSVCRT.@) * _unloaddll (MSVCRT.@)
*/ */
int _unloaddll(int dll) int _unloaddll(MSVCRT_intptr_t dll)
{ {
if (FreeLibrary((HMODULE)dll)) if (FreeLibrary((HMODULE)dll))
return 0; return 0;
...@@ -658,7 +655,7 @@ int _unloaddll(int dll) ...@@ -658,7 +655,7 @@ int _unloaddll(int dll)
/********************************************************************* /*********************************************************************
* _getdllprocaddr (MSVCRT.@) * _getdllprocaddr (MSVCRT.@)
*/ */
void *_getdllprocaddr(int dll, const char *name, int ordinal) void *_getdllprocaddr(MSVCRT_intptr_t dll, const char *name, int ordinal)
{ {
if (name) if (name)
{ {
......
...@@ -57,7 +57,7 @@ char* _strdup(const char* str) ...@@ -57,7 +57,7 @@ char* _strdup(const char* str)
/********************************************************************* /*********************************************************************
* _strnset (MSVCRT.@) * _strnset (MSVCRT.@)
*/ */
char* _strnset(char* str, int value, unsigned int len) char* _strnset(char* str, int value, MSVCRT_size_t len)
{ {
if (len > 0 && str) if (len > 0 && str)
while (*str && len--) while (*str && len--)
......
...@@ -81,6 +81,8 @@ static void test_types(void) ...@@ -81,6 +81,8 @@ static void test_types(void)
CHECK_TYPE(_ino_t); CHECK_TYPE(_ino_t);
CHECK_TYPE(_fsize_t); CHECK_TYPE(_fsize_t);
CHECK_TYPE(size_t); CHECK_TYPE(size_t);
CHECK_TYPE(intptr_t);
CHECK_TYPE(uintptr_t);
CHECK_TYPE(_dev_t); CHECK_TYPE(_dev_t);
CHECK_TYPE(_off_t); CHECK_TYPE(_off_t);
CHECK_TYPE(clock_t); CHECK_TYPE(clock_t);
......
...@@ -70,7 +70,7 @@ static DWORD CALLBACK _beginthread_trampoline(LPVOID arg) ...@@ -70,7 +70,7 @@ static DWORD CALLBACK _beginthread_trampoline(LPVOID arg)
/********************************************************************* /*********************************************************************
* _beginthread (MSVCRT.@) * _beginthread (MSVCRT.@)
*/ */
unsigned long _beginthread( MSVCRT_uintptr_t _beginthread(
MSVCRT__beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */ MSVCRT__beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
unsigned int stack_size, /* [in] Stack size for new thread or 0 */ unsigned int stack_size, /* [in] Stack size for new thread or 0 */
void *arglist) /* [in] Argument list to be passed to new thread or NULL */ void *arglist) /* [in] Argument list to be passed to new thread or NULL */
...@@ -88,14 +88,14 @@ unsigned long _beginthread( ...@@ -88,14 +88,14 @@ unsigned long _beginthread(
trampoline->arglist = arglist; trampoline->arglist = arglist;
/* FIXME */ /* FIXME */
return (unsigned long)CreateThread(NULL, stack_size, _beginthread_trampoline, return (MSVCRT_uintptr_t)CreateThread(NULL, stack_size, _beginthread_trampoline,
trampoline, 0, NULL); trampoline, 0, NULL);
} }
/********************************************************************* /*********************************************************************
* _beginthreadex (MSVCRT.@) * _beginthreadex (MSVCRT.@)
*/ */
unsigned long _beginthreadex( MSVCRT_uintptr_t _beginthreadex(
void *security, /* [in] Security descriptor for new thread; must be NULL for Windows 9x applications */ void *security, /* [in] Security descriptor for new thread; must be NULL for Windows 9x applications */
unsigned int stack_size, /* [in] Stack size for new thread or 0 */ unsigned int stack_size, /* [in] Stack size for new thread or 0 */
MSVCRT__beginthreadex_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */ MSVCRT__beginthreadex_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
...@@ -106,7 +106,7 @@ unsigned long _beginthreadex( ...@@ -106,7 +106,7 @@ unsigned long _beginthreadex(
TRACE("(%p, %d, %p, %p, %d, %p)\n", security, stack_size, start_address, arglist, initflag, thrdaddr); TRACE("(%p, %d, %p, %p, %d, %p)\n", security, stack_size, start_address, arglist, initflag, thrdaddr);
/* FIXME */ /* FIXME */
return (unsigned long)CreateThread(security, stack_size, return (MSVCRT_uintptr_t)CreateThread(security, stack_size,
(LPTHREAD_START_ROUTINE) start_address, (LPTHREAD_START_ROUTINE) start_address,
arglist, initflag, (LPDWORD) thrdaddr); arglist, initflag, (LPDWORD) thrdaddr);
} }
......
...@@ -49,28 +49,28 @@ extern "C" { ...@@ -49,28 +49,28 @@ extern "C" {
typedef void (*_beginthread_start_routine_t)(void *); typedef void (*_beginthread_start_routine_t)(void *);
typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *); typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
unsigned long _beginthread(_beginthread_start_routine_t,unsigned int,void*); uintptr_t _beginthread(_beginthread_start_routine_t,unsigned int,void*);
unsigned long _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*); uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
int _cwait(int*,int,int); intptr_t _cwait(int*,intptr_t,int);
void _endthread(void); void _endthread(void);
void _endthreadex(unsigned int); void _endthreadex(unsigned int);
int _execl(const char*,const char*,...); intptr_t _execl(const char*,const char*,...);
int _execle(const char*,const char*,...); intptr_t _execle(const char*,const char*,...);
int _execlp(const char*,const char*,...); intptr_t _execlp(const char*,const char*,...);
int _execlpe(const char*,const char*,...); intptr_t _execlpe(const char*,const char*,...);
int _execv(const char*,char* const *); intptr_t _execv(const char*,char* const *);
int _execve(const char*,char* const *,const char* const *); intptr_t _execve(const char*,char* const *,const char* const *);
int _execvp(const char*,char* const *); intptr_t _execvp(const char*,char* const *);
int _execvpe(const char*,char* const *,const char* const *); intptr_t _execvpe(const char*,char* const *,const char* const *);
int _getpid(void); int _getpid(void);
int _spawnl(int,const char*,const char*,...); intptr_t _spawnl(int,const char*,const char*,...);
int _spawnle(int,const char*,const char*,...); intptr_t _spawnle(int,const char*,const char*,...);
int _spawnlp(int,const char*,const char*,...); intptr_t _spawnlp(int,const char*,const char*,...);
int _spawnlpe(int,const char*,const char*,...); intptr_t _spawnlpe(int,const char*,const char*,...);
int _spawnv(int,const char*,const char* const *); intptr_t _spawnv(int,const char*,const char* const *);
int _spawnve(int,const char*,const char* const *,const char* const *); intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
int _spawnvp(int,const char*,const char* const *); intptr_t _spawnvp(int,const char*,const char* const *);
int _spawnvpe(int,const char*,const char* const *,const char* const *); intptr_t _spawnvpe(int,const char*,const char* const *,const char* const *);
void _c_exit(void); void _c_exit(void);
void _cexit(void); void _cexit(void);
...@@ -81,22 +81,22 @@ int system(const char*); ...@@ -81,22 +81,22 @@ int system(const char*);
#ifndef _WPROCESS_DEFINED #ifndef _WPROCESS_DEFINED
#define _WPROCESS_DEFINED #define _WPROCESS_DEFINED
int _wexecl(const wchar_t*,const wchar_t*,...); intptr_t _wexecl(const wchar_t*,const wchar_t*,...);
int _wexecle(const wchar_t*,const wchar_t*,...); intptr_t _wexecle(const wchar_t*,const wchar_t*,...);
int _wexeclp(const wchar_t*,const wchar_t*,...); intptr_t _wexeclp(const wchar_t*,const wchar_t*,...);
int _wexeclpe(const wchar_t*,const wchar_t*,...); intptr_t _wexeclpe(const wchar_t*,const wchar_t*,...);
int _wexecv(const wchar_t*,const wchar_t* const *); intptr_t _wexecv(const wchar_t*,const wchar_t* const *);
int _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *); intptr_t _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
int _wexecvp(const wchar_t*,const wchar_t* const *); intptr_t _wexecvp(const wchar_t*,const wchar_t* const *);
int _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *); intptr_t _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
int _wspawnl(int,const wchar_t*,const wchar_t*,...); intptr_t _wspawnl(int,const wchar_t*,const wchar_t*,...);
int _wspawnle(int,const wchar_t*,const wchar_t*,...); intptr_t _wspawnle(int,const wchar_t*,const wchar_t*,...);
int _wspawnlp(int,const wchar_t*,const wchar_t*,...); intptr_t _wspawnlp(int,const wchar_t*,const wchar_t*,...);
int _wspawnlpe(int,const wchar_t*,const wchar_t*,...); intptr_t _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
int _wspawnv(int,const wchar_t*,const wchar_t* const *); intptr_t _wspawnv(int,const wchar_t*,const wchar_t* const *);
int _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); intptr_t _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
int _wspawnvp(int,const wchar_t*,const wchar_t* const *); intptr_t _wspawnvp(int,const wchar_t*,const wchar_t* const *);
int _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); intptr_t _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
int _wsystem(const wchar_t*); int _wsystem(const wchar_t*);
#endif /* _WPROCESS_DEFINED */ #endif /* _WPROCESS_DEFINED */
...@@ -114,26 +114,26 @@ int _wsystem(const wchar_t*); ...@@ -114,26 +114,26 @@ int _wsystem(const wchar_t*);
#define WAIT_CHILD _WAIT_CHILD #define WAIT_CHILD _WAIT_CHILD
#define WAIT_GRANDCHILD _WAIT_GRANDCHILD #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); } static inline intptr_t cwait(int *status, intptr_t pid, int action) { return _cwait(status, pid, action); }
static inline int getpid(void) { return _getpid(); } static inline int getpid(void) { return _getpid(); }
static inline int execv(const char* name, char* const* argv) { return _execv(name, argv); } static inline intptr_t execv(const char* name, char* const* argv) { return _execv(name, argv); }
static inline int execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); } static inline intptr_t execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
static inline int execvp(const char* name, char* const* argv) { return _execvp(name, argv); } static inline intptr_t execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
static inline int execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); } static inline intptr_t execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
static inline int spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); } static inline intptr_t spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
static inline int spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); } static inline intptr_t spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); } static inline intptr_t spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); } static inline intptr_t spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
#if defined(__GNUC__) && (__GNUC__ < 4) #if defined(__GNUC__) && (__GNUC__ < 4)
extern int execl(const char*,const char*,...) __attribute__((alias("_execl"))); extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl")));
extern int execle(const char*,const char*,...) __attribute__((alias("_execle"))); extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle")));
extern int execlp(const char*,const char*,...) __attribute__((alias("_execlp"))); extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
extern int execlpe(const char*,const char*,...) __attribute__((alias("_execlpe"))); extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
extern int spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl"))); extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
extern int spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle"))); extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
extern int spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp"))); extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
extern int spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe"))); extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
#else #else
#define execl _execl #define execl _execl
#define execle _execle #define execle _execle
......
...@@ -30,13 +30,39 @@ typedef unsigned short wchar_t; ...@@ -30,13 +30,39 @@ typedef unsigned short wchar_t;
#endif #endif
#endif #endif
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#ifndef _PTRDIFF_T_DEFINED #ifndef _PTRDIFF_T_DEFINED
#ifdef _WIN64
typedef __int64 ptrdiff_t;
#else
typedef int ptrdiff_t; typedef int ptrdiff_t;
#endif
#define _PTRDIFF_T_DEFINED #define _PTRDIFF_T_DEFINED
#endif #endif
#ifndef _SIZE_T_DEFINED #ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef unsigned int size_t; typedef unsigned int size_t;
#endif
#define _SIZE_T_DEFINED #define _SIZE_T_DEFINED
#endif #endif
...@@ -48,7 +74,11 @@ typedef unsigned int size_t; ...@@ -48,7 +74,11 @@ typedef unsigned int size_t;
#endif #endif
#endif #endif
#ifdef _WIN64
#define offsetof(s,m) (size_t)((ptrdiff_t)&(((s*)NULL)->m))
#else
#define offsetof(s,m) (size_t)&(((s*)NULL)->m) #define offsetof(s,m) (size_t)&(((s*)NULL)->m)
#endif
#ifdef __cplusplus #ifdef __cplusplus
......
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