Mercurial > sdl-ios-xcode
comparison src/cdrom/qnx/SDL_syscdrom.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
47 static char *SDL_cdlist[MAX_DRIVES]; | 47 static char *SDL_cdlist[MAX_DRIVES]; |
48 static dev_t SDL_cdmode[MAX_DRIVES]; | 48 static dev_t SDL_cdmode[MAX_DRIVES]; |
49 static int SDL_cdopen[MAX_DRIVES]; | 49 static int SDL_cdopen[MAX_DRIVES]; |
50 | 50 |
51 /* The system-dependent CD control functions */ | 51 /* The system-dependent CD control functions */ |
52 static const char *SDL_SYS_CDName (int drive); | 52 static const char *SDL_SYS_CDName(int drive); |
53 static int SDL_SYS_CDOpen (int drive); | 53 static int SDL_SYS_CDOpen(int drive); |
54 static int SDL_SYS_CDGetTOC (SDL_CD * cdrom); | 54 static int SDL_SYS_CDGetTOC(SDL_CD * cdrom); |
55 static CDstatus SDL_SYS_CDStatus (SDL_CD * cdrom, int *position); | 55 static CDstatus SDL_SYS_CDStatus(SDL_CD * cdrom, int *position); |
56 static int SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length); | 56 static int SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length); |
57 static int SDL_SYS_CDPause (SDL_CD * cdrom); | 57 static int SDL_SYS_CDPause(SDL_CD * cdrom); |
58 static int SDL_SYS_CDResume (SDL_CD * cdrom); | 58 static int SDL_SYS_CDResume(SDL_CD * cdrom); |
59 static int SDL_SYS_CDStop (SDL_CD * cdrom); | 59 static int SDL_SYS_CDStop(SDL_CD * cdrom); |
60 static int SDL_SYS_CDEject (SDL_CD * cdrom); | 60 static int SDL_SYS_CDEject(SDL_CD * cdrom); |
61 static void SDL_SYS_CDClose (SDL_CD * cdrom); | 61 static void SDL_SYS_CDClose(SDL_CD * cdrom); |
62 | 62 |
63 /* Check a drive to see if it is a CD-ROM */ | 63 /* Check a drive to see if it is a CD-ROM */ |
64 static int | 64 static int |
65 CheckDrive (char *drive, struct stat *stbuf) | 65 CheckDrive(char *drive, struct stat *stbuf) |
66 { | 66 { |
67 int is_cd, cdfd; | 67 int is_cd, cdfd; |
68 cam_devinfo_t dinfo; | 68 cam_devinfo_t dinfo; |
69 int devctlret = 0; | 69 int devctlret = 0; |
70 | 70 |
71 int atapi; | 71 int atapi; |
72 int removable; | 72 int removable; |
73 int cdb10; | 73 int cdb10; |
74 | 74 |
75 /* If it doesn't exist, return -1 */ | 75 /* If it doesn't exist, return -1 */ |
76 if (stat (drive, stbuf) < 0) { | 76 if (stat(drive, stbuf) < 0) { |
77 return (-1); | 77 return (-1); |
78 } | 78 } |
79 | 79 |
80 /* If it does exist, verify that it's an available CD-ROM */ | 80 /* If it does exist, verify that it's an available CD-ROM */ |
81 is_cd = 0; | 81 is_cd = 0; |
82 | 82 |
83 if (S_ISCHR (stbuf->st_mode) || S_ISBLK (stbuf->st_mode)) { | 83 if (S_ISCHR(stbuf->st_mode) || S_ISBLK(stbuf->st_mode)) { |
84 cdfd = open (drive, QNX_CD_OPENMODE); | 84 cdfd = open(drive, QNX_CD_OPENMODE); |
85 if (cdfd >= 0) { | 85 if (cdfd >= 0) { |
86 devctlret = | 86 devctlret = |
87 devctl (cdfd, DCMD_CAM_DEVINFO, &dinfo, | 87 devctl(cdfd, DCMD_CAM_DEVINFO, &dinfo, |
88 sizeof (cam_devinfo_t), NULL); | 88 sizeof(cam_devinfo_t), NULL); |
89 | 89 |
90 if (devctlret == EOK) { | 90 if (devctlret == EOK) { |
91 atapi = dinfo.flags & DEV_ATAPI; | 91 atapi = dinfo.flags & DEV_ATAPI; |
92 removable = dinfo.flags & DEV_REMOVABLE; | 92 removable = dinfo.flags & DEV_REMOVABLE; |
93 cdb10 = dinfo.flags & DEV_CDB_10; /* I'm not sure about that flag */ | 93 cdb10 = dinfo.flags & DEV_CDB_10; /* I'm not sure about that flag */ |
96 if ((atapi) && (removable)) { | 96 if ((atapi) && (removable)) { |
97 is_cd = 1; | 97 is_cd = 1; |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 close (cdfd); | 101 close(cdfd); |
102 } | 102 } |
103 } | 103 } |
104 return (is_cd); | 104 return (is_cd); |
105 } | 105 } |
106 | 106 |
107 /* Add a CD-ROM drive to our list of valid drives */ | 107 /* Add a CD-ROM drive to our list of valid drives */ |
108 static void | 108 static void |
109 AddDrive (char *drive, struct stat *stbuf) | 109 AddDrive(char *drive, struct stat *stbuf) |
110 { | 110 { |
111 int i; | 111 int i; |
112 | 112 |
113 if (SDL_numcds < MAX_DRIVES) { | 113 if (SDL_numcds < MAX_DRIVES) { |
114 /* Check to make sure it's not already in our list. | 114 /* Check to make sure it's not already in our list. |
121 } | 121 } |
122 | 122 |
123 /* Add this drive to our list */ | 123 /* Add this drive to our list */ |
124 | 124 |
125 i = SDL_numcds; | 125 i = SDL_numcds; |
126 SDL_cdlist[i] = SDL_strdup (drive); | 126 SDL_cdlist[i] = SDL_strdup(drive); |
127 if (SDL_cdlist[i] == NULL) { | 127 if (SDL_cdlist[i] == NULL) { |
128 SDL_OutOfMemory (); | 128 SDL_OutOfMemory(); |
129 return; | 129 return; |
130 } | 130 } |
131 SDL_cdmode[i] = stbuf->st_rdev; | 131 SDL_cdmode[i] = stbuf->st_rdev; |
132 ++SDL_numcds; | 132 ++SDL_numcds; |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 int | 136 int |
137 SDL_SYS_CDInit (void) | 137 SDL_SYS_CDInit(void) |
138 { | 138 { |
139 /* checklist: /dev/cdrom, /dev/cd?, /dev/scd? */ | 139 /* checklist: /dev/cdrom, /dev/cd?, /dev/scd? */ |
140 static char *checklist[] = | 140 static char *checklist[] = |
141 { "cdrom", "?0 cd?", "?1 cd?", "?0 scd?", NULL }; | 141 { "cdrom", "?0 cd?", "?1 cd?", "?0 scd?", NULL }; |
142 | 142 |
161 for (i = 0; i < MAX_DRIVES; i++) { | 161 for (i = 0; i < MAX_DRIVES; i++) { |
162 SDL_cdopen[i] = 0; | 162 SDL_cdopen[i] = 0; |
163 } | 163 } |
164 | 164 |
165 /* Look in the environment for our CD-ROM drive list */ | 165 /* Look in the environment for our CD-ROM drive list */ |
166 SDLcdrom = SDL_getenv ("SDL_CDROM"); /* ':' separated list of devices */ | 166 SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */ |
167 if (SDLcdrom != NULL) { | 167 if (SDLcdrom != NULL) { |
168 char *cdpath, *delim; | 168 char *cdpath, *delim; |
169 size_t len = SDL_strlen (SDLcdrom) + 1; | 169 size_t len = SDL_strlen(SDLcdrom) + 1; |
170 cdpath = SDL_stack_alloc (char, len); | 170 cdpath = SDL_stack_alloc(char, len); |
171 if (cdpath != NULL) { | 171 if (cdpath != NULL) { |
172 SDL_strlcpy (cdpath, SDLcdrom, len); | 172 SDL_strlcpy(cdpath, SDLcdrom, len); |
173 SDLcdrom = cdpath; | 173 SDLcdrom = cdpath; |
174 do { | 174 do { |
175 delim = SDL_strchr (SDLcdrom, ':'); | 175 delim = SDL_strchr(SDLcdrom, ':'); |
176 if (delim) { | 176 if (delim) { |
177 *delim++ = '\0'; | 177 *delim++ = '\0'; |
178 } | 178 } |
179 if (CheckDrive (SDLcdrom, &stbuf) > 0) { | 179 if (CheckDrive(SDLcdrom, &stbuf) > 0) { |
180 AddDrive (SDLcdrom, &stbuf); | 180 AddDrive(SDLcdrom, &stbuf); |
181 } | 181 } |
182 if (delim) { | 182 if (delim) { |
183 SDLcdrom = delim; | 183 SDLcdrom = delim; |
184 } else { | 184 } else { |
185 SDLcdrom = NULL; | 185 SDLcdrom = NULL; |
186 } | 186 } |
187 } | 187 } |
188 while (SDLcdrom); | 188 while (SDLcdrom); |
189 SDL_stack_free (cdpath); | 189 SDL_stack_free(cdpath); |
190 } | 190 } |
191 | 191 |
192 /* If we found our drives, there's nothing left to do */ | 192 /* If we found our drives, there's nothing left to do */ |
193 if (SDL_numcds > 0) { | 193 if (SDL_numcds > 0) { |
194 return (0); | 194 return (0); |
200 if (checklist[i][0] == '?') { | 200 if (checklist[i][0] == '?') { |
201 char *insert; | 201 char *insert; |
202 exists = 1; | 202 exists = 1; |
203 | 203 |
204 for (j = checklist[i][1]; exists; ++j) { | 204 for (j = checklist[i][1]; exists; ++j) { |
205 SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%s", | 205 SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", |
206 &checklist[i][3]); | 206 &checklist[i][3]); |
207 insert = SDL_strchr (drive, '?'); | 207 insert = SDL_strchr(drive, '?'); |
208 if (insert != NULL) { | 208 if (insert != NULL) { |
209 *insert = j; | 209 *insert = j; |
210 } | 210 } |
211 switch (CheckDrive (drive, &stbuf)) { | 211 switch (CheckDrive(drive, &stbuf)) { |
212 /* Drive exists and is a CD-ROM */ | 212 /* Drive exists and is a CD-ROM */ |
213 case 1: | 213 case 1: |
214 AddDrive (drive, &stbuf); | 214 AddDrive(drive, &stbuf); |
215 break; | 215 break; |
216 /* Drive exists, but isn't a CD-ROM */ | 216 /* Drive exists, but isn't a CD-ROM */ |
217 case 0: | 217 case 0: |
218 break; | 218 break; |
219 /* Drive doesn't exist */ | 219 /* Drive doesn't exist */ |
221 exists = 0; | 221 exists = 0; |
222 break; | 222 break; |
223 } | 223 } |
224 } | 224 } |
225 } else { | 225 } else { |
226 SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%s", | 226 SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", |
227 checklist[i]); | 227 checklist[i]); |
228 if (CheckDrive (drive, &stbuf) > 0) { | 228 if (CheckDrive(drive, &stbuf) > 0) { |
229 AddDrive (drive, &stbuf); | 229 AddDrive(drive, &stbuf); |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
233 return (0); | 233 return (0); |
234 } | 234 } |
235 | 235 |
236 static const char * | 236 static const char * |
237 SDL_SYS_CDName (int drive) | 237 SDL_SYS_CDName(int drive) |
238 { | 238 { |
239 return (SDL_cdlist[drive]); | 239 return (SDL_cdlist[drive]); |
240 } | 240 } |
241 | 241 |
242 static int | 242 static int |
243 SDL_SYS_CDOpen (int drive) | 243 SDL_SYS_CDOpen(int drive) |
244 { | 244 { |
245 int handle; | 245 int handle; |
246 | 246 |
247 handle = open (SDL_cdlist[drive], QNX_CD_OPENMODE); | 247 handle = open(SDL_cdlist[drive], QNX_CD_OPENMODE); |
248 | 248 |
249 if (handle > 0) { | 249 if (handle > 0) { |
250 SDL_cdopen[drive] = handle; | 250 SDL_cdopen[drive] = handle; |
251 } | 251 } |
252 | 252 |
253 return (handle); | 253 return (handle); |
254 } | 254 } |
255 | 255 |
256 static int | 256 static int |
257 SDL_SYS_CDGetTOC (SDL_CD * cdrom) | 257 SDL_SYS_CDGetTOC(SDL_CD * cdrom) |
258 { | 258 { |
259 cdrom_read_toc_t toc; | 259 cdrom_read_toc_t toc; |
260 int i, okay; | 260 int i, okay; |
261 | 261 |
262 okay = 0; | 262 okay = 0; |
263 if (devctl (cdrom->id, DCMD_CAM_CDROMREADTOC, &toc, sizeof (toc), NULL) == | 263 if (devctl(cdrom->id, DCMD_CAM_CDROMREADTOC, &toc, sizeof(toc), NULL) == |
264 0) { | 264 0) { |
265 cdrom->numtracks = toc.last_track - toc.first_track + 1; | 265 cdrom->numtracks = toc.last_track - toc.first_track + 1; |
266 if (cdrom->numtracks > SDL_MAX_TRACKS) { | 266 if (cdrom->numtracks > SDL_MAX_TRACKS) { |
267 cdrom->numtracks = SDL_MAX_TRACKS; | 267 cdrom->numtracks = SDL_MAX_TRACKS; |
268 } | 268 } |
290 return (okay ? 0 : -1); | 290 return (okay ? 0 : -1); |
291 } | 291 } |
292 | 292 |
293 /* Get CD-ROM status */ | 293 /* Get CD-ROM status */ |
294 static CDstatus | 294 static CDstatus |
295 SDL_SYS_CDStatus (SDL_CD * cdrom, int *position) | 295 SDL_SYS_CDStatus(SDL_CD * cdrom, int *position) |
296 { | 296 { |
297 CDstatus status; | 297 CDstatus status; |
298 | 298 |
299 cdrom_read_toc_t toc; | 299 cdrom_read_toc_t toc; |
300 cdrom_subch_data_t info; | 300 cdrom_subch_data_t info; |
306 int eagaincnt = 0; | 306 int eagaincnt = 0; |
307 | 307 |
308 /* check media presence before read subchannel call, some cdroms can lockups */ | 308 /* check media presence before read subchannel call, some cdroms can lockups */ |
309 /* if no media, while calling read subchannel functions. */ | 309 /* if no media, while calling read subchannel functions. */ |
310 devctlret = | 310 devctlret = |
311 devctl (cdrom->id, DCMD_CAM_DEVINFO, &dinfo, sizeof (cam_devinfo_t), | 311 devctl(cdrom->id, DCMD_CAM_DEVINFO, &dinfo, sizeof(cam_devinfo_t), |
312 NULL); | 312 NULL); |
313 | 313 |
314 if (devctlret == EOK) { | 314 if (devctlret == EOK) { |
315 if ((dinfo.flags & DEV_NO_MEDIA) != 0) { | 315 if ((dinfo.flags & DEV_NO_MEDIA) != 0) { |
316 status = CD_TRAYEMPTY; | 316 status = CD_TRAYEMPTY; |
317 if (position) { | 317 if (position) { |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 /* if media exists, then do other stuff */ | 324 /* if media exists, then do other stuff */ |
325 | 325 |
326 SDL_memset (&info, 0x00, sizeof (info)); | 326 SDL_memset(&info, 0x00, sizeof(info)); |
327 info.subch_command.data_format = CDROM_SUBCH_CURRENT_POSITION; | 327 info.subch_command.data_format = CDROM_SUBCH_CURRENT_POSITION; |
328 | 328 |
329 do { | 329 do { |
330 devctlret = | 330 devctlret = |
331 devctl (cdrom->id, DCMD_CAM_CDROMSUBCHNL, &info, sizeof (info), | 331 devctl(cdrom->id, DCMD_CAM_CDROMSUBCHNL, &info, sizeof(info), |
332 NULL); | 332 NULL); |
333 if (devctlret == EIO) { | 333 if (devctlret == EIO) { |
334 /* big workaround for media change, handle is unusable after that, | 334 /* big workaround for media change, handle is unusable after that, |
335 that bug was found in QNX 6.2, 6.2.1 is not released yet. */ | 335 that bug was found in QNX 6.2, 6.2.1 is not released yet. */ |
336 | 336 |
337 for (i = 0; i < MAX_DRIVES; i++) { | 337 for (i = 0; i < MAX_DRIVES; i++) { |
342 } | 342 } |
343 if (drive == -1) { | 343 if (drive == -1) { |
344 /* that cannot happen, but ... */ | 344 /* that cannot happen, but ... */ |
345 break; | 345 break; |
346 } | 346 } |
347 close (cdrom->id); | 347 close(cdrom->id); |
348 cdrom->id = open (SDL_cdlist[drive], QNX_CD_OPENMODE); | 348 cdrom->id = open(SDL_cdlist[drive], QNX_CD_OPENMODE); |
349 devctlret = EAGAIN; | 349 devctlret = EAGAIN; |
350 } | 350 } |
351 if (devctlret == EAGAIN) { | 351 if (devctlret == EAGAIN) { |
352 eagaincnt++; | 352 eagaincnt++; |
353 } | 353 } |
370 switch (info.current_position.header.audio_status) { | 370 switch (info.current_position.header.audio_status) { |
371 case CDROM_AUDIO_INVALID: | 371 case CDROM_AUDIO_INVALID: |
372 case CDROM_AUDIO_NO_STATUS: | 372 case CDROM_AUDIO_NO_STATUS: |
373 /* Try to determine if there's a CD available */ | 373 /* Try to determine if there's a CD available */ |
374 if (devctl | 374 if (devctl |
375 (cdrom->id, DCMD_CAM_CDROMREADTOC, &toc, sizeof (toc), | 375 (cdrom->id, DCMD_CAM_CDROMREADTOC, &toc, sizeof(toc), |
376 NULL) == 0) | 376 NULL) == 0) |
377 status = CD_STOPPED; | 377 status = CD_STOPPED; |
378 else | 378 else |
379 status = CD_TRAYEMPTY; | 379 status = CD_TRAYEMPTY; |
380 break; | 380 break; |
399 } | 399 } |
400 | 400 |
401 if (position) { | 401 if (position) { |
402 if (status == CD_PLAYING || (status == CD_PAUSED)) { | 402 if (status == CD_PLAYING || (status == CD_PAUSED)) { |
403 *position = | 403 *position = |
404 MSF_TO_FRAMES (info.current_position.addr.msf.minute, | 404 MSF_TO_FRAMES(info.current_position.addr.msf.minute, |
405 info.current_position.addr.msf.second, | 405 info.current_position.addr.msf.second, |
406 info.current_position.addr.msf.frame); | 406 info.current_position.addr.msf.frame); |
407 } else { | 407 } else { |
408 *position = 0; | 408 *position = 0; |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 return (status); | 412 return (status); |
413 } | 413 } |
414 | 414 |
415 /* Start play */ | 415 /* Start play */ |
416 static int | 416 static int |
417 SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length) | 417 SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length) |
418 { | 418 { |
419 cdrom_playmsf_t playtime; | 419 cdrom_playmsf_t playtime; |
420 | 420 |
421 FRAMES_TO_MSF (start, &playtime.start_minute, &playtime.start_second, | 421 FRAMES_TO_MSF(start, &playtime.start_minute, &playtime.start_second, |
422 &playtime.start_frame); | 422 &playtime.start_frame); |
423 FRAMES_TO_MSF (start + length, &playtime.end_minute, &playtime.end_second, | 423 FRAMES_TO_MSF(start + length, &playtime.end_minute, &playtime.end_second, |
424 &playtime.end_frame); | 424 &playtime.end_frame); |
425 | 425 |
426 if (devctl | 426 if (devctl |
427 (cdrom->id, DCMD_CAM_CDROMPLAYMSF, &playtime, sizeof (playtime), | 427 (cdrom->id, DCMD_CAM_CDROMPLAYMSF, &playtime, sizeof(playtime), |
428 NULL) != 0) { | 428 NULL) != 0) { |
429 return -1; | 429 return -1; |
430 } else { | 430 } else { |
431 return 0; | 431 return 0; |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 /* Pause play */ | 435 /* Pause play */ |
436 static int | 436 static int |
437 SDL_SYS_CDPause (SDL_CD * cdrom) | 437 SDL_SYS_CDPause(SDL_CD * cdrom) |
438 { | 438 { |
439 if (devctl (cdrom->id, DCMD_CAM_CDROMPAUSE, NULL, 0, NULL) != 0) { | 439 if (devctl(cdrom->id, DCMD_CAM_CDROMPAUSE, NULL, 0, NULL) != 0) { |
440 return -1; | 440 return -1; |
441 } else { | 441 } else { |
442 return 0; | 442 return 0; |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 /* Resume play */ | 446 /* Resume play */ |
447 static int | 447 static int |
448 SDL_SYS_CDResume (SDL_CD * cdrom) | 448 SDL_SYS_CDResume(SDL_CD * cdrom) |
449 { | 449 { |
450 if (devctl (cdrom->id, DCMD_CAM_CDROMRESUME, NULL, 0, NULL) != 0) { | 450 if (devctl(cdrom->id, DCMD_CAM_CDROMRESUME, NULL, 0, NULL) != 0) { |
451 return -1; | 451 return -1; |
452 } else { | 452 } else { |
453 return 0; | 453 return 0; |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 /* Stop play */ | 457 /* Stop play */ |
458 static int | 458 static int |
459 SDL_SYS_CDStop (SDL_CD * cdrom) | 459 SDL_SYS_CDStop(SDL_CD * cdrom) |
460 { | 460 { |
461 if (devctl (cdrom->id, DCMD_CAM_CDROMSTOP, NULL, 0, NULL) != 0) { | 461 if (devctl(cdrom->id, DCMD_CAM_CDROMSTOP, NULL, 0, NULL) != 0) { |
462 return -1; | 462 return -1; |
463 } else { | 463 } else { |
464 return 0; | 464 return 0; |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 /* Eject the CD-ROM */ | 468 /* Eject the CD-ROM */ |
469 static int | 469 static int |
470 SDL_SYS_CDEject (SDL_CD * cdrom) | 470 SDL_SYS_CDEject(SDL_CD * cdrom) |
471 { | 471 { |
472 if (devctl (cdrom->id, DCMD_CAM_EJECT_MEDIA, NULL, 0, NULL) != 0) { | 472 if (devctl(cdrom->id, DCMD_CAM_EJECT_MEDIA, NULL, 0, NULL) != 0) { |
473 return -1; | 473 return -1; |
474 } else { | 474 } else { |
475 return 0; | 475 return 0; |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 /* Close the CD-ROM handle */ | 479 /* Close the CD-ROM handle */ |
480 static void | 480 static void |
481 SDL_SYS_CDClose (SDL_CD * cdrom) | 481 SDL_SYS_CDClose(SDL_CD * cdrom) |
482 { | 482 { |
483 int i; | 483 int i; |
484 | 484 |
485 for (i = 0; i < MAX_DRIVES; i++) { | 485 for (i = 0; i < MAX_DRIVES; i++) { |
486 if (SDL_cdopen[i] == cdrom->id) { | 486 if (SDL_cdopen[i] == cdrom->id) { |
487 SDL_cdopen[i] = 0; | 487 SDL_cdopen[i] = 0; |
488 break; | 488 break; |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 close (cdrom->id); | 492 close(cdrom->id); |
493 } | 493 } |
494 | 494 |
495 void | 495 void |
496 SDL_SYS_CDQuit (void) | 496 SDL_SYS_CDQuit(void) |
497 { | 497 { |
498 int i; | 498 int i; |
499 | 499 |
500 if (SDL_numcds > 0) { | 500 if (SDL_numcds > 0) { |
501 for (i = 0; i < SDL_numcds; ++i) { | 501 for (i = 0; i < SDL_numcds; ++i) { |
502 SDL_free (SDL_cdlist[i]); | 502 SDL_free(SDL_cdlist[i]); |
503 } | 503 } |
504 SDL_numcds = 0; | 504 SDL_numcds = 0; |
505 } | 505 } |
506 } | 506 } |
507 | 507 |