Mercurial > sdl-ios-xcode
comparison src/video/aalib/SDL_aavideo.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 | 2a2f31cc4c8b |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
68 return 1; /* Always available ! */ | 68 return 1; /* Always available ! */ |
69 } | 69 } |
70 | 70 |
71 static void AA_DeleteDevice(SDL_VideoDevice *device) | 71 static void AA_DeleteDevice(SDL_VideoDevice *device) |
72 { | 72 { |
73 free(device->hidden); | 73 SDL_free(device->hidden); |
74 free(device); | 74 SDL_free(device); |
75 } | 75 } |
76 | 76 |
77 static SDL_VideoDevice *AA_CreateDevice(int devindex) | 77 static SDL_VideoDevice *AA_CreateDevice(int devindex) |
78 { | 78 { |
79 SDL_VideoDevice *device; | 79 SDL_VideoDevice *device; |
80 | 80 |
81 /* Initialize all variables that we clean on shutdown */ | 81 /* Initialize all variables that we clean on shutdown */ |
82 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); | 82 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); |
83 if ( device ) { | 83 if ( device ) { |
84 memset(device, 0, (sizeof *device)); | 84 SDL_memset(device, 0, (sizeof *device)); |
85 device->hidden = (struct SDL_PrivateVideoData *) | 85 device->hidden = (struct SDL_PrivateVideoData *) |
86 malloc((sizeof *device->hidden)); | 86 SDL_malloc((sizeof *device->hidden)); |
87 } | 87 } |
88 if ( (device == NULL) || (device->hidden == NULL) ) { | 88 if ( (device == NULL) || (device->hidden == NULL) ) { |
89 SDL_OutOfMemory(); | 89 SDL_OutOfMemory(); |
90 if ( device ) { | 90 if ( device ) { |
91 free(device); | 91 SDL_free(device); |
92 } | 92 } |
93 return(0); | 93 return(0); |
94 } | 94 } |
95 memset(device->hidden, 0, (sizeof *device->hidden)); | 95 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); |
96 | 96 |
97 /* Set the function pointers */ | 97 /* Set the function pointers */ |
98 device->VideoInit = AA_VideoInit; | 98 device->VideoInit = AA_VideoInit; |
99 device->ListModes = AA_ListModes; | 99 device->ListModes = AA_ListModes; |
100 device->SetVideoMode = AA_SetVideoMode; | 100 device->SetVideoMode = AA_SetVideoMode; |
136 int keyboard; | 136 int keyboard; |
137 int i; | 137 int i; |
138 | 138 |
139 /* Initialize all variables that we clean on shutdown */ | 139 /* Initialize all variables that we clean on shutdown */ |
140 for ( i=0; i<SDL_NUMMODES; ++i ) { | 140 for ( i=0; i<SDL_NUMMODES; ++i ) { |
141 SDL_modelist[i] = malloc(sizeof(SDL_Rect)); | 141 SDL_modelist[i] = SDL_malloc(sizeof(SDL_Rect)); |
142 SDL_modelist[i]->x = SDL_modelist[i]->y = 0; | 142 SDL_modelist[i]->x = SDL_modelist[i]->y = 0; |
143 } | 143 } |
144 /* Modes sorted largest to smallest */ | 144 /* Modes sorted largest to smallest */ |
145 SDL_modelist[0]->w = 1024; SDL_modelist[0]->h = 768; | 145 SDL_modelist[0]->w = 1024; SDL_modelist[0]->h = 768; |
146 SDL_modelist[1]->w = 800; SDL_modelist[1]->h = 600; | 146 SDL_modelist[1]->w = 800; SDL_modelist[1]->h = 600; |
177 | 177 |
178 aa_resizehandler(AA_context, AA_ResizeHandler); | 178 aa_resizehandler(AA_context, AA_ResizeHandler); |
179 | 179 |
180 fprintf(stderr,"Using AAlib driver: %s (%s)\n", AA_context->driver->name, AA_context->driver->shortname); | 180 fprintf(stderr,"Using AAlib driver: %s (%s)\n", AA_context->driver->name, AA_context->driver->shortname); |
181 | 181 |
182 AA_in_x11 = (strcmp(AA_context->driver->shortname,"X11") == 0); | 182 AA_in_x11 = (SDL_strcmp(AA_context->driver->shortname,"X11") == 0); |
183 /* Determine the screen depth (use default 8-bit depth) */ | 183 /* Determine the screen depth (use default 8-bit depth) */ |
184 vformat->BitsPerPixel = 8; | 184 vformat->BitsPerPixel = 8; |
185 vformat->BytesPerPixel = 1; | 185 vformat->BytesPerPixel = 1; |
186 | 186 |
187 /* We're done! */ | 187 /* We're done! */ |
250 int width, int height, int bpp, Uint32 flags) | 250 int width, int height, int bpp, Uint32 flags) |
251 { | 251 { |
252 int mode; | 252 int mode; |
253 | 253 |
254 if ( AA_buffer ) { | 254 if ( AA_buffer ) { |
255 free( AA_buffer ); | 255 SDL_free( AA_buffer ); |
256 } | 256 } |
257 | 257 |
258 AA_buffer = malloc(width * height); | 258 AA_buffer = SDL_malloc(width * height); |
259 if ( ! AA_buffer ) { | 259 if ( ! AA_buffer ) { |
260 SDL_SetError("Couldn't allocate buffer for requested mode"); | 260 SDL_SetError("Couldn't allocate buffer for requested mode"); |
261 return(NULL); | 261 return(NULL); |
262 } | 262 } |
263 | 263 |
264 /* printf("Setting mode %dx%d\n", width, height); */ | 264 /* printf("Setting mode %dx%d\n", width, height); */ |
265 | 265 |
266 memset(aa_image(AA_context), 0, aa_imgwidth(AA_context) * aa_imgheight(AA_context)); | 266 SDL_memset(aa_image(AA_context), 0, aa_imgwidth(AA_context) * aa_imgheight(AA_context)); |
267 memset(AA_buffer, 0, width * height); | 267 SDL_memset(AA_buffer, 0, width * height); |
268 | 268 |
269 /* Allocate the new pixel format for the screen */ | 269 /* Allocate the new pixel format for the screen */ |
270 if ( ! SDL_ReallocFormat(current, 8, 0, 0, 0, 0) ) { | 270 if ( ! SDL_ReallocFormat(current, 8, 0, 0, 0, 0) ) { |
271 return(NULL); | 271 return(NULL); |
272 } | 272 } |
377 aa_uninitmouse(AA_context); | 377 aa_uninitmouse(AA_context); |
378 | 378 |
379 /* Free video mode lists */ | 379 /* Free video mode lists */ |
380 for ( i=0; i<SDL_NUMMODES; ++i ) { | 380 for ( i=0; i<SDL_NUMMODES; ++i ) { |
381 if ( SDL_modelist[i] != NULL ) { | 381 if ( SDL_modelist[i] != NULL ) { |
382 free(SDL_modelist[i]); | 382 SDL_free(SDL_modelist[i]); |
383 SDL_modelist[i] = NULL; | 383 SDL_modelist[i] = NULL; |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 aa_close(AA_context); | 387 aa_close(AA_context); |