From: Alex Henrie alexhenrie24@gmail.com
--- dlls/d3dxof/parsing.c | 9 --------- dlls/dmusic/dmobject.h | 7 ------- dlls/mfplat/buffer.c | 2 +- dlls/mfplat/mediatype.c | 4 ++-- dlls/mfplat/mfplat_private.h | 2 +- dlls/winecoreaudio.drv/coreaudio.h | 2 +- dlls/winecoreaudio.drv/coremidi.c | 24 ++++++++++++------------ include/wine/debug.h | 11 +++++++++++ libs/strmbase/mediatype.c | 8 -------- 9 files changed, 28 insertions(+), 41 deletions(-)
diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c index c87517c0f15..149e2371168 100644 --- a/dlls/d3dxof/parsing.c +++ b/dlls/d3dxof/parsing.c @@ -70,15 +70,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3dxof_parsing);
#define CLSIDFMT "<%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X>"
-/* FOURCC to string conversion for debug messages */ -static const char *debugstr_fourcc(DWORD fourcc) -{ - if (!fourcc) return "'null'"; - return wine_dbg_sprintf ("'%c%c%c%c'", - (char)(fourcc), (char)(fourcc >> 8), - (char)(fourcc >> 16), (char)(fourcc >> 24)); -} - static const char* get_primitive_string(DWORD token) { switch(token) diff --git a/dlls/dmusic/dmobject.h b/dlls/dmusic/dmobject.h index 82ac05f31b9..bab96c77724 100644 --- a/dlls/dmusic/dmobject.h +++ b/dlls/dmusic/dmobject.h @@ -121,10 +121,3 @@ HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, const char *debugstr_chunk(const struct chunk_entry *chunk); const char *debugstr_dmguid(const GUID *id); void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc); - -static inline const char *debugstr_fourcc(DWORD fourcc) -{ - if (!fourcc) return "''"; - return wine_dbg_sprintf("'%c%c%c%c'", (char)(fourcc), (char)(fourcc >> 8), - (char)(fourcc >> 16), (char)(fourcc >> 24)); -} diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index cb1b3176a08..932b1147cb8 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -1627,7 +1627,7 @@ HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD max_length, DWORD alignment, IM */ HRESULT WINAPI MFCreate2DMediaBuffer(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up, IMFMediaBuffer **buffer) { - TRACE("%lu, %lu, %s, %d, %p.\n", width, height, debugstr_fourcc(fourcc), bottom_up, buffer); + TRACE("%lu, %lu, %s, %d, %p.\n", width, height, mf_debugstr_fourcc(fourcc), bottom_up, buffer);
return create_2d_buffer(width, height, fourcc, bottom_up, buffer); } diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index eed06ef02ef..0b4a6fa4eaf 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -2696,7 +2696,7 @@ HRESULT WINAPI MFGetStrideForBitmapInfoHeader(DWORD fourcc, DWORD width, LONG *s struct uncompressed_video_format *format; GUID subtype;
- TRACE("%s, %lu, %p.\n", debugstr_fourcc(fourcc), width, stride); + TRACE("%s, %lu, %p.\n", mf_debugstr_fourcc(fourcc), width, stride);
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype)); subtype.Data1 = fourcc; @@ -2766,7 +2766,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si unsigned int stride; GUID subtype;
- TRACE("%s, %lu, %lu, %p.\n", debugstr_fourcc(fourcc), width, height, size); + TRACE("%s, %lu, %lu, %p.\n", mf_debugstr_fourcc(fourcc), width, height, size);
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype)); subtype.Data1 = fourcc; diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h index 9cd3d601587..c9af96d88f9 100644 --- a/dlls/mfplat/mfplat_private.h +++ b/dlls/mfplat/mfplat_private.h @@ -148,7 +148,7 @@ static inline const char *debugstr_propvar(const PROPVARIANT *v) } }
-static inline const char *debugstr_fourcc(DWORD format) +static inline const char *mf_debugstr_fourcc(DWORD format) { static const struct format_name { diff --git a/dlls/winecoreaudio.drv/coreaudio.h b/dlls/winecoreaudio.drv/coreaudio.h index e04043c4010..687bad54b55 100644 --- a/dlls/winecoreaudio.drv/coreaudio.h +++ b/dlls/winecoreaudio.drv/coreaudio.h @@ -23,7 +23,7 @@ #include "wine/debug.h"
/* fourcc is in native order, where MSB is the first character. */ -static inline const char* wine_dbgstr_fourcc(INT32 fourcc) +static inline const char* coreaudio_dbgstr_fourcc(INT32 fourcc) { char buf[4] = { (char) (fourcc >> 24), (char) (fourcc >> 16), (char) (fourcc >> 8), (char) fourcc }; diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index c9b377f68b0..37cf859a913 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -448,7 +448,7 @@ static BOOL synth_unit_create_default(AUGraph *graph, AudioUnit *synth) sc = NewAUGraph(graph); if (sc != noErr) { - ERR("NewAUGraph return %s\n", wine_dbgstr_fourcc(sc)); + ERR("NewAUGraph return %s\n", coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -463,7 +463,7 @@ static BOOL synth_unit_create_default(AUGraph *graph, AudioUnit *synth) sc = AUGraphAddNode(*graph, &desc, &synth_node); if (sc != noErr) { - ERR("AUGraphAddNode cannot create synthNode : %s\n", wine_dbgstr_fourcc(sc)); + ERR("AUGraphAddNode cannot create synthNode : %s\n", coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -474,14 +474,14 @@ static BOOL synth_unit_create_default(AUGraph *graph, AudioUnit *synth) sc = AUGraphAddNode(*graph, &desc, &out_node); if (sc != noErr) { - ERR("AUGraphAddNode cannot create outNode %s\n", wine_dbgstr_fourcc(sc)); + ERR("AUGraphAddNode cannot create outNode %s\n", coreaudio_dbgstr_fourcc(sc)); return FALSE; }
sc = AUGraphOpen(*graph); if (sc != noErr) { - ERR("AUGraphOpen returns %s\n", wine_dbgstr_fourcc(sc)); + ERR("AUGraphOpen returns %s\n", coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -490,7 +490,7 @@ static BOOL synth_unit_create_default(AUGraph *graph, AudioUnit *synth) if (sc != noErr) { ERR("AUGraphConnectNodeInput cannot connect synthNode to outNode : %s\n", - wine_dbgstr_fourcc(sc)); + coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -498,7 +498,7 @@ static BOOL synth_unit_create_default(AUGraph *graph, AudioUnit *synth) sc = AUGraphNodeInfo(*graph, synth_node, 0, synth); if (sc != noErr) { - ERR("AUGraphNodeInfo return %s\n", wine_dbgstr_fourcc(sc)); + ERR("AUGraphNodeInfo return %s\n", coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -512,14 +512,14 @@ static BOOL synth_unit_init(AudioUnit synth, AUGraph graph) sc = AUGraphInitialize(graph); if (sc != noErr) { - ERR("AUGraphInitialize(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + ERR("AUGraphInitialize(%p) returns %s\n", graph, coreaudio_dbgstr_fourcc(sc)); return FALSE; }
sc = AUGraphStart(graph); if (sc != noErr) { - ERR("AUGraphStart(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + ERR("AUGraphStart(%p) returns %s\n", graph, coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -533,14 +533,14 @@ static BOOL synth_unit_close(AUGraph graph) sc = AUGraphStop(graph); if (sc != noErr) { - ERR("AUGraphStop(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + ERR("AUGraphStop(%p) returns %s\n", graph, coreaudio_dbgstr_fourcc(sc)); return FALSE; }
sc = DisposeAUGraph(graph); if (sc != noErr) { - ERR("DisposeAUGraph(%p) returns %s\n", graph, wine_dbgstr_fourcc(sc)); + ERR("DisposeAUGraph(%p) returns %s\n", graph, coreaudio_dbgstr_fourcc(sc)); return FALSE; }
@@ -686,7 +686,7 @@ static UINT midi_out_data(WORD dev_id, UINT data) sc = MusicDeviceMIDIEvent(dest->synth, bytes[0], bytes[1], bytes[2], 0); if (sc != noErr) { - ERR("MusicDeviceMIDIEvent returns %s\n", wine_dbgstr_fourcc(sc)); + ERR("MusicDeviceMIDIEvent returns %s\n", coreaudio_dbgstr_fourcc(sc)); return MMSYSERR_ERROR; } } @@ -739,7 +739,7 @@ static UINT midi_out_long_data(WORD dev_id, MIDIHDR *hdr, UINT hdr_size, struct sc = MusicDeviceSysEx(dest->synth, (const UInt8 *)hdr->lpData, hdr->dwBufferLength); if (sc != noErr) { - ERR("MusicDeviceSysEx returns %s\n", wine_dbgstr_fourcc(sc)); + ERR("MusicDeviceSysEx returns %s\n", coreaudio_dbgstr_fourcc(sc)); return MMSYSERR_ERROR; } } diff --git a/include/wine/debug.h b/include/wine/debug.h index 9c92fd3d6d6..d1d751a2d8a 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -324,6 +324,16 @@ static inline const char *wine_dbgstr_guid( const GUID *id ) id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); }
+static inline const char *wine_dbgstr_fourcc( unsigned int fourcc ) +{ + char str[4] = { fourcc, fourcc >> 8, fourcc >> 16, fourcc >> 24 }; + if (!fourcc) + return "''"; + if (isprint( str[0] ) && isprint( str[1] ) && isprint( str[2] ) && isprint( str[3] )) + return wine_dbg_sprintf( "'%4s'", str ); + return wine_dbg_sprintf( "0x%08x", fourcc ); +} + static inline const char *wine_dbgstr_point( const POINT *pt ) { if (!pt) return "(null)"; @@ -504,6 +514,7 @@ static inline const char *wine_dbgstr_variant( const VARIANT *v ) static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); } static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); } static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); } +static inline const char *debugstr_fourcc( unsigned int cc ) { return wine_dbgstr_fourcc( cc ); } 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 ); }
diff --git a/libs/strmbase/mediatype.c b/libs/strmbase/mediatype.c index 90c9bd01206..af813e2ffee 100644 --- a/libs/strmbase/mediatype.c +++ b/libs/strmbase/mediatype.c @@ -55,14 +55,6 @@ static const char *strmbase_debugstr_guid(const GUID *guid) return debugstr_guid(guid); }
-static const char *debugstr_fourcc(DWORD fourcc) -{ - char str[4] = {fourcc, fourcc >> 8, fourcc >> 16, fourcc >> 24}; - if (isprint(str[0]) && isprint(str[1]) && isprint(str[2]) && isprint(str[3])) - return wine_dbgstr_an(str, 4); - return wine_dbg_sprintf("%#lx", fourcc); -} - void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt) { if (!TRACE_ON(quartz) || !mt) return;