[PATCH v2] include: Improve guiddef.h, part 1.

Serge Gautherie winehq-git_serge_180711 at gautherie.fr
Wed Apr 1 14:13:50 CDT 2020


Signed-off-by: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
---
 include/guiddef.h | 64 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 52 insertions(+), 12 deletions(-)

diff --git a/include/guiddef.h b/include/guiddef.h
index 1871910..fad2df0 100644
--- a/include/guiddef.h
+++ b/include/guiddef.h
@@ -84,7 +84,9 @@ extern "C++" {
 
 #endif
 
+#ifdef DEFINE_GUID
 #undef DEFINE_GUID
+#endif
 
 #ifdef INITGUID
 #ifdef __cplusplus
@@ -138,18 +140,49 @@ typedef GUID FMTID,*LPFMTID;
 #define __MIDL_CONST const
 #endif
 
-#endif /* ndef __IID_DEFINED__ */
+#ifndef _REFGUID_DEFINED
+#define _REFGUID_DEFINED
+#ifdef __cplusplus
+#define REFGUID const GUID &
+#else
+#define REFGUID const GUID * __MIDL_CONST
+#endif
+#endif
+
+#ifndef _REFIID_DEFINED
+#define _REFIID_DEFINED
+#ifdef __cplusplus
+#define REFIID const IID &
+#else
+#define REFIID const IID * __MIDL_CONST
+#endif
+#endif
 
+#ifndef _REFCLSID_DEFINED
+#define _REFCLSID_DEFINED
 #ifdef __cplusplus
-#define REFGUID             const GUID &
-#define REFCLSID            const CLSID &
-#define REFIID              const IID &
-#define REFFMTID            const FMTID &
+#define REFCLSID const CLSID &
 #else
-#define REFGUID             const GUID* __MIDL_CONST
-#define REFCLSID            const CLSID* __MIDL_CONST
-#define REFIID              const IID* __MIDL_CONST
-#define REFFMTID            const FMTID* __MIDL_CONST
+#define REFCLSID const CLSID * __MIDL_CONST
+#endif
+#endif
+
+#ifndef _REFFMTID_DEFINED
+#define _REFFMTID_DEFINED
+#ifdef __cplusplus
+#define REFFMTID const FMTID &
+#else
+#define REFFMTID const FMTID * __MIDL_CONST
+#endif
+#endif
+
+#endif /* __IID_DEFINED__ */
+
+#if !defined(_SYS_GUID_OPERATORS_)
+#define _SYS_GUID_OPERATORS_
+
+#ifdef __cplusplus
+#include <string.h>
 #endif
 
 #ifdef __cplusplus
@@ -170,16 +203,23 @@ inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
          ((ULONG *)rguid1)[3] == ((ULONG *)rguid2)[3])
 #endif
 
+#if !defined(_SYS_GUID_OPERATOR_EQ_) && !defined(_NO_SYS_GUID_OPERATOR_EQ_)
+#define _SYS_GUID_OPERATOR_EQ_
+
 #ifdef __cplusplus
-#include <string.h>
-inline bool operator==(const GUID& guidOne, const GUID& guidOther)
+inline bool operator==(REFGUID guidOne, REFGUID guidOther)
 {
     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
 }
-inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
+
+inline bool operator!=(REFGUID guidOne, REFGUID guidOther)
 {
     return !(guidOne == guidOther);
 }
 #endif
 
+#endif /* _SYS_GUID_OPERATOR_EQ_ */
+
+#endif /* _SYS_GUID_OPERATORS_ */
+
 #endif /* _GUIDDEF_H_ */
-- 
2.10.0.windows.1




More information about the wine-devel mailing list