comparison src/video/qtopia/SDL_sysvideo.cc @ 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
80 return(1); 80 return(1);
81 } 81 }
82 82
83 static void QT_DeleteDevice(SDL_VideoDevice *device) 83 static void QT_DeleteDevice(SDL_VideoDevice *device)
84 { 84 {
85 free(device->hidden); 85 SDL_free(device->hidden);
86 free(device); 86 SDL_free(device);
87 } 87 }
88 88
89 static SDL_VideoDevice *QT_CreateDevice(int devindex) 89 static SDL_VideoDevice *QT_CreateDevice(int devindex)
90 { 90 {
91 SDL_VideoDevice *device; 91 SDL_VideoDevice *device;
92 92
93 /* Initialize all variables that we clean on shutdown */ 93 /* Initialize all variables that we clean on shutdown */
94 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 94 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
95 if ( device ) { 95 if ( device ) {
96 memset(device, 0, (sizeof *device)); 96 SDL_memset(device, 0, (sizeof *device));
97 device->hidden = (struct SDL_PrivateVideoData *) 97 device->hidden = (struct SDL_PrivateVideoData *)
98 malloc((sizeof *device->hidden)); 98 SDL_malloc((sizeof *device->hidden));
99 } 99 }
100 if ( (device == NULL) || (device->hidden == NULL) ) { 100 if ( (device == NULL) || (device->hidden == NULL) ) {
101 SDL_OutOfMemory(); 101 SDL_OutOfMemory();
102 if ( device ) { 102 if ( device ) {
103 free(device); 103 SDL_free(device);
104 } 104 }
105 return(0); 105 return(0);
106 } 106 }
107 memset(device->hidden, 0, (sizeof *device->hidden)); 107 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
108 108
109 /* Set the function pointers */ 109 /* Set the function pointers */
110 device->VideoInit = QT_VideoInit; 110 device->VideoInit = QT_VideoInit;
111 device->ListModes = QT_ListModes; 111 device->ListModes = QT_ListModes;
112 device->SetVideoMode = QT_SetVideoMode; 112 device->SetVideoMode = QT_SetVideoMode;
183 } 183 }
184 } 184 }
185 } 185 }
186 186
187 /* Set up the new video mode rectangle */ 187 /* Set up the new video mode rectangle */
188 mode = (SDL_Rect *)malloc(sizeof *mode); 188 mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
189 if ( mode == NULL ) { 189 if ( mode == NULL ) {
190 SDL_OutOfMemory(); 190 SDL_OutOfMemory();
191 return(-1); 191 return(-1);
192 } 192 }
193 mode->x = 0; 193 mode->x = 0;
199 #endif 199 #endif
200 200
201 /* Allocate the new list of modes, and fill in the new mode */ 201 /* Allocate the new list of modes, and fill in the new mode */
202 next_mode = SDL_nummodes[index]; 202 next_mode = SDL_nummodes[index];
203 SDL_modelist[index] = (SDL_Rect **) 203 SDL_modelist[index] = (SDL_Rect **)
204 realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *)); 204 SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
205 if ( SDL_modelist[index] == NULL ) { 205 if ( SDL_modelist[index] == NULL ) {
206 SDL_OutOfMemory(); 206 SDL_OutOfMemory();
207 SDL_nummodes[index] = 0; 207 SDL_nummodes[index] = 0;
208 free(mode); 208 SDL_free(mode);
209 return(-1); 209 return(-1);
210 } 210 }
211 SDL_modelist[index][next_mode] = mode; 211 SDL_modelist[index][next_mode] = mode;
212 SDL_modelist[index][next_mode+1] = NULL; 212 SDL_modelist[index][next_mode+1] = NULL;
213 SDL_nummodes[index]++; 213 SDL_nummodes[index]++;
286 && height <= desktop_size.height()) { 286 && height <= desktop_size.height()) {
287 current->w = desktop_size.width(); 287 current->w = desktop_size.width();
288 current->h = desktop_size.height(); 288 current->h = desktop_size.height();
289 } else if(width <= desktop_size.height() && height <= desktop_size.width()) { 289 } else if(width <= desktop_size.height() && height <= desktop_size.width()) {
290 // Landscape mode 290 // Landscape mode
291 char * envString = getenv(SDL_QT_ROTATION_ENV_NAME); 291 char * envString = SDL_getenv(SDL_QT_ROTATION_ENV_NAME);
292 int envValue = envString ? atoi(envString) : 0; 292 int envValue = envString ? atoi(envString) : 0;
293 screenRotation = envValue ? SDL_QT_ROTATION_270 : SDL_QT_ROTATION_90; 293 screenRotation = envValue ? SDL_QT_ROTATION_270 : SDL_QT_ROTATION_90;
294 current->h = desktop_size.width(); 294 current->h = desktop_size.width();
295 current->w = desktop_size.height(); 295 current->w = desktop_size.height();
296 } else { 296 } else {