changeset 36006:efb9481610d2

Avoid declaring loop variables inside the for() This improves compiler compatibility.
author reimar
date Sat, 30 Mar 2013 08:53:02 +0000
parents 3be3990375da
children 90ff4280cc80
files libao2/ao_coreaudio.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_coreaudio.c	Sat Mar 30 08:42:57 2013 +0000
+++ b/libao2/ao_coreaudio.c	Sat Mar 30 08:53:02 2013 +0000
@@ -369,6 +369,7 @@
     OSStatus err;
     UInt32 i_param_size;
     int num_devices;
+    int i;
     AudioDeviceID *devids;
     char *device_name;
 
@@ -393,7 +394,7 @@
 
     num_devices = i_param_size / sizeof(AudioDeviceID);
 
-    for (int i = 0; i < num_devices; ++i) {
+    for (i = 0; i < num_devices; ++i) {
         err = GetAudioPropertyString(devids[i], kAudioObjectPropertyName, &device_name);
 
         if (err == noErr) {
@@ -1247,7 +1248,8 @@
                                 const AudioObjectPropertyAddress inAddresses[],
                                 void *inClientData )
 {
-    for (int i=0; i < inNumberAddresses; ++i)
+    int i;
+    for (i=0; i < inNumberAddresses; ++i)
     {
         if (inAddresses[i].mSelector == kAudioStreamPropertyPhysicalFormat) {
             ao_msg(MSGT_AO, MSGL_WARN, "got notify kAudioStreamPropertyPhysicalFormat changed.\n");
@@ -1264,7 +1266,8 @@
                                 const AudioObjectPropertyAddress inAddresses[],
                                 void *inClientData )
 {
-    for (int i=0; i < inNumberAddresses; ++i)
+    int i;
+    for (i=0; i < inNumberAddresses; ++i)
     {
         if (inAddresses[i].mSelector == kAudioDevicePropertyDeviceHasChanged) {
             ao_msg(MSGT_AO, MSGL_WARN, "got notify kAudioDevicePropertyDeviceHasChanged.\n");