dmband: Simplify dump_DMUS_OBJECTDESC() and move it to dmobject.c.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f8f41d8152
commit
c538d4ad3e
|
@ -158,7 +158,7 @@ static HRESULT WINAPI band_IDirectMusicObject_ParseDescriptor(IDirectMusicObject
|
|||
}
|
||||
|
||||
TRACE("returning descriptor:\n");
|
||||
debug_DMUS_OBJECTDESC(desc);
|
||||
dump_DMUS_OBJECTDESC(desc);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,6 +219,59 @@ const char *debugstr_dmguid(const GUID *id) {
|
|||
return debugstr_guid(id);
|
||||
}
|
||||
|
||||
void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc)
|
||||
{
|
||||
if (!desc || !TRACE_ON(dmfile))
|
||||
return;
|
||||
|
||||
TRACE_(dmfile)("DMUS_OBJECTDESC (%p):", desc);
|
||||
TRACE_(dmfile)(" - dwSize = %u\n", desc->dwSize);
|
||||
|
||||
#define X(flag) if (desc->dwValidData & flag) TRACE_(dmfile)(#flag " ")
|
||||
TRACE_(dmfile)(" - dwValidData = %#08x ( ", desc->dwValidData);
|
||||
X(DMUS_OBJ_OBJECT);
|
||||
X(DMUS_OBJ_CLASS);
|
||||
X(DMUS_OBJ_NAME);
|
||||
X(DMUS_OBJ_CATEGORY);
|
||||
X(DMUS_OBJ_FILENAME);
|
||||
X(DMUS_OBJ_FULLPATH);
|
||||
X(DMUS_OBJ_URL);
|
||||
X(DMUS_OBJ_VERSION);
|
||||
X(DMUS_OBJ_DATE);
|
||||
X(DMUS_OBJ_LOADED);
|
||||
X(DMUS_OBJ_MEMORY);
|
||||
X(DMUS_OBJ_STREAM);
|
||||
TRACE_(dmfile)(")\n");
|
||||
#undef X
|
||||
|
||||
if (desc->dwValidData & DMUS_OBJ_CLASS)
|
||||
TRACE_(dmfile)(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
|
||||
if (desc->dwValidData & DMUS_OBJ_OBJECT)
|
||||
TRACE_(dmfile)(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
|
||||
|
||||
if (desc->dwValidData & DMUS_OBJ_DATE) {
|
||||
SYSTEMTIME time;
|
||||
FileTimeToSystemTime(&desc->ftDate, &time);
|
||||
TRACE_(dmfile)(" - ftDate = \'%04u-%02u-%02u %02u:%02u:%02u\'\n",
|
||||
time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond);
|
||||
}
|
||||
if (desc->dwValidData & DMUS_OBJ_VERSION)
|
||||
TRACE_(dmfile)(" - vVersion = \'%u,%u,%u,%u\'\n",
|
||||
HIWORD(desc->vVersion.dwVersionMS), LOWORD(desc->vVersion.dwVersionMS),
|
||||
HIWORD(desc->vVersion.dwVersionLS), LOWORD(desc->vVersion.dwVersionLS));
|
||||
if (desc->dwValidData & DMUS_OBJ_NAME)
|
||||
TRACE_(dmfile)(" - wszName = %s\n", debugstr_w(desc->wszName));
|
||||
if (desc->dwValidData & DMUS_OBJ_CATEGORY)
|
||||
TRACE_(dmfile)(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
|
||||
if (desc->dwValidData & DMUS_OBJ_FILENAME)
|
||||
TRACE_(dmfile)(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
|
||||
if (desc->dwValidData & DMUS_OBJ_MEMORY)
|
||||
TRACE_(dmfile)(" - llMemLength = 0x%s - pbMemData = %p\n",
|
||||
wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
|
||||
if (desc->dwValidData & DMUS_OBJ_STREAM)
|
||||
TRACE_(dmfile)(" - pStream = %p\n", desc->pStream);
|
||||
}
|
||||
|
||||
|
||||
/* RIFF format parsing */
|
||||
#define CHUNK_HDR_SIZE (sizeof(FOURCC) + sizeof(DWORD))
|
||||
|
|
|
@ -108,6 +108,7 @@ HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface,
|
|||
/* Debugging helpers */
|
||||
const char *debugstr_chunk(const struct chunk_entry *chunk) DECLSPEC_HIDDEN;
|
||||
const char *debugstr_dmguid(const GUID *id) DECLSPEC_HIDDEN;
|
||||
void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline const char *debugstr_fourcc(DWORD fourcc)
|
||||
{
|
||||
|
|
|
@ -44,84 +44,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmfile);
|
||||
|
||||
/* generic flag-dumping function */
|
||||
static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
|
||||
static char buffer[128] = "", *ptr = &buffer[0];
|
||||
unsigned int i;
|
||||
int size = sizeof(buffer);
|
||||
|
||||
for (i=0; i < num_names; i++) {
|
||||
if ((flags & names[i].val)) {
|
||||
int cnt = snprintf(ptr, size, "%s ", names[i].name);
|
||||
if (cnt < 0 || cnt >= size) break;
|
||||
size -= cnt;
|
||||
ptr += cnt;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = &buffer[0];
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* dump DMUS_OBJ flags */
|
||||
static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
|
||||
static const flag_info flags[] = {
|
||||
FE(DMUS_OBJ_OBJECT),
|
||||
FE(DMUS_OBJ_CLASS),
|
||||
FE(DMUS_OBJ_NAME),
|
||||
FE(DMUS_OBJ_CATEGORY),
|
||||
FE(DMUS_OBJ_FILENAME),
|
||||
FE(DMUS_OBJ_FULLPATH),
|
||||
FE(DMUS_OBJ_URL),
|
||||
FE(DMUS_OBJ_VERSION),
|
||||
FE(DMUS_OBJ_DATE),
|
||||
FE(DMUS_OBJ_LOADED),
|
||||
FE(DMUS_OBJ_MEMORY),
|
||||
FE(DMUS_OBJ_STREAM)
|
||||
};
|
||||
return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
|
||||
}
|
||||
|
||||
/* month number into month name (for debugstr_filetime) */
|
||||
static const char *debugstr_month (DWORD dwMonth) {
|
||||
switch (dwMonth) {
|
||||
case 1: return "January";
|
||||
case 2: return "February";
|
||||
case 3: return "March";
|
||||
case 4: return "April";
|
||||
case 5: return "May";
|
||||
case 6: return "June";
|
||||
case 7: return "July";
|
||||
case 8: return "August";
|
||||
case 9: return "September";
|
||||
case 10: return "October";
|
||||
case 11: return "November";
|
||||
case 12: return "December";
|
||||
default: return "Invalid";
|
||||
}
|
||||
}
|
||||
|
||||
/* FILETIME struct to string conversion for debug messages */
|
||||
static const char *debugstr_filetime (const FILETIME *time) {
|
||||
SYSTEMTIME sysTime;
|
||||
|
||||
if (!time) return "'null'";
|
||||
|
||||
FileTimeToSystemTime (time, &sysTime);
|
||||
|
||||
return wine_dbg_sprintf ("\'%02i. %s %04i %02i:%02i:%02i\'",
|
||||
sysTime.wDay, debugstr_month(sysTime.wMonth), sysTime.wYear,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
|
||||
}
|
||||
|
||||
/* DMUS_VERSION struct to string conversion for debug messages */
|
||||
static const char *debugstr_dmversion (const DMUS_VERSION *version) {
|
||||
if (!version) return "'null'";
|
||||
return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
|
||||
HIWORD(version->dwVersionMS),LOWORD(version->dwVersionMS),
|
||||
HIWORD(version->dwVersionLS), LOWORD(version->dwVersionLS));
|
||||
}
|
||||
|
||||
HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
|
||||
|
||||
switch (pChunk->fccID) {
|
||||
|
@ -278,7 +200,7 @@ HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface,
|
|||
|
||||
TRACE("** DM Reference Begin of Load ***\n");
|
||||
TRACE("With Desc:\n");
|
||||
debug_DMUS_OBJECTDESC(&ref_desc);
|
||||
dump_DMUS_OBJECTDESC(&ref_desc);
|
||||
|
||||
{
|
||||
LPDIRECTMUSICGETLOADER pGetLoader = NULL;
|
||||
|
@ -295,23 +217,3 @@ HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface,
|
|||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void debug_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
|
||||
if (pDesc) {
|
||||
TRACE("DMUS_OBJECTDESC (%p):\n", pDesc);
|
||||
TRACE(" - dwSize = %d\n", pDesc->dwSize);
|
||||
TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(pDesc->wszName));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = %s\n", debugstr_filetime(&pDesc->ftDate));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s - pbMemData = %p\n",
|
||||
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
|
||||
if (pDesc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", pDesc->pStream);
|
||||
} else {
|
||||
TRACE("(NULL)\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,4 @@ extern HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_C
|
|||
extern HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN;
|
||||
extern HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, IDirectMusicObject** ppObject) DECLSPEC_HIDDEN;
|
||||
|
||||
/**
|
||||
* Debug utilities
|
||||
*/
|
||||
/* used for generic dumping (copied from ddraw) */
|
||||
typedef struct {
|
||||
DWORD val;
|
||||
const char* name;
|
||||
} flag_info;
|
||||
|
||||
/* used for initialising structs */
|
||||
#define FE(x) { x, #x }
|
||||
|
||||
extern void debug_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __WINE_DMUTILS_H */
|
||||
|
|
Loading…
Reference in New Issue