Commit e41942e8140566d76284bea61130de8e125a17d0

daniel 2022-10-05T13:36:25

fix compilation error SDL_coreaudio mixing declarations and code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 63ce6a5..6cfc035 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -1177,6 +1177,7 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
     char *devname;
     int usable;
     double sampleRate;
+    CFIndex len;
 
     AudioObjectPropertyAddress addr = {
         iscapture ? kAudioHardwarePropertyDefaultInputDevice
@@ -1222,7 +1223,7 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
             return SDL_SetError("%s: Default Device Name not found", "coreaudio");
         }
 
-        CFIndex len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
+        len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
                                                         kCFStringEncodingUTF8);
         devname = (char *) SDL_malloc(len + 1);
         usable = ((devname != NULL) &&