Sync to Wine-0_9_4:

Robert Shearman <rob@codeweavers.com>
- OLE: Fix SafeArrayCopy for NULL pvData.
  It is allowed to copy a SAFEARRAY with a NULL pvData, as long as
  cbElements is non-zero. Add a test for this and fix the safe array
  code.
- OLE: Add const to several typelib functions.
  Add const attributes to parameters for several functions and fix up
  some formatting.
- OleTranslateColor trace fix.
  OleTranslateColor isn't a stub so don't print ":stub" in the trace
  message.

svn path=/trunk/; revision=20351
This commit is contained in:
Gé van Geldorp 2005-12-26 23:18:49 +00:00
parent 754cd8a82e
commit afdf040ea3
3 changed files with 19 additions and 11 deletions

View file

@ -629,7 +629,7 @@ HRESULT WINAPI OleTranslateColor(
COLORREF colorref;
BYTE b = HIBYTE(HIWORD(clr));
TRACE("(%08lx, %p, %p):stub\n", clr, hpal, pColorRef);
TRACE("(%08lx, %p, %p)\n", clr, hpal, pColorRef);
/*
* In case pColorRef is NULL, provide our own to simplify the code.

View file

@ -355,7 +355,9 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell)
/* Copy data items from one array to another */
static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest)
{
if (!psa->pvData || !dest->pvData || psa->fFeatures & FADF_DATADELETED)
if (!psa->pvData)
return S_OK;
else if (!dest->pvData || psa->fFeatures & FADF_DATADELETED)
return E_INVALIDARG;
else
{
@ -1378,6 +1380,12 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
if (!psa)
return S_OK; /* Handles copying of NULL arrays */
if (!psa->cbElements)
{
ERR("not copying an array of 0 elements\n");
return E_INVALIDARG;
}
if (psa->fFeatures & (FADF_RECORD|FADF_HAVEIID|FADF_HAVEVARTYPE))
{
VARTYPE vt;

View file

@ -85,7 +85,7 @@ WINE_DECLARE_DEBUG_CHANNEL(typelib);
/* The OLE Automation ProxyStub Interface Class (aka Typelib Marshaler) */
const GUID CLSID_PSOAInterface = { 0x00020424, 0, 0, { 0xC0, 0, 0, 0, 0, 0, 0, 0x46 } };
static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTYPE *vt);
static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, VARTYPE *vt);
static HRESULT TLB_AllocAndInitVarDesc(const VARDESC *src, VARDESC **dest_ptr);
/****************************************************************************
@ -5054,7 +5054,7 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
return E_FAIL;
}
static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTYPE *vt)
static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, VARTYPE *vt)
{
HRESULT hr = S_OK;
ITypeInfo *tinfo2 = NULL;
@ -5088,11 +5088,11 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTY
break;
case TKIND_INTERFACE:
if (IsEqualIID(&IID_IDispatch, &tattr->guid))
*vt |= VT_DISPATCH;
else
*vt |= VT_UNKNOWN;
break;
if (IsEqualIID(&IID_IDispatch, &tattr->guid))
*vt |= VT_DISPATCH;
else
*vt |= VT_UNKNOWN;
break;
case TKIND_DISPATCH:
*vt |= VT_DISPATCH;
@ -5118,7 +5118,7 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTY
return hr;
}
static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTYPE *vt)
static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, VARTYPE *vt)
{
HRESULT hr = S_OK;
@ -5134,7 +5134,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, TYPEDESC *tdesc, VARTYP
((tdesc->vt == VT_PTR) && (tdesc->u.lptdesc->vt == VT_USERDEFINED)))
{
VARTYPE vt_userdefined = 0;
TYPEDESC *tdesc_userdefined = tdesc;
const TYPEDESC *tdesc_userdefined = tdesc;
if (tdesc->vt == VT_PTR)
{
vt_userdefined = VT_BYREF;