vbscript/tests: Get rid of strcmp_wa().

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-02-27 21:17:50 +01:00 committed by Alexandre Julliard
parent 4aebd6a95f
commit b3fbc70291
2 changed files with 7 additions and 21 deletions

View File

@ -131,13 +131,6 @@ static BSTR a2bstr(const char *str)
return ret;
}
static int strcmp_wa(LPCWSTR strw, const char *stra)
{
CHAR buf[512];
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
return lstrcmpA(buf, stra);
}
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
{
ok(0, "unexpected call\n");
@ -286,7 +279,7 @@ static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown
static HRESULT WINAPI Test_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
{
if(!strcmp_wa(bstrName, "reportSuccess")) {
if(!lstrcmpW(bstrName, L"reportSuccess")) {
ok(grfdex == fdexNameCaseInsensitive, "grfdex = %x\n", grfdex);
*pid = DISPID_TEST_REPORTSUCCESS;
return S_OK;
@ -342,7 +335,7 @@ static IDispatchEx testObj = { &testObjVtbl };
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
{
if(!strcmp_wa(bstrName, "ok")) {
if(!lstrcmpW(bstrName, L"ok")) {
ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
*pid = DISPID_GLOBAL_OK;
return S_OK;
@ -620,7 +613,7 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
{
ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask);
ok(!ppti, "ppti != NULL\n");
ok(!strcmp_wa(pstrName, "test"), "pstrName = %s\n", wine_dbgstr_w(pstrName));
ok(!lstrcmpW(pstrName, L"test"), "pstrName = %s\n", wine_dbgstr_w(pstrName));
*ppiunkItem = (IUnknown*)&globalObj;
return S_OK;

View File

@ -179,13 +179,6 @@ static BSTR a2bstr(const char *str)
return ret;
}
static int strcmp_wa(LPCWSTR strw, const char *stra)
{
CHAR buf[512];
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
return lstrcmpA(buf, stra);
}
static const char *vt2a(VARIANT *v)
{
if(V_VT(v) == (VT_BYREF|VT_VARIANT)) {
@ -1040,7 +1033,7 @@ static IDispatchEx enumDisp = { &enumDispVtbl };
static HRESULT WINAPI collectionObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
{
if(!strcmp_wa(bstrName, "reset")) {
if(!lstrcmpW(bstrName, L"reset")) {
*pid = DISPID_COLLOBJ_RESET;
return S_OK;
}
@ -1841,7 +1834,7 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask);
ok(!ppti, "ppti != NULL\n");
if(strcmp_wa(pstrName, "test"))
if(lstrcmpW(pstrName, L"test"))
ok(0, "unexpected pstrName %s\n", wine_dbgstr_w(pstrName));
*ppiunkItem = (IUnknown*)&Global;
@ -2190,7 +2183,7 @@ static void test_procedures(void)
CHECK_CALLED(OnEnterScript);
CHECK_CALLED(OnLeaveScript);
ok(V_VT(&v) == VT_BSTR, "Expected VT_BSTR, got %s\n", vt2a(&v));
ok(!strcmp_wa(V_BSTR(&v), "foobar"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&v)));
ok(!lstrcmpW(V_BSTR(&v), L"foobar"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
IDispatchEx_Release(proc);
@ -2789,7 +2782,7 @@ static void test_isexpression(void)
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
ok(V_VT(&var) == VT_BSTR, "Expected VT_BSTR, got %s\n", vt2a(&var));
ok(!strcmp_wa(V_BSTR(&var), "foo is 42"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&var)));
ok(!lstrcmpW(V_BSTR(&var), L"foo is 42"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
SysFreeString(str);