Commit 11805e0a authored by Francois Jacques's avatar Francois Jacques Committed by Alexandre Julliard

Should test unixdev against -1 (see wodOpen/widOpen).

widRecorder: bytesRead is now tested against (DWORD) -1.
parent 49851f88
...@@ -806,7 +806,7 @@ static DWORD wodClose(WORD wDevID) ...@@ -806,7 +806,7 @@ static DWORD wodClose(WORD wDevID)
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad device ID !\n"); WARN("bad device ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -847,7 +847,7 @@ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize) ...@@ -847,7 +847,7 @@ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize); TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
/* first, do the sanity checks... */ /* first, do the sanity checks... */
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad dev ID !\n"); WARN("bad dev ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -916,7 +916,7 @@ static DWORD wodPause(WORD wDevID) ...@@ -916,7 +916,7 @@ static DWORD wodPause(WORD wDevID)
{ {
TRACE("(%u);!\n", wDevID); TRACE("(%u);!\n", wDevID);
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad device ID !\n"); WARN("bad device ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -935,7 +935,7 @@ static DWORD wodRestart(WORD wDevID) ...@@ -935,7 +935,7 @@ static DWORD wodRestart(WORD wDevID)
{ {
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad device ID !\n"); WARN("bad device ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -964,7 +964,7 @@ static DWORD wodReset(WORD wDevID) ...@@ -964,7 +964,7 @@ static DWORD wodReset(WORD wDevID)
{ {
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad device ID !\n"); WARN("bad device ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -988,7 +988,7 @@ static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) ...@@ -988,7 +988,7 @@ static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize); TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].unixdev == -1) {
WARN("bad device ID !\n"); WARN("bad device ID !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
...@@ -1616,7 +1616,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt) ...@@ -1616,7 +1616,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt)
bytesRead = read(wwi->unixdev, lpWaveHdr->lpData + lpWaveHdr->dwBytesRecorded, bytesRead = read(wwi->unixdev, lpWaveHdr->lpData + lpWaveHdr->dwBytesRecorded,
lpWaveHdr->dwBufferLength - lpWaveHdr->dwBytesRecorded); lpWaveHdr->dwBufferLength - lpWaveHdr->dwBytesRecorded);
if (bytesRead > 0) { if (bytesRead != (DWORD) -1) {
TRACE("Read=%lu (%ld)\n", bytesRead, lpWaveHdr->dwBufferLength); TRACE("Read=%lu (%ld)\n", bytesRead, lpWaveHdr->dwBufferLength);
lpWaveHdr->dwBytesRecorded += bytesRead; lpWaveHdr->dwBytesRecorded += bytesRead;
wwi->dwTotalRecorded += bytesRead; wwi->dwTotalRecorded += bytesRead;
...@@ -1813,7 +1813,7 @@ static DWORD widClose(WORD wDevID) ...@@ -1813,7 +1813,7 @@ static DWORD widClose(WORD wDevID)
WINE_WAVEIN* wwi; WINE_WAVEIN* wwi;
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't close !\n"); WARN("can't close !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
...@@ -1845,7 +1845,7 @@ static DWORD widAddBuffer(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize) ...@@ -1845,7 +1845,7 @@ static DWORD widAddBuffer(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
{ {
TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize); TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't do it !\n"); WARN("can't do it !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
...@@ -1907,7 +1907,7 @@ static DWORD widUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize) ...@@ -1907,7 +1907,7 @@ static DWORD widUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
static DWORD widStart(WORD wDevID) static DWORD widStart(WORD wDevID)
{ {
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't start recording !\n"); WARN("can't start recording !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
...@@ -1924,7 +1924,7 @@ static DWORD widStart(WORD wDevID) ...@@ -1924,7 +1924,7 @@ static DWORD widStart(WORD wDevID)
static DWORD widStop(WORD wDevID) static DWORD widStop(WORD wDevID)
{ {
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't stop !\n"); WARN("can't stop !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
...@@ -1941,7 +1941,7 @@ static DWORD widStop(WORD wDevID) ...@@ -1941,7 +1941,7 @@ static DWORD widStop(WORD wDevID)
static DWORD widReset(WORD wDevID) static DWORD widReset(WORD wDevID)
{ {
TRACE("(%u);\n", wDevID); TRACE("(%u);\n", wDevID);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't reset !\n"); WARN("can't reset !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
...@@ -1960,7 +1960,7 @@ static DWORD widGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) ...@@ -1960,7 +1960,7 @@ static DWORD widGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize); TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == 0) { if (wDevID >= MAX_WAVEINDRV || WInDev[wDevID].unixdev == -1) {
WARN("can't get pos !\n"); WARN("can't get pos !\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment