msxml3: Respect string length returned from ISAXAttributes.

This commit is contained in:
Nikolay Sivov 2011-08-27 15:01:57 +04:00 committed by Alexandre Julliard
parent d0413fd476
commit 9ae103f7f7
2 changed files with 10 additions and 9 deletions

View File

@ -782,7 +782,7 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement(
for (i = 0; i < length; i++)
{
const WCHAR *str;
INT len;
INT len = 0;
hr = ISAXAttributes_getQName(attr, i, &str, &len);
if (FAILED(hr)) return hr;
@ -790,16 +790,17 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement(
/* space separator in front of every attribute */
xmlOutputBufferWriteString(This->buffer, " ");
s = xmlchar_from_wchar(str);
s = xmlchar_from_wcharn(str, len);
xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s);
xmlOutputBufferWriteString(This->buffer, "=\"");
len = 0;
hr = ISAXAttributes_getValue(attr, i, &str, &len);
if (FAILED(hr)) return hr;
s = xmlchar_from_wchar(str);
s = xmlchar_from_wcharn(str, len);
xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s);

View File

@ -567,13 +567,13 @@ static HRESULT WINAPI isaxattributes_getQName(
const WCHAR **pQName,
int *pQNameLength)
{
static const WCHAR attr1W[] = {'a',':','a','t','t','r','1',0};
static const WCHAR attr2W[] = {'a','t','t','r','2',0};
static const WCHAR attr1W[] = {'a',':','a','t','t','r','1','j','u','n','k',0};
static const WCHAR attr2W[] = {'a','t','t','r','2','j','u','n','k',0};
ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex);
*pQName = (nIndex == 0) ? attr1W : attr2W;
*pQNameLength = lstrlenW(*pQName);
*pQNameLength = (nIndex == 0) ? 7 : 5;
return S_OK;
}
@ -654,13 +654,13 @@ static HRESULT WINAPI isaxattributes_getValue(
const WCHAR ** pValue,
int * nValue)
{
static const WCHAR attrval1W[] = {'a','1',0};
static const WCHAR attrval2W[] = {'a','2',0};
static const WCHAR attrval1W[] = {'a','1','j','u','n','k',0};
static const WCHAR attrval2W[] = {'a','2','j','u','n','k',0};
ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex);
*pValue = (nIndex == 0) ? attrval1W : attrval2W;
*nValue = lstrlenW(*pValue);
*nValue = 2;
return S_OK;
}