Skip to content

Instantly share code, notes, and snippets.

@dscho
Created February 25, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dscho/9210644 to your computer and use it in GitHub Desktop.
Save dscho/9210644 to your computer and use it in GitHub Desktop.
Patch for MPlayer's C99 for loops declaring variables
diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c
index 34374f4..ce587db 100644
--- a/libao2/ao_coreaudio.c
+++ b/libao2/ao_coreaudio.c
@@ -368,7 +368,7 @@ static void print_help(void)
{
OSStatus err;
UInt32 i_param_size;
- int num_devices;
+ int num_devices, i;
AudioDeviceID *devids;
char *device_name;
@@ -393,7 +393,7 @@ static void print_help(void)
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 +1247,8 @@ static OSStatus StreamListener( AudioObjectID inObjectID,
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 +1265,8 @@ static OSStatus DeviceListener( AudioObjectID inObjectID,
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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment