[1/2] oleaut32: Add V_RECORD() and V_RECORDINFO() and use them for wine_dbgstr_variant().
Francois Gouget
fgouget at free.fr
Tue Oct 27 05:58:14 CDT 2015
This fixes the wine_dbgstr_variant() compatibility with non __STDC__
compilers and source code that defines _FORCENAMELESSUNION.
Signed-off-by: Francois Gouget <fgouget at free.fr>
---
include/oleauto.h | 12 ++++++++----
include/wine/debug.h | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
In particular this helps when compiling code with Visual C++.
diff --git a/include/oleauto.h b/include/oleauto.h
index f9862e7..07c46ad 100644
--- a/include/oleauto.h
+++ b/include/oleauto.h
@@ -105,11 +105,15 @@ HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFGUID,IRecordIn
/* Macros for accessing the fields of the VARIANT type */
#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
-#define V_UNION(A,B) ((A)->n1.n2.n3.B)
-#define V_VT(A) ((A)->n1.n2.vt)
+#define V_VT(A) ((A)->n1.n2.vt)
+#define V_UNION(A,B) ((A)->n1.n2.n3.B)
+#define V_RECORD(A) (V_UNION(A,brecVal).pvRecord)
+#define V_RECORDINFO(A) (V_UNION(A,brecVal).pRecInfo)
#else
-#define V_UNION(A,B) ((A)->B)
-#define V_VT(A) ((A)->vt)
+#define V_VT(A) ((A)->vt)
+#define V_UNION(A,B) ((A)->B)
+#define V_RECORD(A) ((A)->pvRecord)
+#define V_RECORDINFO(A) ((A)->pRecInfo)
#endif
#define V_ISBYREF(A) (V_VT(A) & VT_BYREF)
diff --git a/include/wine/debug.h b/include/wine/debug.h
index 241e79b..af5483c 100644
--- a/include/wine/debug.h
+++ b/include/wine/debug.h
@@ -331,7 +331,7 @@ static inline const char *wine_dbgstr_variant( const VARIANT *v )
case VT_VOID:
return wine_dbg_sprintf( "%p {VT_VOID}", v );
case VT_RECORD:
- return wine_dbg_sprintf( "%p {VT_RECORD: %p %p}", v, V_UNION(v,brecVal).pvRecord, V_UNION(v,brecVal).pRecInfo );
+ return wine_dbg_sprintf( "%p {VT_RECORD: %p %p}", v, V_RECORD(v), V_RECORDINFO(v) );
default:
return wine_dbg_sprintf( "%p {vt %s}", v, wine_dbgstr_vt(V_VT(v)) );
}
--
2.6.1
More information about the wine-patches
mailing list