comparison src/video/photon/SDL_ph_video.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
74 static SDL_VideoDevice* ph_CreateDevice(int devindex) 74 static SDL_VideoDevice* ph_CreateDevice(int devindex)
75 { 75 {
76 SDL_VideoDevice* device; 76 SDL_VideoDevice* device;
77 77
78 /* Initialize all variables that we clean on shutdown */ 78 /* Initialize all variables that we clean on shutdown */
79 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 79 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
80 if (device) 80 if (device)
81 { 81 {
82 memset(device, 0, (sizeof *device)); 82 SDL_memset(device, 0, (sizeof *device));
83 device->hidden = (struct SDL_PrivateVideoData*)malloc((sizeof *device->hidden)); 83 device->hidden = (struct SDL_PrivateVideoData*)SDL_malloc((sizeof *device->hidden));
84 device->gl_data = NULL; 84 device->gl_data = NULL;
85 } 85 }
86 if ((device == NULL) || (device->hidden == NULL)) 86 if ((device == NULL) || (device->hidden == NULL))
87 { 87 {
88 SDL_OutOfMemory(); 88 SDL_OutOfMemory();
89 ph_DeleteDevice(device); 89 ph_DeleteDevice(device);
90 return NULL; 90 return NULL;
91 } 91 }
92 memset(device->hidden, 0, (sizeof *device->hidden)); 92 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
93 93
94 /* Set the driver flags */ 94 /* Set the driver flags */
95 device->handles_any_size = 1; 95 device->handles_any_size = 1;
96 96
97 /* Set the function pointers */ 97 /* Set the function pointers */
156 { 156 {
157 if (device) 157 if (device)
158 { 158 {
159 if (device->hidden) 159 if (device->hidden)
160 { 160 {
161 free(device->hidden); 161 SDL_free(device->hidden);
162 device->hidden = NULL; 162 device->hidden = NULL;
163 } 163 }
164 if (device->gl_data) 164 if (device->gl_data)
165 { 165 {
166 free(device->gl_data); 166 SDL_free(device->gl_data);
167 device->gl_data = NULL; 167 device->gl_data = NULL;
168 } 168 }
169 free(device); 169 SDL_free(device);
170 device = NULL; 170 device = NULL;
171 } 171 }
172 } 172 }
173 173
174 static PtWidget_t *ph_CreateWindow(_THIS) 174 static PtWidget_t *ph_CreateWindow(_THIS)
255 { 255 {
256 PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0); 256 PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
257 } 257 }
258 if (!currently_maximized) 258 if (!currently_maximized)
259 { 259 {
260 windowpos = getenv("SDL_VIDEO_WINDOW_POS"); 260 windowpos = SDL_getenv("SDL_VIDEO_WINDOW_POS");
261 iscentered = getenv("SDL_VIDEO_CENTERED"); 261 iscentered = SDL_getenv("SDL_VIDEO_CENTERED");
262 262
263 if ((iscentered) || ((windowpos) && (strcmp(windowpos, "center")==0))) 263 if ((iscentered) || ((windowpos) && (SDL_strcmp(windowpos, "center")==0)))
264 { 264 {
265 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent); 265 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
266 if (desktop_mode.width>w) 266 if (desktop_mode.width>w)
267 { 267 {
268 pos.x = (desktop_mode.width - w)/2; 268 pos.x = (desktop_mode.width - w)/2;
278 } 278 }
279 else 279 else
280 { 280 {
281 if (windowpos) 281 if (windowpos)
282 { 282 {
283 if (sscanf(windowpos, "%d,%d", &x, &y) == 2) 283 if (SDL_sscanf(windowpos, "%d,%d", &x, &y) == 2)
284 { 284 {
285 if ((x<desktop_mode.width) && (y<desktop_mode.height)) 285 if ((x<desktop_mode.width) && (y<desktop_mode.height))
286 { 286 {
287 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent); 287 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
288 pos.x=x+desktopextent.ul.x; 288 pos.x=x+desktopextent.ul.x;
370 #endif /* HAVE_OPENGL */ 370 #endif /* HAVE_OPENGL */
371 371
372 old_video_mode=-1; 372 old_video_mode=-1;
373 old_refresh_rate=-1; 373 old_refresh_rate=-1;
374 374
375 if (NULL == (event = malloc(EVENT_SIZE))) 375 if (NULL == (event = SDL_malloc(EVENT_SIZE)))
376 { 376 {
377 SDL_OutOfMemory(); 377 SDL_OutOfMemory();
378 return -1; 378 return -1;
379 } 379 }
380 memset(event, 0x00, EVENT_SIZE); 380 SDL_memset(event, 0x00, EVENT_SIZE);
381 381
382 window = ph_CreateWindow(this); 382 window = ph_CreateWindow(this);
383 if (window == NULL) 383 if (window == NULL)
384 { 384 {
385 SDL_SetError("ph_VideoInit(): Couldn't create video window !\n"); 385 SDL_SetError("ph_VideoInit(): Couldn't create video window !\n");
590 window=NULL; 590 window=NULL;
591 } 591 }
592 592
593 if (event!=NULL) 593 if (event!=NULL)
594 { 594 {
595 free(event); 595 SDL_free(event);
596 event=NULL; 596 event=NULL;
597 } 597 }
598 } 598 }
599 599
600 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) 600 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)