aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-10 11:43:40 +0200
committerMax Kellermann <max@duempel.org>2008-09-10 11:43:40 +0200
commit9f16a34d7638a4ea154c03d06a40984c114e17ee (patch)
tree72d96046db0197387b1867191b20604944a01a4f /src
parenta53047af7d60ae589cdbbbbde498b0e1336167f2 (diff)
downloadmpd-9f16a34d7638a4ea154c03d06a40984c114e17ee.tar.gz
mpd-9f16a34d7638a4ea154c03d06a40984c114e17ee.tar.xz
mpd-9f16a34d7638a4ea154c03d06a40984c114e17ee.zip
audio: don't allow isCurrentAudioFormat(NULL)
Passing NULL to this function doesn't make sense, and complicates its implementation. The one caller which might pass NULL should rather check this.
Diffstat (limited to 'src')
-rw-r--r--src/audio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/audio.c b/src/audio.c
index 9d92f2bd7..d4cd97a10 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -222,8 +222,9 @@ void finishAudioDriver(void)
int isCurrentAudioFormat(const struct audio_format *audioFormat)
{
- return audioFormat == NULL ||
- audio_format_equals(audioFormat, &audio_format);
+ assert(audioFormat != NULL);
+
+ return audio_format_equals(audioFormat, &audio_format);
}
static void syncAudioDeviceStates(void)
@@ -292,7 +293,8 @@ int openAudioDevice(const struct audio_format *audioFormat)
if (!audioOutputArray)
return -1;
- if (!audioOpened || !isCurrentAudioFormat(audioFormat)) {
+ if (!audioOpened ||
+ (audioFormat != NULL && !isCurrentAudioFormat(audioFormat))) {
flushAudioBuffer();
if (audioFormat != NULL)
audio_format = *audioFormat;