Michael Stefaniuc : mshtml/tests: Get rid of strcmp_wa() in activex.c.

Alexandre Julliard julliard at winehq.org
Wed Feb 12 16:21:05 CST 2020


Module: wine
Branch: master
Commit: e787d1ac718d26420ab68d7595010348ff1e8819
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e787d1ac718d26420ab68d7595010348ff1e8819

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Feb 12 00:25:18 2020 +0100

mshtml/tests: Get rid of strcmp_wa() in activex.c.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/tests/activex.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/dlls/mshtml/tests/activex.c b/dlls/mshtml/tests/activex.c
index 8b6a47c391..a9af72d91c 100644
--- a/dlls/mshtml/tests/activex.c
+++ b/dlls/mshtml/tests/activex.c
@@ -195,13 +195,6 @@ static void _test_ifaces(unsigned line, IUnknown *iface, REFIID *iids)
     }
 }
 
-static int strcmp_wa(LPCWSTR strw, const char *stra)
-{
-    CHAR buf[512];
-    WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
-    return lstrcmpA(stra, buf);
-}
-
 static BSTR a2bstr(const char *str)
 {
     BSTR ret;
@@ -235,7 +228,7 @@ static void set_plugin_readystate(READYSTATE state)
     IPropertyNotifySink_Release(prop_notif);
 }
 
-static void test_mon_displayname(IMoniker *mon, const char *exname, const char *broken_name)
+static void test_mon_displayname(IMoniker *mon, const WCHAR *exname, const WCHAR *broken_name)
 {
     LPOLESTR display_name;
     DWORD mksys;
@@ -243,7 +236,7 @@ static void test_mon_displayname(IMoniker *mon, const char *exname, const char *
 
     hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
     ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
-    ok(!strcmp_wa(display_name, exname) || broken(broken_name && !strcmp_wa(display_name, broken_name)),
+    ok(!lstrcmpW(display_name, exname) || broken(broken_name && !lstrcmpW(display_name, broken_name)),
         "display_name = %s\n", wine_dbgstr_w(display_name));
     CoTaskMemFree(display_name);
 
@@ -591,7 +584,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
     hres = IPropertyBag_Read(pPropBag, param_nameW, &v, NULL);
     ok(hres == S_OK, "Read failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(&v) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "param_value"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"param_value"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
 
     V_VT(&v) = VT_I4;
     V_I4(&v) = 0xdeadbeef;
@@ -604,7 +597,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
     hres = IPropertyBag_Read(pPropBag, num_paramW, &v, NULL);
     ok(hres == S_OK, "Read failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(&v) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"3"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
     SysFreeString(V_BSTR(&v));
 
     V_VT(&v) = VT_I4;
@@ -640,7 +633,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
     hres = IBindHost_CreateMoniker(bind_host, test_swfW, NULL, &mon, 0);
     ok(hres == S_OK, "CreateMoniker failed: %08x\n", hres);
     ok(mon != NULL, "mon == NULL\n");
-    test_mon_displayname(mon, "about:test.swf", "about:blanktest.swf");
+    test_mon_displayname(mon, L"about:test.swf", L"about:blanktest.swf");
     IMoniker_Release(mon);
 
     IBindHost_Release(bind_host);
@@ -649,7 +642,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
     hres = IOleClientSite_GetMoniker(client_site, OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_CONTAINER, &mon);
     ok(hres == S_OK, "GetMoniker failed: %08x\n", hres);
     ok(mon != NULL, "mon == NULL\n");
-    test_mon_displayname(mon, "about:blank", NULL);
+    test_mon_displayname(mon, L"about:blank", NULL);
     IMoniker_Release(mon);
 
     set_plugin_readystate(READYSTATE_COMPLETE);
@@ -715,10 +708,10 @@ static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOL
     ok(rgszNames != NULL, "rgszNames == NULL\n");
     ok(rgDispId != NULL, "rgDispId == NULL\n");
 
-    if(!strcmp_wa(rgszNames[0], "scriptprop")) {
+    if(!lstrcmpW(rgszNames[0], L"scriptprop")) {
         CHECK_EXPECT(GetIDsOfNames_scriptprop);
         *rgDispId = DISPID_SCRIPTPROP;
-    }else if(!strcmp_wa(rgszNames[0], "scriptCall")) {
+    }else if(!lstrcmpW(rgszNames[0], L"scriptCall")) {
         *rgDispId = DISPID_SCRIPTCALL;
     }else {
         ok(0, "rgszNames[0] = %s\n", wine_dbgstr_w(rgszNames[0]));
@@ -1660,13 +1653,13 @@ static void test_object_elem(IHTMLDocument2 *doc)
     hres = IHTMLObjectElement_get_width(objelem, &v);
     ok(hres == S_OK, "get_width failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(width) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "300"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"300"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
     hres = IHTMLObjectElement_get_height(objelem, &v);
     ok(hres == S_OK, "get_height failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(height) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "200"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"200"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
     V_VT(&v) = VT_I4;
@@ -1681,7 +1674,7 @@ static void test_object_elem(IHTMLDocument2 *doc)
     hres = IHTMLObjectElement_get_width(objelem, &v);
     ok(hres == S_OK, "get_width failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(width) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "400"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"400"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
     V_VT(&v) = VT_I4;
@@ -1696,7 +1689,7 @@ static void test_object_elem(IHTMLDocument2 *doc)
     hres = IHTMLObjectElement_get_height(objelem, &v);
     ok(hres == S_OK, "get_height failed: %08x\n", hres);
     ok(V_VT(&v) == VT_BSTR, "V_VT(height) = %d\n", V_VT(&v));
-    ok(!strcmp_wa(V_BSTR(&v), "250"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    ok(!lstrcmpW(V_BSTR(&v), L"250"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
     IHTMLObjectElement_Release(objelem);




More information about the wine-cvs mailing list