diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c index 936707632a4..90287ad0e74 100644 --- a/dlls/dxdiagn/tests/container.c +++ b/dlls/dxdiagn/tests/container.c @@ -37,35 +37,6 @@ static IDxDiagContainer *pddc; static const WCHAR DxDiag_SystemInfo[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0}; static const WCHAR DxDiag_DisplayDevices[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0}; -/* Based on debugstr_variant in dlls/jscript/jsutils.c. */ -static const char *debugstr_variant(const VARIANT *var) -{ - static char buf[400]; - - if (!var) - return "(null)"; - - switch (V_VT(var)) - { - case VT_EMPTY: - return "{VT_EMPTY}"; - case VT_BSTR: - sprintf(buf, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var))); - break; - case VT_BOOL: - sprintf(buf, "{VT_BOOL: %x}", V_BOOL(var)); - break; - case VT_UI4: - sprintf(buf, "{VT_UI4: %u}", V_UI4(var)); - break; - default: - sprintf(buf, "{vt %d}", V_VT(var)); - break; - } - - return buf; -} - static BOOL create_root_IDxDiagContainer(void) { HRESULT hr; diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c index 4a1b1d40763..c4d2ce7115e 100644 --- a/dlls/kernel32/tests/debugger.c +++ b/dlls/kernel32/tests/debugger.c @@ -48,7 +48,7 @@ static LONG child_failures; static HMODULE ntdll; -static void WINAPIV WINETEST_PRINTF_ATTR(2, 3) test_child_ok(int condition, const char *msg, ...) +static void WINAPIV __WINE_PRINTF_ATTR(2, 3) test_child_ok(int condition, const char *msg, ...) { __ms_va_list valist; diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 3ea567bd895..89ad4175c7e 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -282,7 +282,7 @@ static void get_file_name(char* buf) * static void childPrintf * */ -static void WINAPIV WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...) +static void WINAPIV __WINE_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...) { __ms_va_list valist; char buffer[1024+4*MAX_LISTED_ENV_VAR]; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 3234e66cd5c..13de60ff4d6 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -19,7 +19,6 @@ #define COBJMACROS #define CONST_VTABLE -#include #include #include @@ -32,6 +31,7 @@ #include "docobj.h" #include "hlink.h" #include "dispex.h" +#include "wine/test.h" #include "mshtml_test.h" #include "objsafe.h" #include "htiface.h" @@ -604,34 +604,6 @@ static BSTR a2bstr(const char *str) return ret; } -static const char *debugstr_variant(const VARIANT *var) -{ - static char buf[400]; - - if (!var) - return "(null)"; - - switch (V_VT(var)) - { - case VT_EMPTY: - return "{VT_EMPTY}"; - case VT_BSTR: - sprintf(buf, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var))); - break; - case VT_BOOL: - sprintf(buf, "{VT_BOOL: %x}", V_BOOL(var)); - break; - case VT_UI4: - sprintf(buf, "{VT_UI4: %u}", V_UI4(var)); - break; - default: - sprintf(buf, "{vt %d}", V_VT(var)); - break; - } - - return buf; -} - static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2) { IUnknown *unk1, *unk2; diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 00e12aa20d9..099f1a2f38b 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -18,7 +18,6 @@ #define COBJMACROS -#include #include #include @@ -27,6 +26,7 @@ #include "ole2.h" #include "mshtml.h" #include "objsafe.h" +#include "wine/test.h" static BSTR a2bstr(const char *str) { @@ -454,34 +454,6 @@ static void test_header(const struct HEADER_TYPE expect[], int num) } } -static const char *debugstr_variant(const VARIANT *var) -{ - static char buf[400]; - - if (!var) - return "(null)"; - - switch (V_VT(var)) - { - case VT_EMPTY: - return "{VT_EMPTY}"; - case VT_BSTR: - sprintf(buf, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var))); - break; - case VT_BOOL: - sprintf(buf, "{VT_BOOL: %x}", V_BOOL(var)); - break; - case VT_UI4: - sprintf(buf, "{VT_UI4: %u}", V_UI4(var)); - break; - default: - sprintf(buf, "{vt %d}", V_VT(var)); - break; - } - - return buf; -} - static void test_illegal_xml(IXMLDOMDocument *xmldom) { IXMLDOMNode *first, *last; @@ -500,7 +472,7 @@ static void test_illegal_xml(IXMLDOMDocument *xmldom) ok(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres); hres = IXMLDOMDocument_get_dataType(xmldom, &variant); ok(hres == S_FALSE, "get_dataType failed: %08x\n", hres); - ok(V_VT(&variant) == VT_NULL, "got %s\n", debugstr_variant(&variant)); + ok(V_VT(&variant) == VT_NULL, "got %s\n", wine_dbgstr_variant(&variant)); VariantClear(&variant); hres = IXMLDOMDocument_get_text(xmldom, &bstr); diff --git a/dlls/ole32/tests/ole_server.c b/dlls/ole32/tests/ole_server.c index 83f7c660dbb..b0bf01d96e8 100644 --- a/dlls/ole32/tests/ole_server.c +++ b/dlls/ole32/tests/ole_server.c @@ -60,7 +60,7 @@ static const struct static LONG obj_ref, class_ref, server_locks; -static const char *debugstr_guid(const GUID *guid) +static const char *debugstr_ole_guid(const GUID *guid) { int i; @@ -92,7 +92,7 @@ static HRESULT WINAPI UnknownImpl_QueryInterface(IUnknown *iface, { UnknownImpl *This = impl_from_IUnknown(iface); - trace("server: unknown_QueryInterface: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + trace("server: unknown_QueryInterface: %p,%s,%p\n", iface, debugstr_ole_guid(iid), ppv); if (!ppv) return E_INVALIDARG; @@ -153,7 +153,7 @@ static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface, { ClassFactoryImpl *This = impl_from_IClassFactory(iface); - trace("server: factory_QueryInterface: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + trace("server: factory_QueryInterface: %p,%s,%p\n", iface, debugstr_ole_guid(iid), ppv); if (!ppv) return E_INVALIDARG; @@ -197,7 +197,7 @@ static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, UnknownImpl *unknown; HRESULT hr; - trace("server: factory_CreateInstance: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + trace("server: factory_CreateInstance: %p,%s,%p\n", iface, debugstr_ole_guid(iid), ppv); if (punkouter) return CLASS_E_NOAGGREGATION; diff --git a/include/wine/debug.h b/include/wine/debug.h index 1c312e93221..8985163894a 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -29,10 +29,6 @@ #include #endif -#ifdef __WINE_WINE_TEST_H -#error This file should not be used in Wine tests -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/include/wine/test.h b/include/wine/test.h index aeb9a55dee2..a919ce81d68 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef __WINE_CONFIG_H #error config.h should not be used in Wine tests @@ -35,9 +36,6 @@ #ifdef __WINE_WINE_UNICODE_H #error wine/unicode.h should not be used in Wine tests #endif -#ifdef __WINE_WINE_DEBUG_H -#error wine/debug.h should not be used in Wine tests -#endif #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES (~0u) @@ -77,12 +75,6 @@ extern LONG winetest_get_failures(void); extern void winetest_add_failures( LONG new_failures ); extern void winetest_wait_child_process( HANDLE process ); -extern const char *wine_dbgstr_wn( const WCHAR *str, int n ); -extern const char *wine_dbgstr_guid( const GUID *guid ); -extern const char *wine_dbgstr_rect( const RECT *rect ); -static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); } -extern const char *wine_dbgstr_longlong( ULONGLONG ll ); - #ifdef STANDALONE #define START_TEST(name) \ static void func_##name(void); \ @@ -104,16 +96,10 @@ extern int broken( int condition ); extern int winetest_vok( int condition, const char *msg, __winetest_va_list ap ); extern void winetest_vskip( const char *msg, __winetest_va_list ap ); -#ifdef __GNUC__ -# define WINETEST_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) -#else -# define WINETEST_PRINTF_ATTR(fmt,args) -#endif - -extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) WINETEST_PRINTF_ATTR(2,3); -extern void __winetest_cdecl winetest_skip( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2); -extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2); -extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2); +extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __WINE_PRINTF_ATTR(2,3); +extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2); +extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2); +extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2); #ifdef WINETEST_NO_LINE_NUMBERS # define subtest_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_subtest @@ -266,24 +252,6 @@ static struct tls_data *get_tls_data(void) return data; } -/* allocate some tmp space for a string */ -static char *get_temp_buffer( size_t n ) -{ - struct tls_data *data = get_tls_data(); - char *res = data->str_pos; - - if (res + n >= &data->strings[sizeof(data->strings)]) res = data->strings; - data->str_pos = res + n; - return res; -} - -/* release extra space that we requested in get_temp_buffer() */ -static void release_temp_buffer( char *ptr, size_t size ) -{ - struct tls_data *data = get_tls_data(); - data->str_pos = ptr + size; -} - static void exit_process( int code ) { fflush( stdout ); @@ -488,99 +456,6 @@ void winetest_wait_child_process( HANDLE process ) } } -const char *wine_dbgstr_wn( const WCHAR *str, int n ) -{ - char *dst, *res; - size_t size; - - if (!((ULONG_PTR)str >> 16)) - { - if (!str) return "(null)"; - res = get_temp_buffer( 6 ); - sprintf( res, "#%04x", LOWORD(str) ); - return res; - } - if (n == -1) - { - const WCHAR *end = str; - while (*end) end++; - n = end - str; - } - if (n < 0) n = 0; - size = 12 + min( 300, n * 5 ); - dst = res = get_temp_buffer( size ); - *dst++ = 'L'; - *dst++ = '"'; - while (n-- > 0 && dst <= res + size - 10) - { - WCHAR c = *str++; - switch (c) - { - case '\n': *dst++ = '\\'; *dst++ = 'n'; break; - case '\r': *dst++ = '\\'; *dst++ = 'r'; break; - case '\t': *dst++ = '\\'; *dst++ = 't'; break; - case '"': *dst++ = '\\'; *dst++ = '"'; break; - case '\\': *dst++ = '\\'; *dst++ = '\\'; break; - default: - if (c >= ' ' && c <= 126) - *dst++ = (char)c; - else - { - *dst++ = '\\'; - sprintf(dst,"%04x",c); - dst+=4; - } - } - } - *dst++ = '"'; - if (n > 0) - { - *dst++ = '.'; - *dst++ = '.'; - *dst++ = '.'; - } - *dst++ = 0; - release_temp_buffer( res, dst - res ); - return res; -} - -const char *wine_dbgstr_guid( const GUID *guid ) -{ - char *res; - - if (!guid) return "(null)"; - res = get_temp_buffer( 39 ); /* CHARS_IN_GUID */ - sprintf( res, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], - guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], - guid->Data4[5], guid->Data4[6], guid->Data4[7] ); - return res; -} - -const char *wine_dbgstr_rect( const RECT *rect ) -{ - char *res; - - if (!rect) return "(null)"; - res = get_temp_buffer( 60 ); - sprintf( res, "(%d,%d)-(%d,%d)", rect->left, rect->top, rect->right, rect->bottom ); - release_temp_buffer( res, strlen(res) + 1 ); - return res; -} - -const char *wine_dbgstr_longlong( ULONGLONG ll ) -{ - char *res; - - res = get_temp_buffer( 17 ); - if (sizeof(ll) > sizeof(unsigned long) && ll >> 32) - sprintf( res, "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll ); - else - sprintf( res, "%lx", (unsigned long)ll ); - release_temp_buffer( res, strlen(res) + 1 ); - return res; -} - /* Find a test by name */ static const struct test *find_test( const char *name ) {