msxml3: Don't make a variant copy if no need to for setting node value.
This commit is contained in:
parent
c9563be542
commit
d4d92616b9
|
@ -282,9 +282,12 @@ static HRESULT node_set_content_escaped(xmlnode *This, LPCWSTR value)
|
||||||
|
|
||||||
HRESULT node_put_value(xmlnode *This, VARIANT *value)
|
HRESULT node_put_value(xmlnode *This, VARIANT *value)
|
||||||
{
|
{
|
||||||
VARIANT string_value;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (V_VT(value) != VT_BSTR)
|
||||||
|
{
|
||||||
|
VARIANT string_value;
|
||||||
|
|
||||||
VariantInit(&string_value);
|
VariantInit(&string_value);
|
||||||
hr = VariantChangeType(&string_value, value, 0, VT_BSTR);
|
hr = VariantChangeType(&string_value, value, 0, VT_BSTR);
|
||||||
if(FAILED(hr)) {
|
if(FAILED(hr)) {
|
||||||
|
@ -294,15 +297,21 @@ HRESULT node_put_value(xmlnode *This, VARIANT *value)
|
||||||
|
|
||||||
hr = node_set_content(This, V_BSTR(&string_value));
|
hr = node_set_content(This, V_BSTR(&string_value));
|
||||||
VariantClear(&string_value);
|
VariantClear(&string_value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hr = node_set_content(This, V_BSTR(value));
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT node_put_value_escaped(xmlnode *This, VARIANT *value)
|
HRESULT node_put_value_escaped(xmlnode *This, VARIANT *value)
|
||||||
{
|
{
|
||||||
VARIANT string_value;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (V_VT(value) != VT_BSTR)
|
||||||
|
{
|
||||||
|
VARIANT string_value;
|
||||||
|
|
||||||
VariantInit(&string_value);
|
VariantInit(&string_value);
|
||||||
hr = VariantChangeType(&string_value, value, 0, VT_BSTR);
|
hr = VariantChangeType(&string_value, value, 0, VT_BSTR);
|
||||||
if(FAILED(hr)) {
|
if(FAILED(hr)) {
|
||||||
|
@ -312,6 +321,9 @@ HRESULT node_put_value_escaped(xmlnode *This, VARIANT *value)
|
||||||
|
|
||||||
hr = node_set_content_escaped(This, V_BSTR(&string_value));
|
hr = node_set_content_escaped(This, V_BSTR(&string_value));
|
||||||
VariantClear(&string_value);
|
VariantClear(&string_value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hr = node_set_content_escaped(This, V_BSTR(value));
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue