Michael Stefaniuc : shlwapi: Avoid FALSE:TRUE conditional expressions.

Alexandre Julliard julliard at winehq.org
Mon Aug 13 13:21:20 CDT 2012


Module: wine
Branch: master
Commit: 8d24dd49eee67251c46bb03b0c1de78d0b1d2074
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d24dd49eee67251c46bb03b0c1de78d0b1d2074

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Aug  8 21:35:53 2012 +0200

shlwapi: Avoid FALSE:TRUE conditional expressions.

---

 dlls/shlwapi/path.c   |    4 ++--
 dlls/shlwapi/reg.c    |   16 ++++------------
 dlls/shlwapi/thread.c |    2 +-
 3 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index 6f09d22..bb2879e 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -1714,7 +1714,7 @@ BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
   iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
   dwAttr = GetFileAttributesA(lpszPath);
   SetErrorMode(iPrevErrMode);
-  return dwAttr == INVALID_FILE_ATTRIBUTES ? FALSE : TRUE;
+  return dwAttr != INVALID_FILE_ATTRIBUTES;
 }
 
 /*************************************************************************
@@ -1735,7 +1735,7 @@ BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
   iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
   dwAttr = GetFileAttributesW(lpszPath);
   SetErrorMode(iPrevErrMode);
-  return dwAttr == INVALID_FILE_ATTRIBUTES ? FALSE : TRUE;
+  return dwAttr != INVALID_FILE_ATTRIBUTES;
 }
 
 /*************************************************************************
diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c
index 26f83bf..c58a8c7 100644
--- a/dlls/shlwapi/reg.c
+++ b/dlls/shlwapi/reg.c
@@ -1890,17 +1890,14 @@ DWORD WINAPI SHGetValueGoodBootW(HKEY hkey, LPCWSTR pSubKey, LPCWSTR pValue,
  */
 BOOL WINAPI RegisterMIMETypeForExtensionA(LPCSTR lpszSubKey, LPCSTR lpszValue)
 {
-  DWORD dwRet;
-
   if (!lpszValue)
   {
     WARN("Invalid lpszValue would crash under Win32!\n");
     return FALSE;
   }
 
-  dwRet = SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
+  return !SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
                       REG_SZ, lpszValue, strlen(lpszValue));
-  return dwRet ? FALSE : TRUE;
 }
 
 /*************************************************************************
@@ -1910,17 +1907,14 @@ BOOL WINAPI RegisterMIMETypeForExtensionA(LPCSTR lpszSubKey, LPCSTR lpszValue)
  */
 BOOL WINAPI RegisterMIMETypeForExtensionW(LPCWSTR lpszSubKey, LPCWSTR lpszValue)
 {
-  DWORD dwRet;
-
   if (!lpszValue)
   {
     WARN("Invalid lpszValue would crash under Win32!\n");
     return FALSE;
   }
 
-  dwRet = SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
+  return !SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
                       REG_SZ, lpszValue, strlenW(lpszValue));
-  return dwRet ? FALSE : TRUE;
 }
 
 /*************************************************************************
@@ -1937,8 +1931,7 @@ BOOL WINAPI RegisterMIMETypeForExtensionW(LPCWSTR lpszSubKey, LPCWSTR lpszValue)
  */
 BOOL WINAPI UnregisterMIMETypeForExtensionA(LPCSTR lpszSubKey)
 {
-  HRESULT ret = SHDeleteValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA);
-  return ret ? FALSE : TRUE;
+  return !SHDeleteValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA);
 }
 
 /*************************************************************************
@@ -1948,8 +1941,7 @@ BOOL WINAPI UnregisterMIMETypeForExtensionA(LPCSTR lpszSubKey)
  */
 BOOL WINAPI UnregisterMIMETypeForExtensionW(LPCWSTR lpszSubKey)
 {
-  HRESULT ret = SHDeleteValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW);
-  return ret ? FALSE : TRUE;
+  return !SHDeleteValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW);
 }
 
 /*************************************************************************
diff --git a/dlls/shlwapi/thread.c b/dlls/shlwapi/thread.c
index c18d5a4..f8afc29 100644
--- a/dlls/shlwapi/thread.c
+++ b/dlls/shlwapi/thread.c
@@ -365,7 +365,7 @@ BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData,
   ti.pfnThreadProc = pfnThreadProc;
   ti.pfnCallback = pfnCallback;
   ti.pData = pData;
-  ti.bInitCom = dwFlags & CTF_COINIT ? TRUE : FALSE;
+  ti.bInitCom = (dwFlags & CTF_COINIT) != 0;
   ti.hEvent = CreateEventW(NULL,FALSE,FALSE,NULL);
 
   /* Hold references to the current thread and IE process, if desired */




More information about the wine-cvs mailing list