Alex Villacís Lasso a_villacis@palosanto.com writes:
+#define HANDLE_DISPATCH(left, right) \
- if ((V_VT(param_left) & VT_TYPEMASK) == VT_DISPATCH && \
(V_VT(param_right) & VT_TYPEMASK) != VT_NULL) \
- {\
HRESULT hres;\
left = &tempLeft;\
hres = VARIANT_FetchDispatchValue(param_left, left);\
if (!SUCCEEDED(hres)) return hres;\
- }\
- if ((V_VT(param_right) & VT_TYPEMASK) == VT_DISPATCH &&\
(V_VT(param_left) & VT_TYPEMASK) != VT_NULL)\
- {\
HRESULT hres;\
right = &tempRight;\
hres = VARIANT_FetchDispatchValue(param_right, right);\
if (!SUCCEEDED(hres)) return hres;\
- }
This macro is quite ugly. Also I don't see why you check the other variant against VT_NULL first, aren't there cases where you still need the other value?
Alexandre Julliard escribió:
Alex Villacís Lasso a_villacis@palosanto.com writes:
+#define HANDLE_DISPATCH(left, right) \
- if ((V_VT(param_left) & VT_TYPEMASK) == VT_DISPATCH && \
(V_VT(param_right) & VT_TYPEMASK) != VT_NULL) \
- {\
HRESULT hres;\
left = &tempLeft;\
hres = VARIANT_FetchDispatchValue(param_left, left);\
if (!SUCCEEDED(hres)) return hres;\
- }\
- if ((V_VT(param_right) & VT_TYPEMASK) == VT_DISPATCH &&\
(V_VT(param_left) & VT_TYPEMASK) != VT_NULL)\
- {\
HRESULT hres;\
right = &tempRight;\
hres = VARIANT_FetchDispatchValue(param_right, right);\
if (!SUCCEEDED(hres)) return hres;\
- }
This macro is quite ugly. Also I don't see why you check the other variant against VT_NULL first, aren't there cases where you still need the other value?
If I remove the check for VT_NULL on the other variant, I get this test failure:
../../../tools/runtest -q -P wine -M oleaut32.dll -T ../../.. -p oleaut32_test.exe.so vartest.c && touch vartest.ok fixme:variant:VarMod Could not convert left type 4096 to 20? rc == 0x80020008 fixme:variant:VarMod Could not convert left type 8192 to 20? rc == 0x80020008 fixme:variant:VarMod Could not convert left type 16384 to 20? rc == 0x80020008 vartest.c:4910: Test failed: VarAdd: 1|0x0, 9|0x0: expected S_OK, vt 1, got 0x80020005 vt 0 vartest.c:4910: Test failed: VarAdd: 9|0x0, 1|0x0: expected S_OK, vt 1, got 0x80020005 vt 0 make: *** [vartest.ok] Error 2
This happens because for VarAdd, VT_NULL + VT_DISPATCH should succeed and give VT_NULL as a result, but the patch fetches the result value of the VT_DISPATCH before doing anything else. For null VT_DISPATCHs like the ones the test feeds the function, this causes the fetch to fail before the code for handling VT_NULLs is reached.