diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-04-05 09:54:43 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2006-04-05 09:54:43 +0000 |
commit | c208b05a0e9f2bfb0ae02410f34cf3431cab4dde (patch) | |
tree | e9a510154bb11288a56c376931fc6eba017378a2 /src/audio.c | |
parent | e2e7d113ad085e276fbf3803934416c8ac7a70d1 (diff) | |
download | mpd-c208b05a0e9f2bfb0ae02410f34cf3431cab4dde.tar.gz mpd-c208b05a0e9f2bfb0ae02410f34cf3431cab4dde.tar.xz mpd-c208b05a0e9f2bfb0ae02410f34cf3431cab4dde.zip |
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
Diffstat (limited to '')
-rw-r--r-- | src/audio.c | 9 |
1 files changed, 7 insertions, 2 deletions
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; |