mciavi32: Removed duplicate strlen/NULL check (Coverity).

This commit is contained in:
Marcus Meissner 2009-11-08 10:24:32 +01:00 committed by Alexandre Julliard
parent 25bfe9df49
commit 961e88f756
1 changed files with 15 additions and 18 deletions

View File

@ -250,29 +250,26 @@ static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
* contains the hFile value ? * contains the hFile value ?
*/ */
dwRet = MCIERR_UNRECOGNIZED_COMMAND; dwRet = MCIERR_UNRECOGNIZED_COMMAND;
} else if (strlenW(lpOpenParms->lpstrElementName) > 0) { } else if (lpOpenParms->lpstrElementName && lpOpenParms->lpstrElementName[0]) {
/* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */ /* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName)); TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
if (lpOpenParms->lpstrElementName && (strlenW(lpOpenParms->lpstrElementName) > 0)) wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
{ strcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
strcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL, wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL,
MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READ); MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READ);
if (wma->hFile == 0) { if (wma->hFile == 0) {
WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName)); WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
dwRet = MCIERR_FILE_NOT_FOUND; dwRet = MCIERR_FILE_NOT_FOUND;
} else { } else {
if (!MCIAVI_GetInfo(wma)) if (!MCIAVI_GetInfo(wma))
dwRet = MCIERR_INVALID_FILE; dwRet = MCIERR_INVALID_FILE;
else if (!MCIAVI_OpenVideo(wma)) else if (!MCIAVI_OpenVideo(wma))
dwRet = MCIERR_CANNOT_LOAD_DRIVER; dwRet = MCIERR_CANNOT_LOAD_DRIVER;
else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms)) else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms))
dwRet = MCIERR_CREATEWINDOW; dwRet = MCIERR_CREATEWINDOW;
}
} }
} else { } else {
FIXME("Don't record yet\n"); FIXME("Don't record yet\n");