diff src/main/win32/SDL_main.c @ 112:9ef74357a5fb

Incorporated slightly modified version of Rainer's WinCE patch
author Sam Lantinga <slouken@lokigames.com>
date Wed, 18 Jul 2001 20:04:23 +0000
parents 13ee9f4834ea
children 29a638dc26db
line wrap: on
line diff
--- a/src/main/win32/SDL_main.c	Sat Jul 14 20:37:24 2001 +0000
+++ b/src/main/win32/SDL_main.c	Wed Jul 18 20:04:23 2001 +0000
@@ -16,8 +16,10 @@
 #include "SDL.h"
 #include "SDL_main.h"
 #ifdef main
+#ifndef _WIN32_WCE_EMULATION
 #undef main
 #endif
+#endif
 
 /* Do we really not want stdio redirection with Windows CE? */
 #ifdef _WIN32_WCE
@@ -28,7 +30,7 @@
 #define STDOUT_FILE	TEXT("stdout.txt")
 #define STDERR_FILE	TEXT("stderr.txt")
 
-#ifdef _WIN32_WCE
+#if defined(_WIN32_WCE) && _WIN32_WCE < 300
 /* seems to be undefined in Win CE although in online help */
 #define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
 
@@ -52,7 +54,7 @@
 	}
 	return p;
 }
-#endif /* _WIN32_WCE */
+#endif /* _WIN32_WCE < 300 */
 
 /* Parse a command line buffer into arguments */
 static int ParseCommandLine(char *cmdline, char **argv)
@@ -274,7 +276,7 @@
 	nLen = wcslen(szCmdLine)+128+1;
 	bufp = (wchar_t *)alloca(nLen*2);
 	GetModuleFileName(NULL, bufp, 128);
-	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen);
+	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
 	nLen = wcslen(bufp)+1;
 	cmdline = (char *)alloca(nLen);
 	if ( cmdline == NULL ) {