Fix propvariant.c compilation on Windows

Francois Gouget fgouget at free.fr
Wed Sep 8 06:30:27 CDT 2004


Changelog:

 * dlls/ole32/tests/propvariant.c

   The union in PROPVARIANT is always nameless on Windows. So define a
macro to deal with it correctly.


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
In theory, theory and practice are the same, but in practice they're different.
-------------- next part --------------
Index: dlls/ole32/tests/propvariant.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/tests/propvariant.c,v
retrieving revision 1.2
diff -u -r1.2 propvariant.c
--- dlls/ole32/tests/propvariant.c	6 Sep 2004 21:28:28 -0000	1.2
+++ dlls/ole32/tests/propvariant.c	8 Sep 2004 10:38:37 -0000
@@ -18,8 +18,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
 #include "windows.h"
 /* not present in Wine yet */
 /*#include "propidl.h"*/
@@ -28,6 +26,12 @@
 
 #include "wine/test.h"
 
+#ifdef NONAMELESSUNION
+# define U(x) (x).u
+#else
+# define U(x) (x)
+#endif
+
 struct valid_mapping
 {
     BOOL simple;
@@ -172,30 +176,30 @@
     HRESULT hr;
 
     propvarSrc.vt = VT_BSTR;
-    propvarSrc.u.bstrVal = SysAllocString(wszTestString);
+    U(propvarSrc).bstrVal = SysAllocString(wszTestString);
 
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
     ok(hr == S_OK, "PropVariantCopy(...VT_BSTR...) failed\n");
-    ok(!lstrcmpW(propvarSrc.u.bstrVal, propvarDst.u.bstrVal), "BSTR not copied properly\n");
+    ok(!lstrcmpW(U(propvarSrc).bstrVal, U(propvarDst).bstrVal), "BSTR not copied properly\n");
     hr = PropVariantClear(&propvarSrc);
     ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n");
     hr = PropVariantClear(&propvarDst);
     ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n");
 
     propvarSrc.vt = VT_LPWSTR;
-    propvarSrc.u.pwszVal = (LPWSTR)wszTestString;
+    U(propvarSrc).pwszVal = (LPWSTR)wszTestString;
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
     ok(hr == S_OK, "PropVariantCopy(...VT_LPWSTR...) failed\n");
-    ok(!lstrcmpW(propvarSrc.u.pwszVal, propvarDst.u.pwszVal), "Wide string not copied properly\n");
+    ok(!lstrcmpW(U(propvarSrc).pwszVal, U(propvarDst).pwszVal), "Wide string not copied properly\n");
     hr = PropVariantClear(&propvarDst);
     ok(hr == S_OK, "PropVariantClear(...VT_LPWSTR...) failed\n");
     memset(&propvarSrc, 0, sizeof(propvarSrc));
 
     propvarSrc.vt = VT_LPSTR;
-    propvarSrc.u.pszVal = (LPSTR)szTestString;
+    U(propvarSrc).pszVal = (LPSTR)szTestString;
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
     ok(hr == S_OK, "PropVariantCopy(...VT_LPSTR...) failed\n");
-    ok(!strcmp(propvarSrc.u.pszVal, propvarDst.u.pszVal), "String not copied properly\n");
+    ok(!strcmp(U(propvarSrc).pszVal, U(propvarDst).pszVal), "String not copied properly\n");
     hr = PropVariantClear(&propvarDst);
     ok(hr == S_OK, "PropVariantClear(...VT_LPSTR...) failed\n");
     memset(&propvarSrc, 0, sizeof(propvarSrc));


More information about the wine-patches mailing list