oleaut32: Added debugstr_variant helper for better debug traces.

This commit is contained in:
Jacek Caban 2014-05-14 16:55:57 +02:00 committed by Alexandre Julliard
parent 5f51dda7ee
commit ed41fc1d9b
3 changed files with 50 additions and 21 deletions

View File

@ -1201,9 +1201,8 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
const BYTE* pToken = NULL; const BYTE* pToken = NULL;
HRESULT hRes = S_OK; HRESULT hRes = S_OK;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut, rgbTok, dwFlags, pbstrOut, lcid);
lcid);
V_VT(&vString) = VT_EMPTY; V_VT(&vString) = VT_EMPTY;
V_VT(&vBool) = VT_BOOL; V_VT(&vBool) = VT_BOOL;
@ -1612,9 +1611,8 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
const BYTE* pToken = NULL; const BYTE* pToken = NULL;
HRESULT hRes; HRESULT hRes;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut, debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut, lcid);
lcid);
V_VT(&vDate) = VT_EMPTY; V_VT(&vDate) = VT_EMPTY;
@ -1954,9 +1952,8 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
BOOL bUpper = FALSE; BOOL bUpper = FALSE;
HRESULT hRes = S_OK; HRESULT hRes = S_OK;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn), TRACE("%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut, rgbTok, dwFlags, pbstrOut, lcid);
lcid);
V_VT(&vStr) = VT_EMPTY; V_VT(&vStr) = VT_EMPTY;
@ -2168,9 +2165,8 @@ HRESULT WINAPI VarFormat(LPVARIANT pVarIn, LPOLESTR lpszFormat,
BYTE buff[256]; BYTE buff[256];
HRESULT hres; HRESULT hres;
TRACE("(%p->(%s%s),%s,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%s,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), nFirstDay, nFirstWeek, nFirstDay, nFirstWeek, dwFlags, pbstrOut);
dwFlags, pbstrOut);
if (!pbstrOut) if (!pbstrOut)
return E_INVALIDARG; return E_INVALIDARG;
@ -2219,8 +2215,7 @@ HRESULT WINAPI VarFormatDateTime(LPVARIANT pVarIn, INT nFormat, ULONG dwFlags, B
static WCHAR szEmpty[] = { '\0' }; static WCHAR szEmpty[] = { '\0' };
const BYTE* lpFmt = NULL; const BYTE* lpFmt = NULL;
TRACE("(%p->(%s%s),%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn), TRACE("%s,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nFormat, dwFlags, pbstrOut);
debugstr_VF(pVarIn), nFormat, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nFormat < 0 || nFormat > 4) if (!pVarIn || !pbstrOut || nFormat < 0 || nFormat > 4)
return E_INVALIDARG; return E_INVALIDARG;
@ -2272,8 +2267,8 @@ HRESULT WINAPI VarFormatNumber(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
HRESULT hRet; HRESULT hRet;
VARIANT vStr; VARIANT vStr;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping, dwFlags, pbstrOut); nParens, nGrouping, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9) if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG; return E_INVALIDARG;
@ -2383,9 +2378,8 @@ HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
HRESULT hRet; HRESULT hRet;
VARIANT vDbl; VARIANT vDbl;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping, nParens, nGrouping, dwFlags, pbstrOut);
dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9) if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG; return E_INVALIDARG;
@ -2457,8 +2451,8 @@ HRESULT WINAPI VarFormatCurrency(LPVARIANT pVarIn, INT nDigits, INT nLeading,
HRESULT hRet; HRESULT hRet;
VARIANT vStr; VARIANT vStr;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn), TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping, dwFlags, pbstrOut); nParens, nGrouping, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9) if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG; return E_INVALIDARG;

View File

@ -78,6 +78,39 @@ const char * const wine_vflags[16] =
"|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_HARDTYPE", "|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_HARDTYPE",
}; };
const char *debugstr_variant(const VARIANT *v)
{
if(!v)
return "(null)";
switch(V_VT(v)) {
case VT_EMPTY:
return wine_dbg_sprintf("%p {VT_EMPTY}", v);
case VT_NULL:
return wine_dbg_sprintf("%p {VT_NULL}", v);
case VT_I1:
return wine_dbg_sprintf("%p {VT_I1: %d}", v, V_I1(v));
case VT_I2:
return wine_dbg_sprintf("%p {VT_I2: %d}", v, V_I2(v));
case VT_I4:
return wine_dbg_sprintf("%p {VT_I4: %d}", v, V_I4(v));
case VT_R8:
return wine_dbg_sprintf("%p {VT_R8: %lf}", v, V_R8(v));
case VT_BSTR:
return wine_dbg_sprintf("%p {VT_BSTR: %s}", v, debugstr_w(V_BSTR(v)));
case VT_DISPATCH:
return wine_dbg_sprintf("%p {VT_DISPATCH: %p}", v, V_DISPATCH(v));
case VT_ERROR:
return wine_dbg_sprintf("%p {VT_ERROR: %08x}", v, V_ERROR(v));
case VT_BOOL:
return wine_dbg_sprintf("%p {VT_BOOL: %x}", v, V_BOOL(v));
case VT_UINT:
return wine_dbg_sprintf("%p {VT_UINT: %u}", v, V_UINT(v));
default:
return wine_dbg_sprintf("%p {vt %s%s}", v, debugstr_VT(v), debugstr_VF(v));
}
}
/* Convert a variant from one type to another */ /* Convert a variant from one type to another */
static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags, static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags,
VARIANTARG* ps, VARTYPE vt) VARIANTARG* ps, VARTYPE vt)

View File

@ -57,6 +57,8 @@ extern const char * const wine_vflags[] DECLSPEC_HIDDEN;
#define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12]) #define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12])
#define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v))) #define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
/* Size constraints */ /* Size constraints */
#define I1_MAX 0x7f #define I1_MAX 0x7f
#define I1_MIN ((-I1_MAX)-1) #define I1_MIN ((-I1_MAX)-1)