msxml3: Get rid of libxml2 accessors in ::substringData() for Text, Comment and CDATA nodes.
This commit is contained in:
parent
19c30897d4
commit
3d18a77ae7
|
@ -538,11 +538,10 @@ static HRESULT WINAPI domcdata_substringData(
|
||||||
LONG offset, LONG count, BSTR *p)
|
LONG offset, LONG count, BSTR *p)
|
||||||
{
|
{
|
||||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||||
xmlChar *pContent;
|
HRESULT hr;
|
||||||
LONG nLength = 0;
|
BSTR data;
|
||||||
HRESULT hr = S_FALSE;
|
|
||||||
|
|
||||||
TRACE("%p\n", iface);
|
TRACE("%p %d %d %p\n", This, offset, count, p);
|
||||||
|
|
||||||
if(!p)
|
if(!p)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -552,26 +551,24 @@ static HRESULT WINAPI domcdata_substringData(
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
return hr;
|
return S_FALSE;
|
||||||
|
|
||||||
pContent = xmlNodeGetContent(This->node.node);
|
hr = IXMLDOMCDATASection_get_data(iface, &data);
|
||||||
if(pContent)
|
if(hr == S_OK)
|
||||||
{
|
{
|
||||||
nLength = xmlStrlen(pContent);
|
LONG len = SysStringLen(data);
|
||||||
|
|
||||||
if( offset < nLength)
|
if(offset < len)
|
||||||
{
|
{
|
||||||
BSTR sContent = bstr_from_xmlChar(pContent);
|
if(offset + count > len)
|
||||||
if(offset + count > nLength)
|
*p = SysAllocString(&data[offset]);
|
||||||
*p = SysAllocString(&sContent[offset]);
|
|
||||||
else
|
else
|
||||||
*p = SysAllocStringLen(&sContent[offset], count);
|
*p = SysAllocStringLen(&data[offset], count);
|
||||||
|
|
||||||
SysFreeString(sContent);
|
|
||||||
hr = S_OK;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
hr = S_FALSE;
|
||||||
|
|
||||||
xmlFree(pContent);
|
SysFreeString(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -532,11 +532,10 @@ static HRESULT WINAPI domcomment_substringData(
|
||||||
LONG offset, LONG count, BSTR *p)
|
LONG offset, LONG count, BSTR *p)
|
||||||
{
|
{
|
||||||
domcomment *This = impl_from_IXMLDOMComment( iface );
|
domcomment *This = impl_from_IXMLDOMComment( iface );
|
||||||
xmlChar *pContent;
|
HRESULT hr;
|
||||||
LONG nLength = 0;
|
BSTR data;
|
||||||
HRESULT hr = S_FALSE;
|
|
||||||
|
|
||||||
TRACE("%p %d %d %p\n", iface, offset, count, p);
|
TRACE("%p %d %d %p\n", This, offset, count, p);
|
||||||
|
|
||||||
if(!p)
|
if(!p)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -548,24 +547,22 @@ static HRESULT WINAPI domcomment_substringData(
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
pContent = xmlNodeGetContent(This->node.node);
|
hr = IXMLDOMComment_get_data(iface, &data);
|
||||||
if(pContent)
|
if(hr == S_OK)
|
||||||
{
|
{
|
||||||
nLength = xmlStrlen(pContent);
|
LONG len = SysStringLen(data);
|
||||||
|
|
||||||
if( offset < nLength)
|
if(offset < len)
|
||||||
{
|
{
|
||||||
BSTR sContent = bstr_from_xmlChar(pContent);
|
if(offset + count > len)
|
||||||
if(offset + count > nLength)
|
*p = SysAllocString(&data[offset]);
|
||||||
*p = SysAllocString(&sContent[offset]);
|
|
||||||
else
|
else
|
||||||
*p = SysAllocStringLen(&sContent[offset], count);
|
*p = SysAllocStringLen(&data[offset], count);
|
||||||
|
|
||||||
SysFreeString(sContent);
|
|
||||||
hr = S_OK;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
hr = S_FALSE;
|
||||||
|
|
||||||
xmlFree(pContent);
|
SysFreeString(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -540,11 +540,10 @@ static HRESULT WINAPI domtext_substringData(
|
||||||
LONG offset, LONG count, BSTR *p)
|
LONG offset, LONG count, BSTR *p)
|
||||||
{
|
{
|
||||||
domtext *This = impl_from_IXMLDOMText( iface );
|
domtext *This = impl_from_IXMLDOMText( iface );
|
||||||
xmlChar *pContent;
|
HRESULT hr;
|
||||||
LONG nLength = 0;
|
BSTR data;
|
||||||
HRESULT hr = S_FALSE;
|
|
||||||
|
|
||||||
TRACE("%p\n", iface);
|
TRACE("%p %d %d %p\n", This, offset, count, p);
|
||||||
|
|
||||||
if(!p)
|
if(!p)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -554,26 +553,24 @@ static HRESULT WINAPI domtext_substringData(
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
return hr;
|
return S_FALSE;
|
||||||
|
|
||||||
pContent = xmlNodeGetContent(This->node.node);
|
hr = IXMLDOMText_get_data(iface, &data);
|
||||||
if(pContent)
|
if(hr == S_OK)
|
||||||
{
|
{
|
||||||
nLength = xmlStrlen(pContent);
|
LONG len = SysStringLen(data);
|
||||||
|
|
||||||
if( offset < nLength)
|
if(offset < len)
|
||||||
{
|
{
|
||||||
BSTR sContent = bstr_from_xmlChar(pContent);
|
if(offset + count > len)
|
||||||
if(offset + count > nLength)
|
*p = SysAllocString(&data[offset]);
|
||||||
*p = SysAllocString(&sContent[offset]);
|
|
||||||
else
|
else
|
||||||
*p = SysAllocStringLen(&sContent[offset], count);
|
*p = SysAllocStringLen(&data[offset], count);
|
||||||
|
|
||||||
SysFreeString(sContent);
|
|
||||||
hr = S_OK;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
hr = S_FALSE;
|
||||||
|
|
||||||
xmlFree(pContent);
|
SysFreeString(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
Loading…
Reference in New Issue