From c208b05a0e9f2bfb0ae02410f34cf3431cab4dde Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Apr 2006 09:54:43 +0000 Subject: Don't rely on memcmp() for structs, padding bits are random git-svn-id: https://svn.musicpd.org/mpd/trunk@4016 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/audio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/audio.c') diff --git a/src/audio.c b/src/audio.c index dfc209b32..dc5b26e50 100644 --- a/src/audio.c +++ b/src/audio.c @@ -62,8 +62,13 @@ void copyAudioFormat(AudioFormat * dest, AudioFormat * src) { memcpy(dest, src, sizeof(AudioFormat)); } -int cmpAudioFormat(AudioFormat * f1, AudioFormat * f2) { - return memcmp(f1, f2, sizeof(AudioFormat)); +int cmpAudioFormat(AudioFormat * f1, AudioFormat * f2) +{ + if (f1 && f2 && (f1->sampleRate == f2->sampleRate) && + (f1->bits == f2->bits) && + (f1->channels == f2->channels)) + return 0; + return 1; } extern AudioOutputPlugin alsaPlugin; -- cgit v1.2.3