Fixed track detection on MacOS X 10.1
authorSam Lantinga
Sun, 04 Jan 2004 18:50:26 +0000
changeset 771336603031bab
parent 770 ac44ddb84f6f
child 772 5c5656163ebd
Fixed track detection on MacOS X 10.1
src/cdrom/macosx/CDPlayer.cpp
     1.1 --- a/src/cdrom/macosx/CDPlayer.cpp	Sun Jan 04 17:04:54 2004 +0000
     1.2 +++ b/src/cdrom/macosx/CDPlayer.cpp	Sun Jan 04 18:50:26 2004 +0000
     1.3 @@ -370,15 +370,19 @@
     1.4                  name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length);
     1.5                  
     1.6                  // Look for .aiff extension
     1.7 -                if (CFStringHasSuffix (name, CFSTR(".aiff"))) {
     1.8 +                if (CFStringHasSuffix (name, CFSTR(".aiff")) ||
     1.9 +                    CFStringHasSuffix (name, CFSTR(".cdda"))) {
    1.10                      
    1.11                      // Extract the track id from the filename
    1.12                      int trackID = 0, i = 0;
    1.13 -                    while (nameStr.unicode[i] >= '0' && nameStr.unicode[i] <= '9') {
    1.14 +                    while (i < nameStr.length && !isdigit(nameStr.unicode[i])) {
    1.15 +                        ++i;
    1.16 +                    }
    1.17 +                    while (i < nameStr.length && isdigit(nameStr.unicode[i])) {
    1.18                          trackID = 10 * trackID +(nameStr.unicode[i] - '0');
    1.19 -                        i++;
    1.20 +                        ++i;
    1.21                      }
    1.22 -                    
    1.23 +
    1.24                      #if DEBUG_CDROM
    1.25                      printf("Found AIFF for track %d: '%s'\n", trackID, 
    1.26                      CFStringGetCStringPtr (name, CFStringGetSystemEncoding()));