Commit ed41fc1d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

oleaut32: Added debugstr_variant helper for better debug traces.

parent 5f51dda7
......@@ -1201,9 +1201,8 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
const BYTE* pToken = NULL;
HRESULT hRes = S_OK;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut,
lcid);
TRACE("(%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
rgbTok, dwFlags, pbstrOut, lcid);
V_VT(&vString) = VT_EMPTY;
V_VT(&vBool) = VT_BOOL;
......@@ -1612,9 +1611,8 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
const BYTE* pToken = NULL;
HRESULT hRes;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut,
lcid);
TRACE("(%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn),
debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut, lcid);
V_VT(&vDate) = VT_EMPTY;
......@@ -1954,9 +1952,8 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
BOOL bUpper = FALSE;
HRESULT hRes = S_OK;
TRACE("(%p->(%s%s),%s,%p,0x%08x,%p,0x%08x)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), rgbTok, dwFlags, pbstrOut,
lcid);
TRACE("%s,%s,%p,0x%08x,%p,0x%08x)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
rgbTok, dwFlags, pbstrOut, lcid);
V_VT(&vStr) = VT_EMPTY;
......@@ -2168,9 +2165,8 @@ HRESULT WINAPI VarFormat(LPVARIANT pVarIn, LPOLESTR lpszFormat,
BYTE buff[256];
HRESULT hres;
TRACE("(%p->(%s%s),%s,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), debugstr_w(lpszFormat), nFirstDay, nFirstWeek,
dwFlags, pbstrOut);
TRACE("(%s,%s,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), debugstr_w(lpszFormat),
nFirstDay, nFirstWeek, dwFlags, pbstrOut);
if (!pbstrOut)
return E_INVALIDARG;
......@@ -2219,8 +2215,7 @@ HRESULT WINAPI VarFormatDateTime(LPVARIANT pVarIn, INT nFormat, ULONG dwFlags, B
static WCHAR szEmpty[] = { '\0' };
const BYTE* lpFmt = NULL;
TRACE("(%p->(%s%s),%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), nFormat, dwFlags, pbstrOut);
TRACE("%s,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nFormat, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nFormat < 0 || nFormat > 4)
return E_INVALIDARG;
......@@ -2272,8 +2267,8 @@ HRESULT WINAPI VarFormatNumber(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
HRESULT hRet;
VARIANT vStr;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping, dwFlags, pbstrOut);
TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
nParens, nGrouping, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG;
......@@ -2383,9 +2378,8 @@ HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
HRESULT hRet;
VARIANT vDbl;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping,
dwFlags, pbstrOut);
TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
nParens, nGrouping, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG;
......@@ -2457,8 +2451,8 @@ HRESULT WINAPI VarFormatCurrency(LPVARIANT pVarIn, INT nDigits, INT nLeading,
HRESULT hRet;
VARIANT vStr;
TRACE("(%p->(%s%s),%d,%d,%d,%d,0x%08x,%p)\n", pVarIn, debugstr_VT(pVarIn),
debugstr_VF(pVarIn), nDigits, nLeading, nParens, nGrouping, dwFlags, pbstrOut);
TRACE("(%s,%d,%d,%d,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nDigits, nLeading,
nParens, nGrouping, dwFlags, pbstrOut);
if (!pVarIn || !pbstrOut || nDigits > 9)
return E_INVALIDARG;
......
......@@ -78,6 +78,39 @@ const char * const wine_vflags[16] =
"|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 */
static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags,
VARIANTARG* ps, VARTYPE vt)
......
......@@ -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) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
/* Size constraints */
#define I1_MAX 0x7f
#define I1_MIN ((-I1_MAX)-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment