This replaces Wine's 14 copies of debugstr_hstring.
-- v4: include: Introduce wine_dbgstr_hstring and debugstr_hstring. include: Use correct header guard name in winstring.h.
From: Alex Henrie alexhenrie24@gmail.com
--- include/winstring.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/winstring.h b/include/winstring.h index 27c299b9470..79b284a842e 100644 --- a/include/winstring.h +++ b/include/winstring.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#ifndef __WINE_WINSTRING_H -#define __WINE_WINSTRING_H +#ifndef __WINSTRING_H_ +#define __WINSTRING_H_
#include <hstring.h>
@@ -51,4 +51,4 @@ HRESULT WINAPI WindowsTrimStringStart(HSTRING str, HSTRING charstr, HSTRING *out } #endif
-#endif /* __WINE_WINSTRING_H */ +#endif /* __WINSTRING_H_ */
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/combase/roapi.c | 9 --------- dlls/cryptowinrt/main.c | 9 --------- dlls/cryptowinrt/private.h | 2 -- dlls/graphicscapture/main.c | 9 --------- dlls/threadpoolwinrt/main.c | 9 --------- dlls/windows.devices.enumeration/main.c | 9 --------- dlls/windows.devices.enumeration/private.h | 2 -- dlls/windows.globalization/main.c | 9 --------- dlls/windows.media.devices/main.c | 9 --------- dlls/windows.media.speech/tests/speech.c | 9 --------- dlls/windows.media/captions.c | 9 --------- dlls/windows.media/private.h | 2 -- dlls/windows.networking/main.c | 9 --------- dlls/windows.perception.stub/main.c | 9 --------- .../main.c | 9 --------- dlls/windows.ui/main.c | 9 --------- dlls/wintypes/main.c | 10 ---------- include/wine/debug.h | 15 +++++++++++++++ 18 files changed, 15 insertions(+), 133 deletions(-)
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c index 78f35de39d4..b80ca2e8325 100644 --- a/dlls/combase/roapi.c +++ b/dlls/combase/roapi.c @@ -28,15 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(combase);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct activatable_class_data { ULONG size; diff --git a/dlls/cryptowinrt/main.c b/dlls/cryptowinrt/main.c index 5f28382eba9..e6f811b5d12 100644 --- a/dlls/cryptowinrt/main.c +++ b/dlls/cryptowinrt/main.c @@ -31,15 +31,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(crypto);
-const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct cryptobuffer_factory { IActivationFactory IActivationFactory_iface; diff --git a/dlls/cryptowinrt/private.h b/dlls/cryptowinrt/private.h index b1c195123f3..3ce3620118c 100644 --- a/dlls/cryptowinrt/private.h +++ b/dlls/cryptowinrt/private.h @@ -39,8 +39,6 @@
#include "provider.h"
-extern const char *debugstr_hstring( HSTRING hstr ); - extern IActivationFactory *credentials_activation_factory;
typedef HRESULT (WINAPI *async_operation_callback)( IUnknown *invoker, IUnknown *param, PROPVARIANT *result ); diff --git a/dlls/graphicscapture/main.c b/dlls/graphicscapture/main.c index 42584fef329..b64a8936aeb 100644 --- a/dlls/graphicscapture/main.c +++ b/dlls/graphicscapture/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(graphicscapture);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **factory ) { const WCHAR *buffer = WindowsGetStringRawBuffer( classid, NULL ); diff --git a/dlls/threadpoolwinrt/main.c b/dlls/threadpoolwinrt/main.c index fb59a777e30..f58c381cbbc 100644 --- a/dlls/threadpoolwinrt/main.c +++ b/dlls/threadpoolwinrt/main.c @@ -37,15 +37,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(threadpool);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct threadpool_factory { IActivationFactory IActivationFactory_iface; diff --git a/dlls/windows.devices.enumeration/main.c b/dlls/windows.devices.enumeration/main.c index 03bca4f0118..c87240df2db 100644 --- a/dlls/windows.devices.enumeration/main.c +++ b/dlls/windows.devices.enumeration/main.c @@ -25,15 +25,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(enumeration);
-const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - struct device_watcher { IDeviceWatcher IDeviceWatcher_iface; diff --git a/dlls/windows.devices.enumeration/private.h b/dlls/windows.devices.enumeration/private.h index dd06b25926e..06234e984e0 100644 --- a/dlls/windows.devices.enumeration/private.h +++ b/dlls/windows.devices.enumeration/private.h @@ -41,8 +41,6 @@
extern IActivationFactory *device_access_factory;
-extern const char *debugstr_hstring( HSTRING hstr ); - HRESULT typed_event_handlers_append( struct list *list, ITypedEventHandler_IInspectable_IInspectable *handler, EventRegistrationToken *token ); HRESULT typed_event_handlers_remove( struct list *list, EventRegistrationToken *token ); HRESULT typed_event_handlers_notify( struct list *list, IInspectable *sender, IInspectable *args ); diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index d5a5895938f..344a60e146b 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -39,15 +39,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(locale);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct hstring_vector { IVectorView_HSTRING IVectorView_HSTRING_iface; diff --git a/dlls/windows.media.devices/main.c b/dlls/windows.media.devices/main.c index 0bec5f2ea46..a52f696f1ad 100644 --- a/dlls/windows.media.devices/main.c +++ b/dlls/windows.media.devices/main.c @@ -39,15 +39,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - static ERole AudioDeviceRole_to_ERole(AudioDeviceRole role) { switch(role){ diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index fb0fa9e3b4d..74336b802e5 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -91,15 +91,6 @@ static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL IUnknown_Release(unk); }
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct completed_event_handler { IHandler_RecognitionCompleted IHandler_RecognitionCompleted_iface; diff --git a/dlls/windows.media/captions.c b/dlls/windows.media/captions.c index b7e07710603..d48445690d8 100644 --- a/dlls/windows.media/captions.c +++ b/dlls/windows.media/captions.c @@ -23,15 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(media);
-const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - struct captions_statics { IActivationFactory IActivationFactory_iface; diff --git a/dlls/windows.media/private.h b/dlls/windows.media/private.h index d6353dede56..f8756dadd47 100644 --- a/dlls/windows.media/private.h +++ b/dlls/windows.media/private.h @@ -37,8 +37,6 @@ #define WIDL_using_Windows_Media_ClosedCaptioning #include "windows.media.closedcaptioning.h"
-extern const char *debugstr_hstring( HSTRING hstr ); - extern IActivationFactory *captions_factory;
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ diff --git a/dlls/windows.networking/main.c b/dlls/windows.networking/main.c index 84097881b6b..325ea836359 100644 --- a/dlls/windows.networking/main.c +++ b/dlls/windows.networking/main.c @@ -23,15 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(winsock);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - HRESULT WINAPI SetSocketMediaStreamingMode(BOOL value) { FIXME("value %d stub!\n", value); diff --git a/dlls/windows.perception.stub/main.c b/dlls/windows.perception.stub/main.c index 4403c9cfb3f..5db2c3015ca 100644 --- a/dlls/windows.perception.stub/main.c +++ b/dlls/windows.perception.stub/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(perception);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) { FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); diff --git a/dlls/windows.system.profile.systemmanufacturers/main.c b/dlls/windows.system.profile.systemmanufacturers/main.c index d2feb32054e..ba30d84e00b 100644 --- a/dlls/windows.system.profile.systemmanufacturers/main.c +++ b/dlls/windows.system.profile.systemmanufacturers/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(smbios);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct smbios_statics { IActivationFactory IActivationFactory_iface; diff --git a/dlls/windows.ui/main.c b/dlls/windows.ui/main.c index 8896e0d1e71..490536c33b7 100644 --- a/dlls/windows.ui/main.c +++ b/dlls/windows.ui/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ui);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) { FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index e48a1b487a6..d5bfb5ad11c 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -34,16 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wintypes);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) - return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct wintypes { IActivationFactory IActivationFactory_iface; diff --git a/include/wine/debug.h b/include/wine/debug.h index c20924818dd..95d788a1ec8 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -305,6 +305,17 @@ static inline const char *wine_dbgstr_w( const WCHAR *s ) return wine_dbgstr_wn( s, -1 ); }
+#if defined(__hstring_h__) && defined(__WINSTRING_H_) +static inline const char *wine_dbgstr_hstring( HSTRING hstr ) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer( hstr, &len ); + return wine_dbgstr_wn( str, len ); +} +#endif + static inline const char *wine_dbgstr_guid( const GUID *id ) { if (!id) return "(null)"; @@ -498,6 +509,10 @@ static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_ static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
+#if defined(__hstring_h__) && defined(__WINSTRING_H_) +static inline const char *debugstr_hstring( struct HSTRING__ *s ) { return wine_dbgstr_hstring( s ); } +#endif + #if defined(__oaidl_h__) && defined(V_VT) static inline const char *debugstr_vt( VARTYPE vt ) { return wine_dbgstr_vt( vt ); } static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbgstr_variant( v ); }