comparison src/cdrom/qnx/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
126 } 126 }
127 127
128 /* Add this drive to our list */ 128 /* Add this drive to our list */
129 129
130 i = SDL_numcds; 130 i = SDL_numcds;
131 SDL_cdlist[i] = (char *)malloc(strlen(drive)+1); 131 SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1);
132 if (SDL_cdlist[i] == NULL) 132 if (SDL_cdlist[i] == NULL)
133 { 133 {
134 SDL_OutOfMemory(); 134 SDL_OutOfMemory();
135 return; 135 return;
136 } 136 }
137 strcpy(SDL_cdlist[i], drive); 137 SDL_strcpy(SDL_cdlist[i], drive);
138 SDL_cdmode[i] = stbuf->st_rdev; 138 SDL_cdmode[i] = stbuf->st_rdev;
139 ++SDL_numcds; 139 ++SDL_numcds;
140 } 140 }
141 } 141 }
142 142
167 { 167 {
168 SDL_cdopen[i]=0; 168 SDL_cdopen[i]=0;
169 } 169 }
170 170
171 /* Look in the environment for our CD-ROM drive list */ 171 /* Look in the environment for our CD-ROM drive list */
172 SDLcdrom = getenv("SDL_CDROM"); /* ':' separated list of devices */ 172 SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */
173 if ( SDLcdrom != NULL ) 173 if ( SDLcdrom != NULL )
174 { 174 {
175 char *cdpath, *delim; 175 char *cdpath, *delim;
176 176
177 cdpath = malloc(strlen(SDLcdrom)+1); 177 cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1);
178 if (cdpath != NULL) 178 if (cdpath != NULL)
179 { 179 {
180 strcpy(cdpath, SDLcdrom); 180 SDL_strcpy(cdpath, SDLcdrom);
181 SDLcdrom = cdpath; 181 SDLcdrom = cdpath;
182 do { 182 do {
183 delim = strchr(SDLcdrom, ':'); 183 delim = SDL_strchr(SDLcdrom, ':');
184 if (delim) 184 if (delim)
185 { 185 {
186 *delim++ = '\0'; 186 *delim++ = '\0';
187 } 187 }
188 if (CheckDrive(SDLcdrom, &stbuf) > 0) 188 if (CheckDrive(SDLcdrom, &stbuf) > 0)
196 else 196 else
197 { 197 {
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 { 206 {
217 exists = 1; 217 exists = 1;
218 218
219 for ( j=checklist[i][1]; exists; ++j ) 219 for ( j=checklist[i][1]; exists; ++j )
220 { 220 {
221 sprintf(drive, "/dev/%s", &checklist[i][3]); 221 sprintf(drive, "/dev/%s", &checklist[i][3]);
222 insert = strchr(drive, '?'); 222 insert = SDL_strchr(drive, '?');
223 if (insert != NULL) 223 if (insert != NULL)
224 { 224 {
225 *insert = j; 225 *insert = j;
226 } 226 }
227 switch (CheckDrive(drive, &stbuf)) 227 switch (CheckDrive(drive, &stbuf))
344 } 344 }
345 } 345 }
346 346
347 /* if media exists, then do other stuff */ 347 /* if media exists, then do other stuff */
348 348
349 memset(&info, 0x00, sizeof(info)); 349 SDL_memset(&info, 0x00, sizeof(info));
350 info.subch_command.data_format = CDROM_SUBCH_CURRENT_POSITION; 350 info.subch_command.data_format = CDROM_SUBCH_CURRENT_POSITION;
351 351
352 do { 352 do {
353 devctlret=devctl(cdrom->id, DCMD_CAM_CDROMSUBCHNL, &info, sizeof(info), NULL); 353 devctlret=devctl(cdrom->id, DCMD_CAM_CDROMSUBCHNL, &info, sizeof(info), NULL);
354 if (devctlret==EIO) 354 if (devctlret==EIO)
542 542
543 if (SDL_numcds > 0) 543 if (SDL_numcds > 0)
544 { 544 {
545 for (i=0; i<SDL_numcds; ++i) 545 for (i=0; i<SDL_numcds; ++i)
546 { 546 {
547 free(SDL_cdlist[i]); 547 SDL_free(SDL_cdlist[i]);
548 } 548 }
549 SDL_numcds = 0; 549 SDL_numcds = 0;
550 } 550 }
551 } 551 }