Rob Shearman : include: Fix the HRESULT_FROM_WIN32 macro to not change the HRESULT if the error is already an HRESULT .
Alexandre Julliard
julliard at winehq.org
Mon Dec 3 09:17:41 CST 2007
Module: wine
Branch: master
Commit: 49a5f7cb12acb7bb8e6b8c9ebc66c7089db10592
URL: http://source.winehq.org/git/wine.git/?a=commit;h=49a5f7cb12acb7bb8e6b8c9ebc66c7089db10592
Author: Rob Shearman <rob at codeweavers.com>
Date: Fri Nov 30 18:06:53 2007 +0000
include: Fix the HRESULT_FROM_WIN32 macro to not change the HRESULT if the error is already an HRESULT.
---
include/winerror.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/winerror.h b/include/winerror.h
index d19b4b0..9cf495e 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -81,7 +81,7 @@
#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1)
-#define __HRESULT_FROM_WIN32(x) ((x) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0 )
+#define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) > 0 ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : (HRESULT)(x) )
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
# ifdef _MSC_VER
@@ -92,7 +92,7 @@ typedef int HRESULT;
#endif
static inline HRESULT HRESULT_FROM_WIN32(unsigned long x)
{
- return x ? ((HRESULT) ((x & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0;
+ return (HRESULT)x > 0 ? ((HRESULT) ((x & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : (HRESULT)x;
}
#define FACILITY_NT_BIT 0x10000000
#define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT))
More information about the wine-cvs
mailing list