Ensure VarBstrCat handles null parms as per windows and actually does

the concatenation even for null args.
This commit is contained in:
Jason Edmeades 2002-07-05 01:22:03 +00:00 committed by Alexandre Julliard
parent 0bb6fdda90
commit daec720709
1 changed files with 38 additions and 36 deletions

View File

@ -4916,18 +4916,22 @@ HRESULT WINAPI VarBstrCmp(BSTR left, BSTR right, LCID lcid, DWORD flags)
HRESULT WINAPI VarBstrCat(BSTR left, BSTR right, BSTR *out)
{
BSTR result;
int size = 0;
TRACE("( %s %s %p )\n", debugstr_w(left), debugstr_w(right), out);
if( (!left) || (!right) || (!out) )
return 0;
result = SysAllocStringLen(left, lstrlenW(left)+lstrlenW(right));
lstrcatW(result,right);
/* On Windows, NULL parms are still handled (as empty strings) */
if (left) size=size + lstrlenW(left);
if (right) size=size + lstrlenW(right);
if (out) {
result = SysAllocStringLen(NULL, size);
*out = result;
return 1;
if (left) lstrcatW(result,left);
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));
return rc;
}