Mercurial > sdl-ios-xcode
comparison src/cdrom/freebsd/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 | c9b51268668f |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 /* Add this drive to our list */ | 115 /* Add this drive to our list */ |
116 i = SDL_numcds; | 116 i = SDL_numcds; |
117 SDL_cdlist[i] = (char *)malloc(strlen(drive)+1); | 117 SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1); |
118 if ( SDL_cdlist[i] == NULL ) { | 118 if ( SDL_cdlist[i] == NULL ) { |
119 SDL_OutOfMemory(); | 119 SDL_OutOfMemory(); |
120 return; | 120 return; |
121 } | 121 } |
122 strcpy(SDL_cdlist[i], drive); | 122 SDL_strcpy(SDL_cdlist[i], drive); |
123 SDL_cdmode[i] = stbuf->st_rdev; | 123 SDL_cdmode[i] = stbuf->st_rdev; |
124 ++SDL_numcds; | 124 ++SDL_numcds; |
125 #ifdef DEBUG_CDROM | 125 #ifdef DEBUG_CDROM |
126 fprintf(stderr, "Added CD-ROM drive: %s\n", drive); | 126 fprintf(stderr, "Added CD-ROM drive: %s\n", drive); |
127 #endif | 127 #endif |
151 SDL_CDcaps.Stop = SDL_SYS_CDStop; | 151 SDL_CDcaps.Stop = SDL_SYS_CDStop; |
152 SDL_CDcaps.Eject = SDL_SYS_CDEject; | 152 SDL_CDcaps.Eject = SDL_SYS_CDEject; |
153 SDL_CDcaps.Close = SDL_SYS_CDClose; | 153 SDL_CDcaps.Close = SDL_SYS_CDClose; |
154 | 154 |
155 /* Look in the environment for our CD-ROM drive list */ | 155 /* Look in the environment for our CD-ROM drive list */ |
156 SDLcdrom = getenv("SDL_CDROM"); /* ':' separated list of devices */ | 156 SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */ |
157 if ( SDLcdrom != NULL ) { | 157 if ( SDLcdrom != NULL ) { |
158 char *cdpath, *delim; | 158 char *cdpath, *delim; |
159 cdpath = malloc(strlen(SDLcdrom)+1); | 159 cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1); |
160 if ( cdpath != NULL ) { | 160 if ( cdpath != NULL ) { |
161 strcpy(cdpath, SDLcdrom); | 161 SDL_strcpy(cdpath, SDLcdrom); |
162 SDLcdrom = cdpath; | 162 SDLcdrom = cdpath; |
163 do { | 163 do { |
164 delim = strchr(SDLcdrom, ':'); | 164 delim = SDL_strchr(SDLcdrom, ':'); |
165 if ( delim ) { | 165 if ( delim ) { |
166 *delim++ = '\0'; | 166 *delim++ = '\0'; |
167 } | 167 } |
168 if ( CheckDrive(SDLcdrom, &stbuf) > 0 ) { | 168 if ( CheckDrive(SDLcdrom, &stbuf) > 0 ) { |
169 AddDrive(SDLcdrom, &stbuf); | 169 AddDrive(SDLcdrom, &stbuf); |
172 SDLcdrom = delim; | 172 SDLcdrom = delim; |
173 } else { | 173 } else { |
174 SDLcdrom = NULL; | 174 SDLcdrom = NULL; |
175 } | 175 } |
176 } while ( SDLcdrom ); | 176 } while ( SDLcdrom ); |
177 free(cdpath); | 177 SDL_free(cdpath); |
178 } | 178 } |
179 | 179 |
180 /* If we found our drives, there's nothing left to do */ | 180 /* If we found our drives, there's nothing left to do */ |
181 if ( SDL_numcds > 0 ) { | 181 if ( SDL_numcds > 0 ) { |
182 return(0); | 182 return(0); |
188 if ( checklist[i][0] == '?' ) { | 188 if ( checklist[i][0] == '?' ) { |
189 char *insert; | 189 char *insert; |
190 exists = 1; | 190 exists = 1; |
191 for ( j=checklist[i][1]; exists; ++j ) { | 191 for ( j=checklist[i][1]; exists; ++j ) { |
192 sprintf(drive, "/dev/%sc", &checklist[i][3]); | 192 sprintf(drive, "/dev/%sc", &checklist[i][3]); |
193 insert = strchr(drive, '?'); | 193 insert = SDL_strchr(drive, '?'); |
194 if ( insert != NULL ) { | 194 if ( insert != NULL ) { |
195 *insert = j; | 195 *insert = j; |
196 } | 196 } |
197 switch (CheckDrive(drive, &stbuf)) { | 197 switch (CheckDrive(drive, &stbuf)) { |
198 /* Drive exists and is a CD-ROM */ | 198 /* Drive exists and is a CD-ROM */ |
396 { | 396 { |
397 int i; | 397 int i; |
398 | 398 |
399 if ( SDL_numcds > 0 ) { | 399 if ( SDL_numcds > 0 ) { |
400 for ( i=0; i<SDL_numcds; ++i ) { | 400 for ( i=0; i<SDL_numcds; ++i ) { |
401 free(SDL_cdlist[i]); | 401 SDL_free(SDL_cdlist[i]); |
402 } | 402 } |
403 SDL_numcds = 0; | 403 SDL_numcds = 0; |
404 } | 404 } |
405 } | 405 } |
406 | 406 |