diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index bcc726f94..8c5b36496 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -478,9 +478,7 @@ static UINT rdpsnd_treat_wave(rdpsndPlugin* rdpsnd, wStream* s, size_t size) end = GetTickCount64(); diffMS = end - rdpsnd->wArrivalTime + latency; - ts = rdpsnd->wTimeStamp + diffMS; - if (ts > UINT16_MAX) - ts = UINT16_MAX; + ts = (rdpsnd->wTimeStamp + diffMS) % UINT16_MAX; return rdpsnd_send_wave_confirm_pdu(rdpsnd, (UINT16)ts, rdpsnd->cBlockNo); } @@ -741,7 +739,7 @@ static UINT rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args) if ((errno != 0) || (val > UINT16_MAX)) return CHANNEL_RC_INITIALIZATION_ERROR; - rdpsnd->fixed_format->wFormatTag = val; + rdpsnd->fixed_format->wFormatTag = (UINT16)val; } CommandLineSwitchCase(arg, "rate") { @@ -759,7 +757,7 @@ static UINT rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args) if ((errno != 0) || (val > UINT16_MAX)) return CHANNEL_RC_INITIALIZATION_ERROR; - rdpsnd->fixed_format->nChannels = val; + rdpsnd->fixed_format->nChannels = (UINT16)val; } CommandLineSwitchCase(arg, "latency") { diff --git a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c index f9fad9b59..0c51f77d8 100644 --- a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c +++ b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c @@ -184,7 +184,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device) if (winmm->hThread) { WaitForSingleObject(winmm->hThread, INFINITE); - CloseHandle(&winmm->hThread); + CloseHandle(winmm->hThread); winmm->hThread = NULL; } } @@ -266,7 +266,7 @@ static UINT rdpsnd_winmm_play(rdpsndDevicePlugin* device, const BYTE* data, size if (size > UINT32_MAX) return 0; - lpWaveHdr = malloc(sizeof(WAVEHDR)); + lpWaveHdr = (LPWAVEHDR)calloc(1, sizeof(WAVEHDR)); if (!lpWaveHdr) return 0;