Mercurial > sdl-ios-xcode
comparison src/cdrom/osf/SDL_syscdrom.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 | e3b3130f3af8 |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 /* Add this drive to our list */ | 126 /* Add this drive to our list */ |
127 i = SDL_numcds; | 127 i = SDL_numcds; |
128 SDL_cdlist[i] = (char *)malloc(strlen(drive)+1); | 128 SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1); |
129 if ( SDL_cdlist[i] == NULL ) { | 129 if ( SDL_cdlist[i] == NULL ) { |
130 SDL_OutOfMemory(); | 130 SDL_OutOfMemory(); |
131 return; | 131 return; |
132 } | 132 } |
133 | 133 |
134 strcpy(SDL_cdlist[i], drive); | 134 SDL_strcpy(SDL_cdlist[i], drive); |
135 SDL_cdmode[i] = stbuf->st_rdev; | 135 SDL_cdmode[i] = stbuf->st_rdev; |
136 ++SDL_numcds; | 136 ++SDL_numcds; |
137 #ifdef DEBUG_CDROM | 137 #ifdef DEBUG_CDROM |
138 fprintf(stderr, "Added CD-ROM drive: %s\n", drive); | 138 fprintf(stderr, "Added CD-ROM drive: %s\n", drive); |
139 #endif | 139 #endif |
175 SDL_CDcaps.Eject = SDL_SYS_CDEject; | 175 SDL_CDcaps.Eject = SDL_SYS_CDEject; |
176 SDL_CDcaps.Close = SDL_SYS_CDClose; | 176 SDL_CDcaps.Close = SDL_SYS_CDClose; |
177 | 177 |
178 | 178 |
179 /* Look in the environment for our CD-ROM drive list */ | 179 /* Look in the environment for our CD-ROM drive list */ |
180 SDLcdrom = getenv("SDL_CDROM"); /* ':' separated list of devices */ | 180 SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */ |
181 if ( SDLcdrom != NULL ) { | 181 if ( SDLcdrom != NULL ) { |
182 char *cdpath, *delim; | 182 char *cdpath, *delim; |
183 cdpath = malloc(strlen(SDLcdrom)+1); | 183 cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1); |
184 if ( cdpath != NULL ) { | 184 if ( cdpath != NULL ) { |
185 strcpy(cdpath, SDLcdrom); | 185 SDL_strcpy(cdpath, SDLcdrom); |
186 SDLcdrom = cdpath; | 186 SDLcdrom = cdpath; |
187 do { | 187 do { |
188 delim = strchr(SDLcdrom, ':'); | 188 delim = SDL_strchr(SDLcdrom, ':'); |
189 if ( delim ) { | 189 if ( delim ) { |
190 *delim++ = '\0'; | 190 *delim++ = '\0'; |
191 } | 191 } |
192 if ( CheckDrive(SDLcdrom, &stbuf) > 0 ) { | 192 if ( CheckDrive(SDLcdrom, &stbuf) > 0 ) { |
193 AddDrive(SDLcdrom, &stbuf); | 193 AddDrive(SDLcdrom, &stbuf); |
196 SDLcdrom = delim; | 196 SDLcdrom = delim; |
197 } else { | 197 } else { |
198 SDLcdrom = NULL; | 198 SDLcdrom = NULL; |
199 } | 199 } |
200 } while ( SDLcdrom ); | 200 } while ( SDLcdrom ); |
201 free(cdpath); | 201 SDL_free(cdpath); |
202 } | 202 } |
203 | 203 |
204 /* If we found our drives, there's nothing left to do */ | 204 /* If we found our drives, there's nothing left to do */ |
205 if ( SDL_numcds > 0 ) { | 205 if ( SDL_numcds > 0 ) { |
206 return(0); | 206 return(0); |
212 struct dirent *devent; | 212 struct dirent *devent; |
213 int name_len; | 213 int name_len; |
214 | 214 |
215 devdir = opendir(checklist[i].dir); | 215 devdir = opendir(checklist[i].dir); |
216 if (devdir) { | 216 if (devdir) { |
217 name_len = strlen(checklist[i].name); | 217 name_len = SDL_strlen(checklist[i].name); |
218 while (devent = readdir(devdir)) | 218 while (devent = readdir(devdir)) |
219 if (memcmp(checklist[i].name, devent->d_name, name_len) == 0) | 219 if (SDL_memcmp(checklist[i].name, devent->d_name, name_len) == 0) |
220 if (devent->d_name[devent->d_namlen-1] == 'c') { | 220 if (devent->d_name[devent->d_namlen-1] == 'c') { |
221 sprintf(drive, "%s/%s", checklist[i].dir, devent->d_name); | 221 sprintf(drive, "%s/%s", checklist[i].dir, devent->d_name); |
222 #ifdef DEBUG_CDROM | 222 #ifdef DEBUG_CDROM |
223 fprintf(stderr, "Try to add drive: %s\n", drive); | 223 fprintf(stderr, "Try to add drive: %s\n", drive); |
224 #endif | 224 #endif |
232 #endif | 232 #endif |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 /* | 236 /* |
237 SDLcdrom=malloc(sizeof(char) * 32); | 237 SDLcdrom=SDL_malloc(sizeof(char) * 32); |
238 strcpy(SDLcdrom,"/dev/rdisk/cdrom0c"); | 238 SDL_strcpy(SDLcdrom,"/dev/rdisk/cdrom0c"); |
239 SDL_cdlist[0] = SDLcdrom; | 239 SDL_cdlist[0] = SDLcdrom; |
240 stat(SDLcdrom, &stbuf); | 240 stat(SDLcdrom, &stbuf); |
241 SDL_cdmode[0] = stbuf.st_rdev; | 241 SDL_cdmode[0] = stbuf.st_rdev; |
242 SDL_numcds = 1; | 242 SDL_numcds = 1; |
243 */ | 243 */ |
447 { | 447 { |
448 int i; | 448 int i; |
449 | 449 |
450 if ( SDL_numcds > 0 ) { | 450 if ( SDL_numcds > 0 ) { |
451 for ( i=0; i<SDL_numcds; ++i ) { | 451 for ( i=0; i<SDL_numcds; ++i ) { |
452 free(SDL_cdlist[i]); | 452 SDL_free(SDL_cdlist[i]); |
453 } | 453 } |
454 SDL_numcds = 0; | 454 SDL_numcds = 0; |
455 } | 455 } |
456 } | 456 } |
457 | 457 |