Mercurial > sdl-ios-xcode
comparison src/video/dummy/SDL_nullvideo.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 |
---|---|
71 | 71 |
72 /* DUMMY driver bootstrap functions */ | 72 /* DUMMY driver bootstrap functions */ |
73 | 73 |
74 static int DUMMY_Available(void) | 74 static int DUMMY_Available(void) |
75 { | 75 { |
76 const char *envr = getenv("SDL_VIDEODRIVER"); | 76 const char *envr = SDL_getenv("SDL_VIDEODRIVER"); |
77 if ((envr) && (strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { | 77 if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { |
78 return(1); | 78 return(1); |
79 } | 79 } |
80 | 80 |
81 return(0); | 81 return(0); |
82 } | 82 } |
83 | 83 |
84 static void DUMMY_DeleteDevice(SDL_VideoDevice *device) | 84 static void DUMMY_DeleteDevice(SDL_VideoDevice *device) |
85 { | 85 { |
86 free(device->hidden); | 86 SDL_free(device->hidden); |
87 free(device); | 87 SDL_free(device); |
88 } | 88 } |
89 | 89 |
90 static SDL_VideoDevice *DUMMY_CreateDevice(int devindex) | 90 static SDL_VideoDevice *DUMMY_CreateDevice(int devindex) |
91 { | 91 { |
92 SDL_VideoDevice *device; | 92 SDL_VideoDevice *device; |
93 | 93 |
94 /* Initialize all variables that we clean on shutdown */ | 94 /* Initialize all variables that we clean on shutdown */ |
95 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); | 95 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); |
96 if ( device ) { | 96 if ( device ) { |
97 memset(device, 0, (sizeof *device)); | 97 SDL_memset(device, 0, (sizeof *device)); |
98 device->hidden = (struct SDL_PrivateVideoData *) | 98 device->hidden = (struct SDL_PrivateVideoData *) |
99 malloc((sizeof *device->hidden)); | 99 SDL_malloc((sizeof *device->hidden)); |
100 } | 100 } |
101 if ( (device == NULL) || (device->hidden == NULL) ) { | 101 if ( (device == NULL) || (device->hidden == NULL) ) { |
102 SDL_OutOfMemory(); | 102 SDL_OutOfMemory(); |
103 if ( device ) { | 103 if ( device ) { |
104 free(device); | 104 SDL_free(device); |
105 } | 105 } |
106 return(0); | 106 return(0); |
107 } | 107 } |
108 memset(device->hidden, 0, (sizeof *device->hidden)); | 108 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); |
109 | 109 |
110 /* Set the function pointers */ | 110 /* Set the function pointers */ |
111 device->VideoInit = DUMMY_VideoInit; | 111 device->VideoInit = DUMMY_VideoInit; |
112 device->ListModes = DUMMY_ListModes; | 112 device->ListModes = DUMMY_ListModes; |
113 device->SetVideoMode = DUMMY_SetVideoMode; | 113 device->SetVideoMode = DUMMY_SetVideoMode; |
163 | 163 |
164 SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, | 164 SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, |
165 int width, int height, int bpp, Uint32 flags) | 165 int width, int height, int bpp, Uint32 flags) |
166 { | 166 { |
167 if ( this->hidden->buffer ) { | 167 if ( this->hidden->buffer ) { |
168 free( this->hidden->buffer ); | 168 SDL_free( this->hidden->buffer ); |
169 } | 169 } |
170 | 170 |
171 this->hidden->buffer = malloc(width * height * (bpp / 8)); | 171 this->hidden->buffer = SDL_malloc(width * height * (bpp / 8)); |
172 if ( ! this->hidden->buffer ) { | 172 if ( ! this->hidden->buffer ) { |
173 SDL_SetError("Couldn't allocate buffer for requested mode"); | 173 SDL_SetError("Couldn't allocate buffer for requested mode"); |
174 return(NULL); | 174 return(NULL); |
175 } | 175 } |
176 | 176 |
177 /* printf("Setting mode %dx%d\n", width, height); */ | 177 /* printf("Setting mode %dx%d\n", width, height); */ |
178 | 178 |
179 memset(this->hidden->buffer, 0, width * height * (bpp / 8)); | 179 SDL_memset(this->hidden->buffer, 0, width * height * (bpp / 8)); |
180 | 180 |
181 /* Allocate the new pixel format for the screen */ | 181 /* Allocate the new pixel format for the screen */ |
182 if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) { | 182 if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) { |
183 free(this->hidden->buffer); | 183 SDL_free(this->hidden->buffer); |
184 this->hidden->buffer = NULL; | 184 this->hidden->buffer = NULL; |
185 SDL_SetError("Couldn't allocate new pixel format for requested mode"); | 185 SDL_SetError("Couldn't allocate new pixel format for requested mode"); |
186 return(NULL); | 186 return(NULL); |
187 } | 187 } |
188 | 188 |
234 */ | 234 */ |
235 void DUMMY_VideoQuit(_THIS) | 235 void DUMMY_VideoQuit(_THIS) |
236 { | 236 { |
237 if (this->screen->pixels != NULL) | 237 if (this->screen->pixels != NULL) |
238 { | 238 { |
239 free(this->screen->pixels); | 239 SDL_free(this->screen->pixels); |
240 this->screen->pixels = NULL; | 240 this->screen->pixels = NULL; |
241 } | 241 } |
242 } | 242 } |