Huw Davies (@huw) commented about dlls/mmdevapi/spatialaudio.c:
fmt->wFormatTag, debugstr_guid(&fmtex->SubFormat),
fmt->nChannels, fmtex->dwChannelMask, fmt->nSamplesPerSec,
fmt->wBitsPerSample);
- }
- else
- {
snprintf(buf, sizeof(buf), "tag: 0x%x, ch: %u, rate: %lu, depth: %u",
fmt->wFormatTag, fmt->nChannels, fmt->nSamplesPerSec,
fmt->wBitsPerSample);
- }
- return buf;
+}
+static BOOL formats_equal(const WAVEFORMATEX *fmt1, const WAVEFORMATEX *fmt2) +{
- return !memcmp(fmt1, fmt2, sizeof(*fmt1) + fmt1->cbSize);
I realise that this came from existing code, but we should probably first compare `sizeof(*fmt1)` and then do a second comparison for `fmt1->cbSize`. That would ensure that `fmt2` is large enough.