comparison src/main/win32/SDL_win32_main.c @ 1659:14717b52abc0 SDL-1.3

Merge trunk-1.3-3
author Sam Lantinga <slouken@libsdl.org>
date Wed, 17 May 2006 08:18:28 +0000
parents 4aac8563c296
children 782fd950bd46 c121d94672cb 70e77cbba87c
comparison
equal deleted inserted replaced
1658:e49147870aac 1659:14717b52abc0
119 { 119 {
120 ShowError("Fatal Error", "Out of memory - aborting"); 120 ShowError("Fatal Error", "Out of memory - aborting");
121 return FALSE; 121 return FALSE;
122 } 122 }
123 123
124 /* SDL_Quit() shouldn't be used with atexit() directly because
125 calling conventions may differ... */
126 static void cleanup(void)
127 {
128 SDL_Quit();
129 }
130
124 /* Remove the output files if there was no output written */ 131 /* Remove the output files if there was no output written */
125 static void __cdecl cleanup_output(void) 132 static void cleanup_output(void)
126 { 133 {
127 #ifndef NO_STDIO_REDIRECT 134 #ifndef NO_STDIO_REDIRECT
128 FILE *file; 135 FILE *file;
129 int empty; 136 int empty;
130 #endif 137 #endif
186 193
187 bufp = SDL_stack_alloc(char, n+1); 194 bufp = SDL_stack_alloc(char, n+1);
188 if ( bufp == NULL ) { 195 if ( bufp == NULL ) {
189 return OutOfMemory(); 196 return OutOfMemory();
190 } 197 }
191 SDL_strlcpy(bufp, appname, n); 198 SDL_strlcpy(bufp, appname, n+1);
192 appname = bufp; 199 appname = bufp;
193 200
194 /* Load SDL dynamic link library */ 201 /* Load SDL dynamic link library */
195 if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) { 202 if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
196 ShowError("WinMain() error", SDL_GetError()); 203 ShowError("WinMain() error", SDL_GetError());
197 return(FALSE); 204 return(FALSE);
198 } 205 }
199 atexit(cleanup_output); 206 atexit(cleanup_output);
200 atexit(SDL_Quit); 207 atexit(cleanup);
201 208
202 /* Sam: 209 /* Sam:
203 We still need to pass in the application handle so that 210 We still need to pass in the application handle so that
204 DirectInput will initialize properly when SDL_RegisterApp() 211 DirectInput will initialize properly when SDL_RegisterApp()
205 is called later in the video initialization. 212 is called later in the video initialization.