1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-21 06:14:32 +00:00

ao_coreaudio: change all ++var to var++

Luckily they all were inside for loops so the functionality does not actually
change.
This commit is contained in:
Stefano Pigozzi 2013-07-01 08:43:22 +02:00
parent d3fb585b58
commit 5a4ae42892
2 changed files with 8 additions and 12 deletions

View File

@ -217,7 +217,7 @@ static void print_help(void)
int devs_n = devs_size / sizeof(AudioDeviceID);
for (int i = 0; i < devs_n; ++i) {
for (int i = 0; i < devs_n; i++) {
char *name;
OSStatus err =
GetAudioPropertyString(devs[i], kAudioObjectPropertyName, &name);
@ -461,8 +461,7 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
int streams_n = size / sizeof(AudioStreamID);
// TODO: ++i is quite fishy in here. Investigate!
for (int i = 0; i < streams_n && d->stream_idx < 0; ++i) {
for (int i = 0; i < streams_n && d->stream_idx < 0; i++) {
bool digital = AudioStreamSupportsDigital(streams[i]);
if (digital) {
@ -485,8 +484,7 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
d->stream = streams[i];
d->stream_idx = i;
// TODO: ++j is fishy. was like this in the original code. Investigate!
for (int j = 0; j < formats_n; ++j)
for (int j = 0; j < formats_n; j++)
if (AudioFormatIsDigital(asbd)) {
// select the digital format that has exactly the same
// samplerate. If an exact match cannot be found, select

View File

@ -235,7 +235,7 @@ static int AudioStreamSupportsDigital(AudioStreamID stream)
}
const int n_formats = size / sizeof(AudioStreamRangedDescription);
for (int i = 0; i < n_formats; ++i) {
for (int i = 0; i < n_formats; i++) {
AudioStreamBasicDescription asbd = formats[i].mFormat;
ca_print_asbd("supported format:", &(asbd));
if (AudioFormatIsDigital(asbd)) {
@ -264,7 +264,7 @@ static int AudioDeviceSupportsDigital(AudioDeviceID device)
}
const int n_streams = size / sizeof(AudioStreamID);
for (int i = 0; i < n_streams; ++i) {
for (int i = 0; i < n_streams; i++) {
if (AudioStreamSupportsDigital(streams[i])) {
free(streams);
return CONTROL_OK;
@ -280,11 +280,9 @@ static OSStatus ca_property_listener(AudioObjectPropertySelector selector,
const AudioObjectPropertyAddress addresses[],
void *data)
{
// TODO: ++i seems wrong in this context. Check out if it was a programmer
// mistake
void *talloc_ctx = talloc_new(NULL);
for (int i = 0; i < n_addresses; ++i) {
for (int i = 0; i < n_addresses; i++) {
if (addresses[i].mSelector == selector) {
ca_msg(MSGL_WARN, "event: property %s changed\n",
fourcc_repr(talloc_ctx, selector));
@ -418,8 +416,8 @@ static int AudioStreamChangeFormat(AudioStreamID i_stream_id,
* it is also not Atomic, in its behaviour.
* Therefore we check 5 times before we really give up. */
bool format_set = CONTROL_FALSE;
for (int i = 0; !format_set && i < 5; ++i) {
for (int j = 0; !stream_format_changed && j < 50; ++j)
for (int i = 0; !format_set && i < 5; i++) {
for (int j = 0; !stream_format_changed && j < 50; j++)
mp_sleep_us(10000);
if (stream_format_changed) {