From bdf757838988148a10f98e660b9ccede5f5e7d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Tue, 31 Jan 2012 09:33:19 +0100 Subject: [PATCH] mciwave: Always reach an end position expressed in milliseconds. --- dlls/mciwave/mciwave.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c index effecf43069..723b5fe1e0f 100644 --- a/dlls/mciwave/mciwave.c +++ b/dlls/mciwave/mciwave.c @@ -225,7 +225,7 @@ static void WAVE_mciNotify(DWORD_PTR hWndCallBack, WINE_MCIWAVE* wmw, UINT wStat /************************************************************************** * WAVE_ConvertByteToTimeFormat [internal] */ -static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val, LPDWORD lpRet) +static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val) { DWORD ret = 0; @@ -243,7 +243,6 @@ static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val, LPDWORD WARN("Bad time format %u!\n", wmw->dwMciTimeFormat); } TRACE("val=%u=0x%08x [tf=%u] => ret=%u\n", val, val, wmw->dwMciTimeFormat, ret); - *lpRet = 0; return ret; } @@ -257,6 +256,9 @@ static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val) switch (wmw->dwMciTimeFormat) { case MCI_FORMAT_MILLISECONDS: ret = MulDiv(val,wmw->lpWaveFormat->nAvgBytesPerSec,1000); + if (ret > wmw->ckWaveData.cksize && + val == WAVE_ConvertByteToTimeFormat(wmw, wmw->ckWaveData.cksize)) + ret = wmw->ckWaveData.cksize; break; case MCI_FORMAT_BYTES: ret = val; @@ -1484,7 +1486,7 @@ static DWORD WAVE_mciStatus(MCIDEVICEID wDevID, DWORD dwFlags, LPMCI_STATUS_PARM return MCIERR_UNSUPPORTED_FUNCTION; } /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */ - lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->ckWaveData.cksize, &ret); + lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->ckWaveData.cksize); TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn); break; case MCI_STATUS_MODE: @@ -1509,8 +1511,7 @@ static DWORD WAVE_mciStatus(MCIDEVICEID wDevID, DWORD dwFlags, LPMCI_STATUS_PARM } /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */ lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, - (dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition, - &ret); + (dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition); TRACE("MCI_STATUS_POSITION %s => %lu\n", (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn); break;