comparison src/cdrom/macosx/CDPlayer.cpp @ 771:336603031bab

Fixed track detection on MacOS X 10.1
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2004 18:50:26 +0000
parents de1b2c3063b9
children 08b7fc2b5225
comparison
equal deleted inserted replaced
770:ac44ddb84f6f 771:336603031bab
368 368
369 CFStringRef name; 369 CFStringRef name;
370 name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length); 370 name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length);
371 371
372 // Look for .aiff extension 372 // Look for .aiff extension
373 if (CFStringHasSuffix (name, CFSTR(".aiff"))) { 373 if (CFStringHasSuffix (name, CFSTR(".aiff")) ||
374 CFStringHasSuffix (name, CFSTR(".cdda"))) {
374 375
375 // Extract the track id from the filename 376 // Extract the track id from the filename
376 int trackID = 0, i = 0; 377 int trackID = 0, i = 0;
377 while (nameStr.unicode[i] >= '0' && nameStr.unicode[i] <= '9') { 378 while (i < nameStr.length && !isdigit(nameStr.unicode[i])) {
379 ++i;
380 }
381 while (i < nameStr.length && isdigit(nameStr.unicode[i])) {
378 trackID = 10 * trackID +(nameStr.unicode[i] - '0'); 382 trackID = 10 * trackID +(nameStr.unicode[i] - '0');
379 i++; 383 ++i;
380 } 384 }
381 385
382 #if DEBUG_CDROM 386 #if DEBUG_CDROM
383 printf("Found AIFF for track %d: '%s'\n", trackID, 387 printf("Found AIFF for track %d: '%s'\n", trackID,
384 CFStringGetCStringPtr (name, CFStringGetSystemEncoding())); 388 CFStringGetCStringPtr (name, CFStringGetSystemEncoding()));
385 #endif 389 #endif
386 390