2008/6/6 Jon Griffiths jon_p_griffiths@yahoo.com:
- if (dwRequiredSize > *lpdwBufferSize)
- {
*lpdwBufferSize = dwRequiredSize;
- ret = dwRequiredSize > *lpdwBufferSize? FALSE : TRUE;
- *lpdwBufferSize = dwRequiredSize;
- if (!ret) SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
- else if (!lpCacheEntryInfo)
- {
SetLastError(ERROR_INVALID_PARAMETER);
}ret = FALSE;
- *lpdwBufferSize = dwRequiredSize;
- return TRUE;
- return ret;
}
Internal functions should return an error code instead of calling SetLastError. This avoids situations like this:
@@ -1531,6 +1539,9 @@ BOOL WINAPI GetUrlCacheEntryInfoA( FALSE /* ANSI */)) { URLCacheContainer_UnlockIndex(pContainer, pHeader);
/* This case is inconsistent w.r.t RetrieveUrlCacheEntryFile */
if (!lpCacheEntryInfo && GetLastError() == ERROR_INVALID_PARAMETER)
SetLastError(ERROR_INSUFFICIENT_BUFFER); return FALSE; } TRACE("Local File Name: %s\n", debugstr_a(lpCacheEntryInfo->lpszLocalFileName));