urlmon/tests: Use the global wine_dbgstr_w instead of a local variant.

This commit is contained in:
Alexandre Julliard 2009-08-19 13:37:04 +02:00
parent 44e874ab86
commit 203bf6c8e0
3 changed files with 24 additions and 47 deletions

View File

@ -63,13 +63,6 @@ DEFINE_EXPECT(QI_IInternetProtocolInfo);
DEFINE_EXPECT(CreateInstance); DEFINE_EXPECT(CreateInstance);
DEFINE_EXPECT(unk_Release); DEFINE_EXPECT(unk_Release);
static const char *debugstr_w(LPCWSTR str)
{
static char buf[1024];
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static void test_CreateFormatEnum(void) static void test_CreateFormatEnum(void)
{ {
IEnumFORMATETC *fenum = NULL, *fenum2 = NULL; IEnumFORMATETC *fenum = NULL, *fenum2 = NULL;
@ -653,7 +646,7 @@ static void test_FindMimeFromData(void)
hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
NULL, 0, &mime, 0); NULL, 0, &mime, 0);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, debugstr_w(mime)); ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime); CoTaskMemFree(mime);
hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
@ -674,7 +667,7 @@ static void test_FindMimeFromData(void)
else else
ok(!lstrcmpW(mime, mime_tests2[i].mime) || ok(!lstrcmpW(mime, mime_tests2[i].mime) ||
(mime_tests2[i].mime_alt && !lstrcmpW(mime, mime_tests2[i].mime_alt)), (mime_tests2[i].mime_alt && !lstrcmpW(mime, mime_tests2[i].mime_alt)),
"[%d] wrong mime, got '%s'\n", i, debugstr_w(mime)); "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime); CoTaskMemFree(mime);
} }
@ -1307,7 +1300,7 @@ static void test_MkParseDisplayNameEx(void)
hres = IMoniker_GetDisplayName(mon, NULL, 0, &name); hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres); ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
ok(!lstrcmpW(name, url9), "wrong display name %s\n", debugstr_w(name)); ok(!lstrcmpW(name, url9), "wrong display name %s\n", wine_dbgstr_w(name));
CoTaskMemFree(name); CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys); hres = IMoniker_IsSystemMoniker(mon, &issys);

View File

@ -172,15 +172,6 @@ static const WCHAR binding_urls[][130] = {
{'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0} {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}
}; };
static const char *debugstr_w(LPCWSTR str)
{
static char buf[512];
if(!str)
return "(null)";
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static const char *debugstr_guid(REFIID riid) static const char *debugstr_guid(REFIID riid)
{ {
static char buf[50]; static char buf[50];
@ -567,7 +558,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
if(binding_test) if(binding_test)
ok(!strcmp_ww(szStatusText, expect_wsz), "unexpected szStatusText\n"); ok(!strcmp_ww(szStatusText, expect_wsz), "unexpected szStatusText\n");
else if(tested_protocol == FILE_TEST) else if(tested_protocol == FILE_TEST)
ok(!strcmp_ww(szStatusText, file_name), "szStatusText = \"%s\"\n", debugstr_w(szStatusText)); ok(!strcmp_ww(szStatusText, file_name), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
else else
ok(szStatusText != NULL, "szStatusText == NULL\n"); ok(szStatusText != NULL, "szStatusText == NULL\n");
} }
@ -605,28 +596,28 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
break; break;
case BINDSTATUS_REDIRECTING: case BINDSTATUS_REDIRECTING:
CHECK_EXPECT(ReportProgress_REDIRECTING); CHECK_EXPECT(ReportProgress_REDIRECTING);
ok(szStatusText == NULL, "szStatusText = %s\n", debugstr_w(szStatusText)); ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_ENCODING: case BINDSTATUS_ENCODING:
CHECK_EXPECT(ReportProgress_ENCODING); CHECK_EXPECT(ReportProgress_ENCODING);
ok(!strcmp_wa(szStatusText, "gzip"), "szStatusText = %s\n", debugstr_w(szStatusText)); ok(!strcmp_wa(szStatusText, "gzip"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_ACCEPTRANGES: case BINDSTATUS_ACCEPTRANGES:
CHECK_EXPECT(ReportProgress_ACCEPTRANGES); CHECK_EXPECT(ReportProgress_ACCEPTRANGES);
ok(!szStatusText, "szStatusText = %s\n", debugstr_w(szStatusText)); ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_PROXYDETECTING: case BINDSTATUS_PROXYDETECTING:
CHECK_EXPECT(ReportProgress_PROXYDETECTING); CHECK_EXPECT(ReportProgress_PROXYDETECTING);
SET_EXPECT(ReportProgress_CONNECTING); SET_EXPECT(ReportProgress_CONNECTING);
ok(!szStatusText, "szStatusText = %s\n", debugstr_w(szStatusText)); ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_LOADINGMIMEHANDLER: case BINDSTATUS_LOADINGMIMEHANDLER:
CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER); CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
ok(!szStatusText, "szStatusText = %s\n", debugstr_w(szStatusText)); ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_DECODING: case BINDSTATUS_DECODING:
CHECK_EXPECT(ReportProgress_DECODING); CHECK_EXPECT(ReportProgress_DECODING);
ok(!strcmp_ww(szStatusText, gzipW), "szStatusText = %s\n", debugstr_w(szStatusText)); ok(!strcmp_ww(szStatusText, gzipW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break; break;
default: default:
ok(0, "Unexpected status %d\n", ulStatusCode); ok(0, "Unexpected status %d\n", ulStatusCode);
@ -829,7 +820,7 @@ static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface
ok(hrResult == S_OK, "hrResult = %08x\n", hrResult); ok(hrResult == S_OK, "hrResult = %08x\n", hrResult);
ok(dwError == ERROR_SUCCESS, "dwError = %u\n", dwError); ok(dwError == ERROR_SUCCESS, "dwError = %u\n", dwError);
ok(!szResult, "szResult = %s\n", debugstr_w(szResult)); ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
SET_EXPECT(ReportResult); SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult); hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult);
@ -1227,7 +1218,7 @@ static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocol *iface, LPCWSTR szUrl
ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres); ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
ok(fetched == 1, "fetched = %d, expected 254\n", fetched); ok(fetched == 1, "fetched = %d, expected 254\n", fetched);
ok(ua != NULL, "ua = %p\n", ua); ok(ua != NULL, "ua = %p\n", ua);
ok(!strcmp_ww(ua, user_agentW), "unexpected user agent %s\n", debugstr_w(ua)); ok(!strcmp_ww(ua, user_agentW), "unexpected user agent %s\n", wine_dbgstr_w(ua));
CoTaskMemFree(ua); CoTaskMemFree(ua);
fetched = 256; fetched = 256;
@ -1239,7 +1230,7 @@ static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocol *iface, LPCWSTR szUrl
ok(hres == S_OK, ok(hres == S_OK,
"GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres); "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
ok(fetched == 1, "fetched = %d, expected 1\n", fetched); ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
ok(!strcmp_ww(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", debugstr_w(accept_mimes[0])); ok(!strcmp_ww(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider, hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
(void**)&service_provider); (void**)&service_provider);
@ -1570,7 +1561,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
CHECK_EXPECT(MimeFilter_Start); CHECK_EXPECT(MimeFilter_Start);
ok(!strcmp_ww(szUrl, gzipW), "wrong url %s\n", debugstr_w(szUrl)); ok(!strcmp_ww(szUrl, gzipW), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI); ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
ok(dwReserved, "dwReserved == 0\n"); ok(dwReserved, "dwReserved == 0\n");
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n"); ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
@ -1630,7 +1621,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched); hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched);
ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08x\n", hres); ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08x\n", hres);
ok(fetched == 1, "fetched = %d\n", fetched); ok(fetched == 1, "fetched = %d\n", fetched);
ok(!strcmp_ww(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", debugstr_w(url_str)); ok(!strcmp_ww(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", wine_dbgstr_w(url_str));
CoTaskMemFree(url_str); CoTaskMemFree(url_str);
CHECK_CALLED(GetBindString_URL); CHECK_CALLED(GetBindString_URL);
@ -2699,7 +2690,7 @@ static void test_binding(int prot, DWORD grf_pi, BOOL test_filter)
ULONG ref; ULONG ref;
HRESULT hres; HRESULT hres;
trace("Testing %s binding (grfPI %x%s)...\n", debugstr_w(protocol_names[prot]), grf_pi, trace("Testing %s binding (grfPI %x%s)...\n", wine_dbgstr_w(protocol_names[prot]), grf_pi,
test_filter ? " testing MIME filter" : ""); test_filter ? " testing MIME filter" : "");
init_test(prot, TEST_BINDING | (test_filter ? TEST_FILTER : 0)); init_test(prot, TEST_BINDING | (test_filter ? TEST_FILTER : 0));
pi = grf_pi; pi = grf_pi;

View File

@ -208,13 +208,6 @@ static enum {
END_DOWNLOAD END_DOWNLOAD
} download_state; } download_state;
static const char *debugstr_w(LPCWSTR str)
{
static char buf[1024];
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static const char *debugstr_guid(REFIID riid) static const char *debugstr_guid(REFIID riid)
{ {
static char buf[50]; static char buf[50];
@ -474,7 +467,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
read = 0; read = 0;
if(!filedwl_api) /* FIXME */ if(!filedwl_api) /* FIXME */
ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", debugstr_w(szUrl)); ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n"); ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n"); ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI); ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI);
@ -1300,7 +1293,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
if(filedwl_api) { if(filedwl_api) {
/* FIXME */ /* FIXME */
}else { }else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText)); ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
} }
} }
if(!bind_to_object) if(!bind_to_object)
@ -1324,7 +1317,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
if(filedwl_api) { if(filedwl_api) {
/* FIXME */ /* FIXME */
}else { }else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText)); ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
} }
} }
ok(download_state == DOWNLOADING, "Download state was %d, expected DOWNLOADING\n", ok(download_state == DOWNLOADING, "Download state was %d, expected DOWNLOADING\n",
@ -1344,7 +1337,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
ok(szStatusText != NULL, "szStatusText == NULL\n"); ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText && test_protocol == FILE_TEST) if(szStatusText && test_protocol == FILE_TEST)
ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", debugstr_w(szStatusText)); ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
break; break;
case BINDSTATUS_CLASSIDAVAILABLE: case BINDSTATUS_CLASSIDAVAILABLE:
{ {
@ -1515,10 +1508,10 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
case TYMED_FILE: case TYMED_FILE:
if(test_protocol == FILE_TEST) if(test_protocol == FILE_TEST)
ok(!lstrcmpW(pstgmed->u.lpszFileName, INDEX_HTML+7), ok(!lstrcmpW(pstgmed->u.lpszFileName, INDEX_HTML+7),
"unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName)); "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName));
else if(emulate_protocol) else if(emulate_protocol)
ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW), ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW),
"unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName)); "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName));
else else
ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n"); ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n");
} }
@ -1596,7 +1589,7 @@ static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPER
switch(mkp) { switch(mkp) {
case MIMETYPEPROP: case MIMETYPEPROP:
CHECK_EXPECT(PutProperty_MIMETYPEPROP); CHECK_EXPECT(PutProperty_MIMETYPEPROP);
ok(!lstrcmpW(val, wszTextHtml), "val = %s\n", debugstr_w(val)); ok(!lstrcmpW(val, wszTextHtml), "val = %s\n", wine_dbgstr_w(val));
break; break;
case CLASSIDPROP: case CLASSIDPROP:
CHECK_EXPECT(PutProperty_CLASSIDPROP); CHECK_EXPECT(PutProperty_CLASSIDPROP);
@ -2241,7 +2234,7 @@ static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name); hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
ok(hres == S_OK, "GetDisplayName failed %08x\n", hres); ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
ok(!lstrcmpW(display_name, urls[test_protocol]), ok(!lstrcmpW(display_name, urls[test_protocol]),
"GetDisplayName got wrong name %s\n", debugstr_w(display_name)); "GetDisplayName got wrong name %s\n", wine_dbgstr_w(display_name));
CoTaskMemFree(display_name); CoTaskMemFree(display_name);
if(tymed == TYMED_FILE && (test_protocol == ABOUT_TEST || test_protocol == ITS_TEST)) if(tymed == TYMED_FILE && (test_protocol == ABOUT_TEST || test_protocol == ITS_TEST))