oleaut32: Rewrite debugstr_vt.

This commit is contained in:
Jacek Caban 2014-05-23 15:40:16 +02:00 committed by Alexandre Julliard
parent 20daa8b61c
commit 5614770c24
4 changed files with 36 additions and 30 deletions

View File

@ -711,7 +711,7 @@ serialize_param(
hres = xbuf_add(buf,(LPBYTE)arg,sizeof(DWORD)); hres = xbuf_add(buf,(LPBYTE)arg,sizeof(DWORD));
return hres; return hres;
case VT_VARIANT: { case VT_VARIANT: {
if (debugout) TRACE_(olerelay)("Vt(%s%s)(",debugstr_vt(V_VT((VARIANT *)arg)),debugstr_vf(V_VT((VARIANT *)arg))); if (debugout) TRACE_(olerelay)("%s", debugstr_variant((VARIANT *)arg));
if (writeit) if (writeit)
{ {
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION); ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);

View File

@ -1541,7 +1541,7 @@ static void dump_Variant(const VARIANT * pvar)
{ {
SYSTEMTIME st; SYSTEMTIME st;
TRACE("%p->{%s%s", pvar, debugstr_VT(pvar), debugstr_VF(pvar)); TRACE("%p->{%s", pvar, debugstr_vt(V_VT(pvar)));
if (pvar) if (pvar)
{ {
@ -7188,9 +7188,8 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
if (FAILED(hres)) if (FAILED(hres))
{ {
ERR("failed to convert param %d to %s%s from %s%s\n", i, ERR("failed to convert param %d to %s from %s\n", i,
debugstr_vt(rgvt[i]), debugstr_vf(rgvt[i]), debugstr_vt(rgvt[i]), debugstr_variant(src_arg));
debugstr_VT(src_arg), debugstr_VF(src_arg));
break; break;
} }
prgpvarg[i] = &rgvarg[i]; prgpvarg[i] = &rgvarg[i];

View File

@ -45,7 +45,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(variant); WINE_DEFAULT_DEBUG_CHANNEL(variant);
const char * const wine_vtypes[VT_CLSID+1] = static const char * const variant_types[] =
{ {
"VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE", "VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE",
"VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN", "VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN",
@ -55,10 +55,11 @@ const char * const wine_vtypes[VT_CLSID+1] =
"VT_RECORD","VT_INT_PTR","VT_UINT_PTR","39","40","41","42","43","44","45", "VT_RECORD","VT_INT_PTR","VT_UINT_PTR","39","40","41","42","43","44","45",
"46","47","48","49","50","51","52","53","54","55","56","57","58","59","60", "46","47","48","49","50","51","52","53","54","55","56","57","58","59","60",
"61","62","63","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE", "61","62","63","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE",
"VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID" "VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID",
"VT_VERSIONED_STREAM"
}; };
const char * const wine_vflags[16] = static const char * const variant_flags[16] =
{ {
"", "",
"|VT_VECTOR", "|VT_VECTOR",
@ -68,16 +69,30 @@ const char * const wine_vflags[16] =
"|VT_VECTOR|VT_ARRAY", "|VT_VECTOR|VT_ARRAY",
"|VT_ARRAY|VT_BYREF", "|VT_ARRAY|VT_BYREF",
"|VT_VECTOR|VT_ARRAY|VT_BYREF", "|VT_VECTOR|VT_ARRAY|VT_BYREF",
"|VT_HARDTYPE", "|VT_RESERVED",
"|VT_VECTOR|VT_HARDTYPE", "|VT_VECTOR|VT_RESERVED",
"|VT_ARRAY|VT_HARDTYPE", "|VT_ARRAY|VT_RESERVED",
"|VT_VECTOR|VT_ARRAY|VT_HARDTYPE", "|VT_VECTOR|VT_ARRAY|VT_RESERVED",
"|VT_BYREF|VT_HARDTYPE", "|VT_BYREF|VT_RESERVED",
"|VT_VECTOR|VT_ARRAY|VT_HARDTYPE", "|VT_VECTOR|VT_ARRAY|VT_RESERVED",
"|VT_ARRAY|VT_BYREF|VT_HARDTYPE", "|VT_ARRAY|VT_BYREF|VT_RESERVED",
"|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_HARDTYPE", "|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED",
}; };
const char *debugstr_vt(VARTYPE vt)
{
if(vt & ~VT_TYPEMASK)
return wine_dbg_sprintf("%s%s", debugstr_vt(vt&VT_TYPEMASK), variant_flags[vt>>12]);
if(vt <= sizeof(variant_types)/sizeof(*variant_types))
return variant_types[vt];
if(vt == VT_BSTR_BLOB)
return "VT_BSTR_BLOB";
return wine_dbg_sprintf("vt(invalid %x)", vt);
}
const char *debugstr_variant(const VARIANT *v) const char *debugstr_variant(const VARIANT *v)
{ {
if(!v) if(!v)
@ -109,7 +124,7 @@ const char *debugstr_variant(const VARIANT *v)
case VT_UINT: case VT_UINT:
return wine_dbg_sprintf("%p {VT_UINT: %u}", v, V_UINT(v)); return wine_dbg_sprintf("%p {VT_UINT: %u}", v, V_UINT(v));
default: default:
return wine_dbg_sprintf("%p {vt %s%s}", v, debugstr_VT(v), debugstr_VF(v)); return wine_dbg_sprintf("%p {vt %s}", v, debugstr_vt(V_VT(v)));
} }
} }
@ -121,8 +136,8 @@ static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags,
VARTYPE vtFrom = V_TYPE(ps); VARTYPE vtFrom = V_TYPE(ps);
DWORD dwFlags = 0; DWORD dwFlags = 0;
TRACE("(%s,0x%08x,0x%04x,%s,%s%s)\n", debugstr_variant(pd), lcid, wFlags, TRACE("(%s,0x%08x,0x%04x,%s,%s)\n", debugstr_variant(pd), lcid, wFlags,
debugstr_variant(ps), debugstr_vt(vt), debugstr_vf(vt)); debugstr_variant(ps), debugstr_vt(vt));
if (vt == VT_BSTR || vtFrom == VT_BSTR) if (vt == VT_BSTR || vtFrom == VT_BSTR)
{ {
@ -1030,8 +1045,8 @@ HRESULT WINAPI VariantChangeTypeEx(VARIANTARG* pvargDest, VARIANTARG* pvargSrc,
{ {
HRESULT res = S_OK; HRESULT res = S_OK;
TRACE("(%s,%s,0x%08x,0x%04x,%s%s)\n", debugstr_variant(pvargDest), TRACE("(%s,%s,0x%08x,0x%04x,%s)\n", debugstr_variant(pvargDest),
debugstr_variant(pvargSrc), lcid, wFlags, debugstr_vt(vt), debugstr_vf(vt)); debugstr_variant(pvargSrc), lcid, wFlags, debugstr_vt(vt));
if (vt == VT_CLSID) if (vt == VT_CLSID)
res = DISP_E_BADVARTYPE; res = DISP_E_BADVARTYPE;

View File

@ -48,16 +48,8 @@
#define VTBIT_VARIANT (1 << VT_VARIANT) #define VTBIT_VARIANT (1 << VT_VARIANT)
#define VTBIT_15 (1 << 15) /* no variant type with this number */ #define VTBIT_15 (1 << 15) /* no variant type with this number */
extern const char * const wine_vtypes[] DECLSPEC_HIDDEN;
#define debugstr_vt(v) (((v)&VT_TYPEMASK) <= VT_CLSID ? wine_vtypes[((v)&VT_TYPEMASK)] : \
((v)&VT_TYPEMASK) == VT_BSTR_BLOB ? "VT_BSTR_BLOB": "Invalid")
#define debugstr_VT(v) (!(v) ? "(null)" : debugstr_vt(V_TYPE((v))))
extern const char * const wine_vflags[] DECLSPEC_HIDDEN;
#define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12])
#define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN; const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
const char *debugstr_vt(VARTYPE) DECLSPEC_HIDDEN;
/* Size constraints */ /* Size constraints */
#define I1_MAX 0x7f #define I1_MAX 0x7f