Commit 317cf8a3 authored by Sam Lantinga's avatar Sam Lantinga

Simplify code and clean up Valgrind warning

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40809
parent cd10cd4c
...@@ -461,16 +461,11 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) ...@@ -461,16 +461,11 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
} }
/* See if we need to do any conversion */ /* See if we need to do any conversion */
if ( memcmp(desired, &audio->spec, sizeof(audio->spec)) == 0 ) {
/* Just copy over the desired audio specification */
if ( obtained != NULL ) { if ( obtained != NULL ) {
memcpy(obtained, &audio->spec, sizeof(audio->spec)); memcpy(obtained, &audio->spec, sizeof(audio->spec));
} } else if ( desired->freq != audio->spec.freq ||
} else { desired->format != audio->spec.format ||
/* Copy over the audio specification if possible */ desired->channels != audio->spec.channels ) {
if ( obtained != NULL ) {
memcpy(obtained, &audio->spec, sizeof(audio->spec));
} else {
/* Build an audio conversion block */ /* Build an audio conversion block */
if ( SDL_BuildAudioCVT(&audio->convert, if ( SDL_BuildAudioCVT(&audio->convert,
desired->format, desired->channels, desired->format, desired->channels,
...@@ -491,7 +486,6 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) ...@@ -491,7 +486,6 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
} }
} }
} }
}
#ifndef ENABLE_AHI #ifndef ENABLE_AHI
/* Start the audio thread if necessary */ /* Start the audio thread if necessary */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment