Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/oleaut32/tests/tmarshal.c | 25 ++++++++++--------------- dlls/oleaut32/tests/typelib.c | 4 ++-- dlls/oleaut32/tests/vartest.c | 12 ++++++------ 3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index a61b1637c5e7..53861870e78b 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -39,21 +39,18 @@ static inline void release_iface_(unsigned int line, void *iface) } #define release_iface(a) release_iface_(__LINE__, a)
-/* ULL suffix is not portable */ -#define ULL_CONST(dw1, dw2) ((((ULONGLONG)dw1) << 32) | (ULONGLONG)dw2) - static const WCHAR test_bstr1[] = {'f','o','o',0,'b','a','r'}; static const WCHAR test_bstr2[] = {'t','e','s','t',0}; static const WCHAR test_bstr3[] = {'q','u','x',0}; static const WCHAR test_bstr4[] = {'a','b','c',0};
-static const MYSTRUCT test_mystruct1 = {0x12345678, ULL_CONST(0xdeadbeef, 0x98765432), {0,1,2,3,4,5,6,7}}; -static const MYSTRUCT test_mystruct2 = {0x91827364, ULL_CONST(0x88776655, 0x44332211), {3,6,1,4,0,1,3,0}}; -static const MYSTRUCT test_mystruct3 = {0x1a1b1c1d, ULL_CONST(0x1e1f1011, 0x12131415), {9,2,4,5,6,5,1,3}}; -static const MYSTRUCT test_mystruct4 = {0x2a2b2c2d, ULL_CONST(0x2e2f2021, 0x22232425), {0,4,6,7,3,6,7,4}}; -static const MYSTRUCT test_mystruct5 = {0x3a3b3c3d, ULL_CONST(0x3e3f3031, 0x32333435), {1,6,7,3,8,4,6,5}}; -static const MYSTRUCT test_mystruct6 = {0x4a4b4c4d, ULL_CONST(0x4e4f4041, 0x42434445), {3,6,5,3,4,8,0,9}}; -static const MYSTRUCT test_mystruct7 = {0x5a5b5c5d, ULL_CONST(0x5e5f5051, 0x52535455), {1,8,4,4,4,2,3,1}}; +static const MYSTRUCT test_mystruct1 = {0x12345678, 0xdeadbeef98765432ull, {0,1,2,3,4,5,6,7}}; +static const MYSTRUCT test_mystruct2 = {0x91827364, 0x8877665544332211ull, {3,6,1,4,0,1,3,0}}; +static const MYSTRUCT test_mystruct3 = {0x1a1b1c1d, 0x1e1f101112131415ull, {9,2,4,5,6,5,1,3}}; +static const MYSTRUCT test_mystruct4 = {0x2a2b2c2d, 0x2e2f202122232425ull, {0,4,6,7,3,6,7,4}}; +static const MYSTRUCT test_mystruct5 = {0x3a3b3c3d, 0x3e3f303132333435ull, {1,6,7,3,8,4,6,5}}; +static const MYSTRUCT test_mystruct6 = {0x4a4b4c4d, 0x4e4f404142434445ull, {3,6,5,3,4,8,0,9}}; +static const MYSTRUCT test_mystruct7 = {0x5a5b5c5d, 0x5e5f505152535455ull, {1,8,4,4,4,2,3,1}};
static const struct thin test_thin_struct = {-456, 78};
@@ -1134,7 +1131,7 @@ static HRESULT WINAPI Widget_basetypes_out(IWidget *iface, signed char *c, short *uc = 254; *us = 256; *ul = 0xf00dfade; - *uh = (((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789; + *uh = 0xabcdef0123456789ull; *f = M_LN2; *d = M_LN10; *st = STATE_UNWIDGETIFIED; @@ -2033,8 +2030,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp) ok(uc == 254, "Got unsigned char %u.\n", uc); ok(us == 256, "Got unsigned short %u.\n", us); ok(ul == 0xf00dfade, "Got unsigned int %li.\n", ul); - ok(uh == ((((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789), - "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh)); + ok(uh == 0xabcdef0123456789ull, "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh)); ok(f == (float)M_LN2, "Got float %f.\n", f); ok(d == M_LN10, "Got double %f.\n", d); ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st); @@ -2050,8 +2046,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp) ok(uc == 254, "Got unsigned char %u.\n", uc); ok(us == 256, "Got unsigned short %u.\n", us); ok(ul == 0xf00dfade, "Got unsigned int %li.\n", ul); - ok(uh == ((((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789), - "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh)); + ok(uh == 0xabcdef0123456789ull, "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh)); ok(f == (float)M_LN2, "Got float %f.\n", f); ok(d == M_LN10, "Got double %f.\n", d); ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st); diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 44d5b26cbc40..b273f72ac8d0 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -1194,7 +1194,7 @@ static double WINAPI double_func( double a0, float a1, double a2, int a3 )
static LONGLONG WINAPI longlong_func( LONGLONG a0, CY a1 ) { - ok( a0 == (((ULONGLONG)0xdead << 32) | 0xbeef), "wrong arg0 %08lx%08lx\n", (DWORD)(a0 >> 32), (DWORD)a0); + ok( a0 == 0xdead00000000beefll, "wrong arg0 %08lx%08lx\n", (DWORD)(a0 >> 32), (DWORD)a0); ok( a1.int64 == ((ULONGLONG)10000 * 12345678), "wrong arg1 %08lx%08lx\n", (DWORD)(a1.int64 >> 32), (DWORD)a1.int64 ); return ((ULONGLONG)4321 << 32) | 8765; @@ -1379,7 +1379,7 @@ static void test_DispCallFunc(void)
memset( args, 0x55, sizeof(args) ); types[0] = VT_I8; - V_I8(&args[0]) = ((ULONGLONG)0xdead << 32) | 0xbeef; + V_I8(&args[0]) = 0xdead00000000beefll; types[1] = VT_CY; V_CY(&args[1]).int64 = (ULONGLONG)10000 * 12345678; memset( &result, 0xcc, sizeof(result) ); diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index db0562e2d037..b6ccc083ad42 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -2514,9 +2514,9 @@ static const char *szFailOk = "Call failed, hres = %08x\n"; ok(V_I4(&vOut) == val, "Expected i4 = %ld, got %ld\n", (LONG)val, V_I4(&vOut)); } #define EXPECT_UI4(val) EXPECT_OK { EXPECT_TYPE(VT_UI4); \ ok(V_UI4(&vOut) == val, "Expected ui4 = %d, got %d\n", (ULONG)val, V_UI4(&vOut)); } -#define EXPECT_I8(high,low) EXPECT_OK { EXPECT_TYPE(VT_I8); \ - ok(V_I8(&vOut) == ((((ULONG64)(high))<<32)|(low)), "Expected i8 = %lx%08lx, got %lx%08lx\n", \ - (LONG)(high), (LONG)(low), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); } +#define EXPECT_I8(val) EXPECT_OK { EXPECT_TYPE(VT_I8); \ + ok(V_I8(&vOut) == val, "Expected i8 = %lx%08lx, got %lx%08lx\n", \ + (LONG)(val >> 32), (LONG)(val), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); } #define EXPECT_UI8(val) EXPECT_OK { EXPECT_TYPE(VT_UI8); \ ok(V_UI8(&vOut) == val, "Expected ui8 = 0x%x%08x, got 0x%x%08x\n", \ (DWORD)((ULONG64)val >> 32), (DWORD)(ULONG64)val, (DWORD)(V_UI8(&vOut) >> 32), (DWORD)V_UI8(&vOut)); } @@ -2615,7 +2615,7 @@ static void test_VarNumFromParseNum(void) /* We cannot use INTEGER_VTBITS as WinXP and Win2003 are broken(?). They truncate the number to the smallest integer size requested: CONVERT(16,0,0,16,4,0, INTEGER_VTBITS); EXPECT_I1((signed char)0xff); */ - CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x7fffffff,0xffffffff); + CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x7fffffffffffffffull); }
/* Assume the above pattern holds for numbers without hi-bit set, test (preservation of) hi-bit */ @@ -2642,7 +2642,7 @@ static void test_VarNumFromParseNum(void) truncate the number to the smallest integer size requested: CONVERT(16,0,0,16,4,0, INTEGER_VTBITS & ~VTBIT_I1); EXPECT_I2((signed short)0x0002); */ - CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x80000000,0x00000002); + CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x8000000000000002ull); }
/* Test (preservation of) hi-bit with STRICT type requesting */ @@ -2665,7 +2665,7 @@ static void test_VarNumFromParseNum(void) SETRGB(12, 0); SETRGB(13, 0); SETRGB(14, 0); SETRGB(15, 2); if (has_i8) { - CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x80000000,0x00000002); + CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x8000000000000002ull); } /* Assume the above pattern holds for numbers with hi-bit set */
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/oleaut32/tests/typelib.c | 11 +++++------ dlls/oleaut32/tests/vartest.c | 34 ++++++++++++++++------------------ dlls/oleaut32/tests/vartype.c | 4 ++-- 3 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index b273f72ac8d0..2e926a5bc360 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -1194,9 +1194,8 @@ static double WINAPI double_func( double a0, float a1, double a2, int a3 )
static LONGLONG WINAPI longlong_func( LONGLONG a0, CY a1 ) { - ok( a0 == 0xdead00000000beefll, "wrong arg0 %08lx%08lx\n", (DWORD)(a0 >> 32), (DWORD)a0); - ok( a1.int64 == ((ULONGLONG)10000 * 12345678), "wrong arg1 %08lx%08lx\n", - (DWORD)(a1.int64 >> 32), (DWORD)a1.int64 ); + ok( a0 == 0xdead00000000beefll, "wrong arg0 %#I64x\n", a0); + ok( a1.int64 == ((ULONGLONG)10000 * 12345678), "wrong arg1 %#I64x\n", a1.int64 ); return ((ULONGLONG)4321 << 32) | 8765; }
@@ -1208,7 +1207,7 @@ static VARIANT WINAPI variant_func( int a0, BOOL a1, DECIMAL a2, VARIANT a3 ) V_VT(&var) = VT_LPWSTR; V_UI4(&var) = 0xbabe; ok( a2.Hi32 == 1122, "wrong arg2.Hi32 %lx\n", a2.Hi32 ); - ok( U1(a2).Lo64 == 3344, "wrong arg2.Lo64 %08lx%08lx\n", (DWORD)(U1(a2).Lo64 >> 32), (DWORD)U1(a2).Lo64 ); + ok( U1(a2).Lo64 == 3344, "wrong arg2.Lo64 %#I64x\n", U1(a2).Lo64 ); ok( V_VT(&a3) == VT_EMPTY, "wrong arg3 type %x\n", V_VT(&a3) ); ok( V_UI4(&a3) == 0xdeadbeef, "wrong arg3 value %lx\n", V_UI4(&a3) ); return var; @@ -1389,8 +1388,8 @@ static void test_DispCallFunc(void) if (res == S_OK) { ok( V_VT(&result) == VT_I8, "wrong result type %d\n", V_VT(&result) ); - ok( V_I8(&result) == (((ULONGLONG)4321 << 32) | 8765), "wrong result %08lx%08lx\n", - (DWORD)(V_I8(&result) >> 32), (DWORD)V_I8(&result) ); + ok( V_I8(&result) == (((ULONGLONG)4321 << 32) | 8765), "wrong result %#I64x\n", + V_I8(&result) ); }
memset( args, 0x55, sizeof(args) ); diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index b6ccc083ad42..9456b56eb269 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -558,9 +558,9 @@ static const char *variantstr( const VARIANT *var ) case VT_INT: sprintf( vtstr_buffer[vtstr_current], "VT_INT(%d)", V_INT(var) ); break; case VT_I8: - sprintf( vtstr_buffer[vtstr_current], "VT_I8(%x%08x)", (UINT)(V_I8(var) >> 32), (UINT)V_I8(var) ); break; + sprintf( vtstr_buffer[vtstr_current], "VT_I8(%I64x)", V_I8(var) ); break; case VT_UI8: - sprintf( vtstr_buffer[vtstr_current], "VT_UI8(%x%08x)", (UINT)(V_UI8(var) >> 32), (UINT)V_UI8(var) ); break; + sprintf( vtstr_buffer[vtstr_current], "VT_UI8(%I64x)", V_UI8(var) ); break; case VT_R4: sprintf( vtstr_buffer[vtstr_current], "VT_R4(%g)", V_R4(var) ); break; case VT_R8: @@ -2515,19 +2515,17 @@ static const char *szFailOk = "Call failed, hres = %08x\n"; #define EXPECT_UI4(val) EXPECT_OK { EXPECT_TYPE(VT_UI4); \ ok(V_UI4(&vOut) == val, "Expected ui4 = %d, got %d\n", (ULONG)val, V_UI4(&vOut)); } #define EXPECT_I8(val) EXPECT_OK { EXPECT_TYPE(VT_I8); \ - ok(V_I8(&vOut) == val, "Expected i8 = %lx%08lx, got %lx%08lx\n", \ - (LONG)(val >> 32), (LONG)(val), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); } + ok(V_I8(&vOut) == val, "Expected i8 = %#I64x, got %#I64x\n", (LONG64)val, V_I8(&vOut)); } #define EXPECT_UI8(val) EXPECT_OK { EXPECT_TYPE(VT_UI8); \ - ok(V_UI8(&vOut) == val, "Expected ui8 = 0x%x%08x, got 0x%x%08x\n", \ - (DWORD)((ULONG64)val >> 32), (DWORD)(ULONG64)val, (DWORD)(V_UI8(&vOut) >> 32), (DWORD)V_UI8(&vOut)); } + ok(V_UI8(&vOut) == val, "Expected ui8 = %#I64x, got %#I64x\n", (ULONG64)val, V_UI8(&vOut); } #define EXPECT_R4(val) EXPECT_OK { EXPECT_TYPE(VT_R4); \ ok(V_R4(&vOut) == val, "Expected r4 = %f, got %f\n", val, V_R4(&vOut)); } #define EXPECT_R8(val) EXPECT_OK { EXPECT_TYPE(VT_R8); \ ok(V_R8(&vOut) == val, "Expected r8 = %g, got %g\n", val, V_R8(&vOut)); } #define CY_MULTIPLIER 10000 #define EXPECT_CY(val) EXPECT_OK { EXPECT_TYPE(VT_CY); \ - ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = 0x%lx%08lx, got 0x%lx%08lx\n", \ - (DWORD)((LONG64)val >> 23), (DWORD)(LONG64)val, (DWORD)(V_CY(&vOut).int64 >>32), (DWORD)V_CY(&vOut).int64); } + ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = %#I64x, got %#I64x\n", \ + (LONG64)val, V_CY(&vOut).int64); } #define EXPECT_DECIMAL(valHi, valMid, valLo) EXPECT_OK { EXPECT_TYPE(VT_DECIMAL); \ ok((V_DECIMAL(&vOut).Hi32 == valHi) && (S1(U1(V_DECIMAL(&vOut))).Mid32 == valMid) && \ (S1(U1(V_DECIMAL(&vOut))).Lo32 == valLo), \ @@ -4221,8 +4219,8 @@ static void test_VarInt(void) pcy->int64 = -11000; hres = pVarInt(&v,&vDst); ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == -20000, - "VarInt: VT_CY wrong, hres=0x%lX 0x%lx%08lx\n", - hres, (DWORD)(V_CY(&vDst).int64 >> 32), (DWORD)V_CY(&vDst).int64); + "VarInt: VT_CY wrong, hres=%#lX %#I64x\n", + hres, V_CY(&vDst).int64); }
static HRESULT (WINAPI *pVarNeg)(LPVARIANT,LPVARIANT); @@ -9315,8 +9313,8 @@ static void test_VarIdiv(void) "VARIDIV: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", S_OK, hres, vtstr(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == 5000, - "VARIDIV: CY value 0x%lx%08lx, expected 0x%x\n", - (DWORD)(V_I8(&result) >>32), (DWORD)V_I8(&result), 5000); + "VARIDIV: CY value %#I64x, expected %#x\n", + V_I8(&result), 5000); }
hres = pVarIdiv(&left, &cy, &result); @@ -9347,8 +9345,8 @@ static void test_VarIdiv(void) "VARIDIV: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", S_OK, hres, vtstr(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == 1, - "VARIDIV: DECIMAL value 0x%lx%08lx, expected %d\n", - (DWORD)(V_I8(&result) >> 32), (DWORD)V_I8(&result), 1); + "VARIDIV: DECIMAL value %I64d, expected %d\n", + V_I8(&result), 1); }
/* Check for division by zero */ @@ -9895,8 +9893,8 @@ static void test_VarImp(void) "VARIMP: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", S_OK, hres, vtstr(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == -2, - "VARIMP: CY value %lx%08lx, expected %d\n", - (DWORD)((V_I8(&result)) >> 32), (DWORD)(V_I8(&result)), -2); + "VARIMP: CY value %I64d, expected %d\n", + V_I8(&result), -2); }
hres = pVarImp(&left, &cy, &result); @@ -9927,8 +9925,8 @@ static void test_VarImp(void) "VARIMP: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", S_OK, hres, vtstr(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == -3, - "VARIMP: DECIMAL value 0x%lx%08lx, expected %d\n", - (DWORD)(V_I8(&result) >>32), (DWORD)V_I8(&result), -3); + "VARIMP: DECIMAL value %#I64x, expected %d\n", + V_I8(&result), -3); }
SysFreeString(false_str); diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c index 78b50e6bcdb8..c5137572d9d5 100644 --- a/dlls/oleaut32/tests/vartype.c +++ b/dlls/oleaut32/tests/vartype.c @@ -3618,8 +3618,8 @@ static void test_VarCyInt(void) #define EXPECTDEC(scl, sgn, hi, lo) ok(hres == S_OK && \ S(U(out)).scale == (BYTE)(scl) && S(U(out)).sign == (BYTE)(sgn) && \ out.Hi32 == (ULONG)(hi) && U1(out).Lo64 == (ULONG64)(lo), \ - "expected (%d,%d,%d,(%lx %lx)), got (%d,%d,%ld,(%lx %lx)) hres 0x%08lx\n", \ - scl, sgn, hi, (LONG)((LONG64)(lo) >> 32), (LONG)((lo) & 0xffffffff), S(U(out)).scale, \ + "expected (%d,%d,%d,%I64x), got (%d,%d,%ld,(%lx %lx)) hres 0x%08lx\n", \ + scl, sgn, hi, (LONG64)(lo), S(U(out)).scale, \ S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres)
#define EXPECTDEC64(scl, sgn, hi, mid, lo) ok(hres == S_OK && \