Commit e68d6c16 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

include: Don't force named VARIANT members when __STDC__ is defined.

parent 28f3128d
...@@ -30,12 +30,6 @@ ...@@ -30,12 +30,6 @@
#include "wine/test.h" #include "wine/test.h"
#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
# define V_U2(A) ((A)->n1.n2)
#else
# define V_U2(A) (*(A))
#endif
typedef struct typedef struct
{ {
IUnknown IUnknown_iface; IUnknown IUnknown_iface;
...@@ -870,9 +864,9 @@ static DWORD *check_variant_header(DWORD *wirev, VARIANT *v, ULONG size) ...@@ -870,9 +864,9 @@ static DWORD *check_variant_header(DWORD *wirev, VARIANT *v, ULONG size)
ok(header->clSize == (size + 7) >> 3, "wv[0] %08lx, expected %08lx\n", header->clSize, (size + 7) >> 3); ok(header->clSize == (size + 7) >> 3, "wv[0] %08lx, expected %08lx\n", header->clSize, (size + 7) >> 3);
ok(header->rpcReserved == 0, "wv[1] %08lx\n", header->rpcReserved); ok(header->rpcReserved == 0, "wv[1] %08lx\n", header->rpcReserved);
ok(header->vt == V_VT(v), "vt %04x expected %04x\n", header->vt, V_VT(v)); ok(header->vt == V_VT(v), "vt %04x expected %04x\n", header->vt, V_VT(v));
ok(header->wReserved1 == V_U2(v).wReserved1, "res1 %04x expected %04x\n", header->wReserved1, V_U2(v).wReserved1); ok(header->wReserved1 == v->wReserved1, "res1 %04x expected %04x\n", header->wReserved1, v->wReserved1);
ok(header->wReserved2 == V_U2(v).wReserved2, "res2 %04x expected %04x\n", header->wReserved2, V_U2(v).wReserved2); ok(header->wReserved2 == v->wReserved2, "res2 %04x expected %04x\n", header->wReserved2, v->wReserved2);
ok(header->wReserved3 == V_U2(v).wReserved3, "res3 %04x expected %04x\n", header->wReserved3, V_U2(v).wReserved3); ok(header->wReserved3 == v->wReserved3, "res3 %04x expected %04x\n", header->wReserved3, v->wReserved3);
switch_is = V_VT(v); switch_is = V_VT(v);
if(switch_is & VT_ARRAY) if(switch_is & VT_ARRAY)
...@@ -938,9 +932,9 @@ static void test_marshal_VARIANT(void) ...@@ -938,9 +932,9 @@ static void test_marshal_VARIANT(void)
/* check_variant_header tests wReserved[123], so initialize to unique values. /* check_variant_header tests wReserved[123], so initialize to unique values.
* (Could probably also do this by setting the variant to a known DECIMAL.) * (Could probably also do this by setting the variant to a known DECIMAL.)
*/ */
V_U2(&v).wReserved1 = 0x1234; v.wReserved1 = 0x1234;
V_U2(&v).wReserved2 = 0x5678; v.wReserved2 = 0x5678;
V_U2(&v).wReserved3 = 0x9abc; v.wReserved3 = 0x9abc;
/* Variants have an alignment of 8 */ /* Variants have an alignment of 8 */
rpcMsg.BufferLength = stubMsg.BufferLength = VARIANT_UserSize(&umcb.Flags, 1, &v); rpcMsg.BufferLength = stubMsg.BufferLength = VARIANT_UserSize(&umcb.Flags, 1, &v);
...@@ -1306,9 +1300,9 @@ static void test_marshal_VARIANT(void) ...@@ -1306,9 +1300,9 @@ static void test_marshal_VARIANT(void)
/* check_variant_header tests wReserved[123], so initialize to unique values. /* check_variant_header tests wReserved[123], so initialize to unique values.
* (Could probably also do this by setting the variant to a known DECIMAL.) * (Could probably also do this by setting the variant to a known DECIMAL.)
*/ */
V_U2(&v2).wReserved1 = 0x0123; v2.wReserved1 = 0x0123;
V_U2(&v2).wReserved2 = 0x4567; v2.wReserved2 = 0x4567;
V_U2(&v2).wReserved3 = 0x89ab; v2.wReserved3 = 0x89ab;
stubMsg.Buffer = buffer; stubMsg.Buffer = buffer;
next = VARIANT_UserUnmarshal(&umcb.Flags, buffer, &v2); next = VARIANT_UserUnmarshal(&umcb.Flags, buffer, &v2);
......
...@@ -400,9 +400,9 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, ...@@ -400,9 +400,9 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer,
header->clSize = 0; /* fixed up at the end */ header->clSize = 0; /* fixed up at the end */
header->rpcReserved = 0; header->rpcReserved = 0;
header->vt = V_VT(pvar); header->vt = V_VT(pvar);
header->wReserved1 = pvar->n1.n2.wReserved1; header->wReserved1 = pvar->wReserved1;
header->wReserved2 = pvar->n1.n2.wReserved2; header->wReserved2 = pvar->wReserved2;
header->wReserved3 = pvar->n1.n2.wReserved3; header->wReserved3 = pvar->wReserved3;
header->switch_is = V_VT(pvar); header->switch_is = V_VT(pvar);
if(header->switch_is & VT_ARRAY) if(header->switch_is & VT_ARRAY)
header->switch_is &= ~VT_TYPEMASK; header->switch_is &= ~VT_TYPEMASK;
...@@ -566,9 +566,9 @@ unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffe ...@@ -566,9 +566,9 @@ unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffe
} }
V_VT(pvar) = header->vt; V_VT(pvar) = header->vt;
pvar->n1.n2.wReserved1 = header->wReserved1; pvar->wReserved1 = header->wReserved1;
pvar->n1.n2.wReserved2 = header->wReserved2; pvar->wReserved2 = header->wReserved2;
pvar->n1.n2.wReserved3 = header->wReserved3; pvar->wReserved3 = header->wReserved3;
if(header->vt & VT_ARRAY) if(header->vt & VT_ARRAY)
{ {
......
...@@ -142,7 +142,7 @@ const USHORT FADF_CREATEVECTOR = 0x2000; /* This array is a vector */ ...@@ -142,7 +142,7 @@ const USHORT FADF_CREATEVECTOR = 0x2000; /* This array is a vector */
/* Variant */ /* Variant */
cpp_quote("#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)") cpp_quote("#ifdef NONAMELESSUNION")
cpp_quote("#define __VARIANT_NAME_1 n1") cpp_quote("#define __VARIANT_NAME_1 n1")
cpp_quote("#define __VARIANT_NAME_2 n2") cpp_quote("#define __VARIANT_NAME_2 n2")
cpp_quote("#define __VARIANT_NAME_3 n3") cpp_quote("#define __VARIANT_NAME_3 n3")
......
...@@ -112,7 +112,7 @@ WINOLEAUTAPI HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFG ...@@ -112,7 +112,7 @@ WINOLEAUTAPI HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFG
*/ */
/* Macros for accessing the fields of the VARIANT type */ /* Macros for accessing the fields of the VARIANT type */
#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION) #ifdef NONAMELESSUNION
#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_UNION(A,B) ((A)->n1.n2.n3.B)
#define V_RECORD(A) (V_UNION(A,brecVal).pvRecord) #define V_RECORD(A) (V_UNION(A,brecVal).pvRecord)
...@@ -140,7 +140,7 @@ WINOLEAUTAPI HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFG ...@@ -140,7 +140,7 @@ WINOLEAUTAPI HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFG
#define V_CYREF(A) V_UNION(A,pcyVal) #define V_CYREF(A) V_UNION(A,pcyVal)
#define V_DATE(A) V_UNION(A,date) #define V_DATE(A) V_UNION(A,date)
#define V_DATEREF(A) V_UNION(A,pdate) #define V_DATEREF(A) V_UNION(A,pdate)
#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION) #ifdef NONAMELESSUNION
#define V_DECIMAL(A) ((A)->n1.decVal) #define V_DECIMAL(A) ((A)->n1.decVal)
#else #else
#define V_DECIMAL(A) ((A)->decVal) #define V_DECIMAL(A) ((A)->decVal)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment