Fixed breaking strict-aliasing rules (if compiled with GCC with -fstrict-aliasing) in PaWin_InitializeWaveFormatExtensible(). (#342)
This commit is contained in:
parent
521209c633
commit
5f35d35ad0
1 changed files with 6 additions and 5 deletions
|
|
@ -98,14 +98,15 @@ void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
|
||||||
waveFormatEx->wBitsPerSample = bytesPerSample * 8;
|
waveFormatEx->wBitsPerSample = bytesPerSample * 8;
|
||||||
waveFormatEx->cbSize = 22;
|
waveFormatEx->cbSize = 22;
|
||||||
|
|
||||||
*((WORD*)&waveFormat->fields[PAWIN_INDEXOF_WVALIDBITSPERSAMPLE]) =
|
memcpy(&waveFormat->fields[PAWIN_INDEXOF_WVALIDBITSPERSAMPLE],
|
||||||
waveFormatEx->wBitsPerSample;
|
&waveFormatEx->wBitsPerSample, sizeof(WORD));
|
||||||
|
|
||||||
|
memcpy(&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK],
|
||||||
|
&channelMask, sizeof(DWORD));
|
||||||
|
|
||||||
*((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask;
|
|
||||||
|
|
||||||
guid = pawin_ksDataFormatSubtypeGuidBase;
|
guid = pawin_ksDataFormatSubtypeGuidBase;
|
||||||
guid.Data1 = (USHORT)waveFormatTag;
|
guid.Data1 = (USHORT)waveFormatTag;
|
||||||
*((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;
|
memcpy(&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT], &guid, sizeof(GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
|
PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue