Rob Shearman : shlwapi: Fix testing of HRESULT types with not operator instead of comparing against S_OK .
Alexandre Julliard
julliard at winehq.org
Mon Aug 18 10:47:22 CDT 2008
Module: wine
Branch: master
Commit: 9dd75ea09313014f7cbacaab307c27e6b4ac44c3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9dd75ea09313014f7cbacaab307c27e6b4ac44c3
Author: Rob Shearman <robertshearman at gmail.com>
Date: Sun Aug 17 18:31:57 2008 +0100
shlwapi: Fix testing of HRESULT types with not operator instead of comparing against S_OK.
This makes it more obvious what the code is doing.
---
dlls/shlwapi/ordinal.c | 6 +++---
dlls/shlwapi/string.c | 8 +++++---
dlls/shlwapi/url.c | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index d0bff7f..b7be1f1 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -422,11 +422,11 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
pIEnumFormatEtc = NULL;
hRet = IUnknown_QueryInterface(pIUnknown, &IID_IEnumFORMATETC,
(PVOID)&pIEnumFormatEtc);
- if (!hRet && pIEnumFormatEtc)
+ if (hRet == S_OK && pIEnumFormatEtc)
{
/* Clone and register the enumerator */
hRet = IEnumFORMATETC_Clone(pIEnumFormatEtc, &pClone);
- if (!hRet && pClone)
+ if (hRet == S_OK && pClone)
{
RegisterFormatEnumerator(lpBC, pClone, 0);
@@ -1462,7 +1462,7 @@ HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID ri
hRet = IUnknown_QueryInterface(lpUnknown, &IID_IServiceProvider,
(LPVOID*)&pService);
- if (!hRet && pService)
+ if (hRet == S_OK && pService)
{
TRACE("QueryInterface returned (IServiceProvider*)%p\n", pService);
diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
index abbfdba..89cf5ef 100644
--- a/dlls/shlwapi/string.c
+++ b/dlls/shlwapi/string.c
@@ -2511,8 +2511,9 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
DWORD dwMode = 0;
INT nWideCharCount = len - 1;
- if (!ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
- lpiLen))
+ if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr,
+ &nWideCharCount, lpDstStr,
+ lpiLen) == S_OK)
return 0;
if (nWideCharCount < len - 1)
@@ -2523,7 +2524,8 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
*lpiLen = 0;
- if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpiLen))
+ if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len,
+ mem, lpiLen) != S_OK)
{
SHTruncateString(mem, *lpiLen);
lstrcpynA(lpDstStr, mem, *lpiLen + 1);
diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c
index 03941a9..18ebc41 100644
--- a/dlls/shlwapi/url.c
+++ b/dlls/shlwapi/url.c
@@ -2077,7 +2077,7 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
debugstr_w(pszIn), pszOut, pcchOut, *pcchOut, dwPart, dwFlags);
ret = URL_ParseUrl(pszIn, &pl);
- if (!ret) {
+ if (ret == S_OK) {
schaddr = pl.pScheme;
schsize = pl.szScheme;
More information about the wine-cvs
mailing list