Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.