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
This commit is contained in:
parent
e2e7d113ad
commit
c208b05a0e
@ -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;
|
||||
|
@ -74,7 +74,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
||||
static char * convBuffer = NULL;
|
||||
static long convBufferLen = 0;
|
||||
|
||||
if(memcmp(&(cb->audioFormat),&(dc->audioFormat),sizeof(AudioFormat))==0)
|
||||
if(cmpAudioFormat(&(cb->audioFormat),&(dc->audioFormat))==0)
|
||||
{
|
||||
data = dataIn;
|
||||
datalen = dataInLen;
|
||||
|
Loading…
Reference in New Issue
Block a user