Ensure VarBstrCat handles null parms as per windows and actually does
the concatenation even for null args.
This commit is contained in:
parent
0bb6fdda90
commit
daec720709
@ -4916,18 +4916,22 @@ HRESULT WINAPI VarBstrCmp(BSTR left, BSTR right, LCID lcid, DWORD flags)
|
|||||||
HRESULT WINAPI VarBstrCat(BSTR left, BSTR right, BSTR *out)
|
HRESULT WINAPI VarBstrCat(BSTR left, BSTR right, BSTR *out)
|
||||||
{
|
{
|
||||||
BSTR result;
|
BSTR result;
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
TRACE("( %s %s %p )\n", debugstr_w(left), debugstr_w(right), out);
|
TRACE("( %s %s %p )\n", debugstr_w(left), debugstr_w(right), out);
|
||||||
|
|
||||||
if( (!left) || (!right) || (!out) )
|
/* On Windows, NULL parms are still handled (as empty strings) */
|
||||||
return 0;
|
if (left) size=size + lstrlenW(left);
|
||||||
|
if (right) size=size + lstrlenW(right);
|
||||||
result = SysAllocStringLen(left, lstrlenW(left)+lstrlenW(right));
|
|
||||||
lstrcatW(result,right);
|
|
||||||
|
|
||||||
|
if (out) {
|
||||||
|
result = SysAllocStringLen(NULL, size);
|
||||||
*out = result;
|
*out = result;
|
||||||
|
if (left) lstrcatW(result,left);
|
||||||
return 1;
|
if (right) lstrcatW(result,right);
|
||||||
|
TRACE("result = %s, [%p]\n", debugstr_w(result), result);
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@ -5529,5 +5533,3 @@ HRESULT WINAPI VarFormat(LPVARIANT varIn, LPOLESTR format,
|
|||||||
TRACE("result: '%s'\n", debugstr_w(*pbstrOut));
|
TRACE("result: '%s'\n", debugstr_w(*pbstrOut));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user