changeset 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 ac44ddb84f6f
children 5c5656163ebd
files src/cdrom/macosx/CDPlayer.cpp
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/cdrom/macosx/CDPlayer.cpp	Sun Jan 04 17:04:54 2004 +0000
+++ b/src/cdrom/macosx/CDPlayer.cpp	Sun Jan 04 18:50:26 2004 +0000
@@ -370,15 +370,19 @@
                 name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length);
                 
                 // Look for .aiff extension
-                if (CFStringHasSuffix (name, CFSTR(".aiff"))) {
+                if (CFStringHasSuffix (name, CFSTR(".aiff")) ||
+                    CFStringHasSuffix (name, CFSTR(".cdda"))) {
                     
                     // Extract the track id from the filename
                     int trackID = 0, i = 0;
-                    while (nameStr.unicode[i] >= '0' && nameStr.unicode[i] <= '9') {
+                    while (i < nameStr.length && !isdigit(nameStr.unicode[i])) {
+                        ++i;
+                    }
+                    while (i < nameStr.length && isdigit(nameStr.unicode[i])) {
                         trackID = 10 * trackID +(nameStr.unicode[i] - '0');
-                        i++;
+                        ++i;
                     }
-                    
+
                     #if DEBUG_CDROM
                     printf("Found AIFF for track %d: '%s'\n", trackID, 
                     CFStringGetCStringPtr (name, CFStringGetSystemEncoding()));