oleaut32: Assign to structs instead of using memcpy.

This commit is contained in:
Andrew Talbot 2008-03-11 20:55:17 +00:00 committed by Alexandre Julliard
parent 3ca73da928
commit 9d16a42210
7 changed files with 21 additions and 22 deletions

View file

@ -1556,7 +1556,7 @@ static HRESULT WINAPI OLEFontImpl_GetClassID(
if (pClassID==0)
return E_POINTER;
memcpy(pClassID, &CLSID_StdFont, sizeof(CLSID_StdFont));
*pClassID = CLSID_StdFont;
return S_OK;
}

View file

@ -316,7 +316,7 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
newObject->bIsDirty = FALSE;
if (pictDesc) {
memcpy(&newObject->desc, pictDesc, sizeof(PICTDESC));
newObject->desc = *pictDesc;
switch(pictDesc->picType) {
case PICTYPE_BITMAP:
@ -955,7 +955,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID(
IPersistStream* iface,CLSID* pClassID)
{
TRACE("(%p)\n", pClassID);
memcpy(pClassID, &CLSID_StdPicture, sizeof(*pClassID));
*pClassID = CLSID_StdPicture;
return S_OK;
}
@ -2077,7 +2077,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
/* Fill out the BITMAPINFOHEADER */
pIconBitmapHeader = (BITMAPINFOHEADER *)(pIconData + 3 * sizeof(WORD) + sizeof(CURSORICONFILEDIRENTRY));
memcpy(pIconBitmapHeader, &pInfoBitmap->bmiHeader, sizeof(BITMAPINFOHEADER));
*pIconBitmapHeader = pInfoBitmap->bmiHeader;
/* Find out whether a palette exists for the bitmap */
if ( (pInfoBitmap->bmiHeader.biBitCount == 16 && pInfoBitmap->bmiHeader.biCompression == BI_RGB)

View file

@ -268,7 +268,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid)
if(!pguid)
return E_INVALIDARG;
memcpy(pguid, &This->guid, sizeof(GUID));
*pguid = This->guid;
return S_OK;
}
@ -557,7 +557,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
if(typeattr->typekind == TKIND_ALIAS) {
hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.u.hreftype, &pTypeInfo);
memcpy(&guid, &typeattr->guid, sizeof(GUID));
guid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(pTI, typeattr);
if(FAILED(hres)) {
WARN("GetRefTypeInfo failed: %08x\n", hres);
@ -567,7 +567,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
}else {
pTypeInfo = pTI;
ITypeInfo_AddRef(pTypeInfo);
memcpy(&guid, &typeattr->guid, sizeof(GUID));
guid = typeattr->guid;
}
if(typeattr->typekind != TKIND_RECORD) {
@ -585,7 +585,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
ret->size = typeattr->cbSizeInstance;
ITypeInfo_ReleaseTypeAttr(pTypeInfo, typeattr);
memcpy(&ret->guid, &guid, sizeof(GUID));
ret->guid = guid;
/* NOTE: Windows implementation calls ITypeInfo::GetCantainingTypeLib and
* ITypeLib::GetLibAttr, but we currently don't need this.

View file

@ -1802,7 +1802,7 @@ PSFacBuf_CreateProxy(
/* one reference for the proxy */
proxy->ref = 1;
proxy->tinfo = tinfo;
memcpy(&proxy->iid,riid,sizeof(*riid));
proxy->iid = *riid;
proxy->chanbuf = 0;
InitializeCriticalSection(&proxy->crit);
@ -2218,7 +2218,7 @@ PSFacBuf_CreateStub(
stub->tinfo = tinfo;
stub->dispatch_stub = NULL;
stub->dispatch_derivative = FALSE;
memcpy(&(stub->iid),riid,sizeof(*riid));
stub->iid = *riid;
hres = IRpcStubBuffer_Connect((LPRPCSTUBBUFFER)stub,pUnkServer);
*ppStub = (LPRPCSTUBBUFFER)stub;
TRACE("IRpcStubBuffer: %p\n", stub);

View file

@ -3477,8 +3477,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
pOtherTypeInfoBlks[i].name_offs +
pNameTable);
(*ppTypeInfoImpl)->dwHelpContext = pOtherTypeInfoBlks[i].helpcontext;
memcpy(&((*ppTypeInfoImpl)->TypeAttr.guid), &pOtherTypeInfoBlks[i].uuid,
sizeof(GUID));
(*ppTypeInfoImpl)->TypeAttr.guid = pOtherTypeInfoBlks[i].uuid;
(*ppTypeInfoImpl)->TypeAttr.typekind = pTIHeader->typekind;
(*ppTypeInfoImpl)->TypeAttr.wMajorVerNum = pTIHeader->major_version;
(*ppTypeInfoImpl)->TypeAttr.wMinorVerNum = pTIHeader->minor_version;
@ -3849,7 +3848,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLibImpl *This = (ITypeLibImpl *)iface;
TRACE("(%p)\n",This);
*ppTLibAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTLibAttr));
memcpy(*ppTLibAttr, &This->LibAttr, sizeof(**ppTLibAttr));
**ppTLibAttr = This->LibAttr;
return S_OK;
}
@ -4589,7 +4588,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
if (!*ppTypeAttr)
return E_OUTOFMEMORY;
memcpy(*ppTypeAttr, &This->TypeAttr, sizeof(**ppTypeAttr));
**ppTypeAttr = This->TypeAttr;
if (This->TypeAttr.typekind == TKIND_ALIAS)
TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias,
@ -4632,14 +4631,14 @@ static SIZE_T TLB_SizeElemDesc( const ELEMDESC *elemdesc )
static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buffer )
{
memcpy(dest, src, sizeof(ELEMDESC));
*dest = *src;
*buffer = TLB_CopyTypeDesc(&dest->tdesc, &src->tdesc, *buffer);
if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
{
const PARAMDESCEX *pparamdescex_src = src->u.paramdesc.pparamdescex;
PARAMDESCEX *pparamdescex_dest = dest->u.paramdesc.pparamdescex = (PARAMDESCEX *)*buffer;
*buffer += sizeof(PARAMDESCEX);
memcpy(pparamdescex_dest, pparamdescex_src, sizeof(PARAMDESCEX));
*pparamdescex_dest = *pparamdescex_src;
VariantInit(&pparamdescex_dest->varDefaultValue);
return VariantCopy(&pparamdescex_dest->varDefaultValue,
(VARIANTARG *)&pparamdescex_src->varDefaultValue);
@ -4674,7 +4673,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
dest = (FUNCDESC *)SysAllocStringByteLen(NULL, size);
if (!dest) return E_OUTOFMEMORY;
memcpy(dest, src, sizeof(FUNCDESC));
*dest = *src;
if (dispinterface) /* overwrite funckind */
dest->funckind = FUNC_DISPATCH;
buffer = (char *)(dest + 1);

View file

@ -404,7 +404,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
}
sp = &GifFile->SavedImages[GifFile->ImageCount];
memcpy(&sp->ImageDesc, &GifFile->Image, sizeof(GifImageDesc));
sp->ImageDesc = GifFile->Image;
if (GifFile->Image.ColorMap != NULL) {
sp->ImageDesc.ColorMap = MakeMapObject(
GifFile->Image.ColorMap->ColorCount,

View file

@ -1254,7 +1254,7 @@ INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut)
if (lpSt->wMonth > 12)
return FALSE;
memcpy(&ud.st, lpSt, sizeof(ud.st));
ud.st = *lpSt;
return !VarDateFromUdate(&ud, 0, pDateOut);
}
@ -1280,7 +1280,7 @@ INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt)
if (FAILED(VarUdateFromDate(dateIn, 0, &ud)))
return FALSE;
memcpy(lpSt, &ud.st, sizeof(ud.st));
*lpSt = ud.st;
return TRUE;
}
@ -1312,8 +1312,8 @@ HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DAT
if (lcid != MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
FIXME("lcid possibly not handled, treating as en-us\n");
memcpy(&ud, pUdateIn, sizeof(ud));
ud = *pUdateIn;
if (dwFlags & VAR_VALIDDATE)
WARN("Ignoring VAR_VALIDDATE\n");