зеркало из https://github.com/mozilla/gecko-dev.git
Fix IPropertyBag::Read implementation to treat pVar as [in,out] and honour callers requested VARTYPE. b=193782 r=dbradley@netscape.com sr=blizzard@mozilla.org a=asa@mozilla.org
This commit is contained in:
Родитель
a8e6f7c025
Коммит
33e1be5824
|
@ -66,18 +66,33 @@ HRESULT STDMETHODCALLTYPE CPropertyBag::Read(/* [in] */ LPCOLESTR pszPropName, /
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VARTYPE vt = pVar->vt;
|
||||||
VariantInit(pVar);
|
VariantInit(pVar);
|
||||||
|
|
||||||
for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++)
|
for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++)
|
||||||
{
|
{
|
||||||
if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0)
|
if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0)
|
||||||
{
|
{
|
||||||
|
const VARIANT *pvSrc = m_PropertyList.GetValueOf(i);
|
||||||
|
if (!pvSrc)
|
||||||
|
{
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
CComVariant vNew;
|
||||||
|
HRESULT hr = (vt == VT_EMPTY) ?
|
||||||
|
vNew.Copy(pvSrc) : vNew.ChangeType(vt, pvSrc);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
// Copy the new value
|
// Copy the new value
|
||||||
VariantCopy(pVar, const_cast<VARIANT *>(m_PropertyList.GetValueOf(i)));
|
vNew.Detach(pVar);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Property does not exist in the bag
|
// Property does not exist in the bag
|
||||||
return E_INVALIDARG;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче