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) if (pClassID==0)
return E_POINTER; return E_POINTER;
memcpy(pClassID, &CLSID_StdFont, sizeof(CLSID_StdFont)); *pClassID = CLSID_StdFont;
return S_OK; return S_OK;
} }

View File

@ -316,7 +316,7 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
newObject->bIsDirty = FALSE; newObject->bIsDirty = FALSE;
if (pictDesc) { if (pictDesc) {
memcpy(&newObject->desc, pictDesc, sizeof(PICTDESC)); newObject->desc = *pictDesc;
switch(pictDesc->picType) { switch(pictDesc->picType) {
case PICTYPE_BITMAP: case PICTYPE_BITMAP:
@ -955,7 +955,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID(
IPersistStream* iface,CLSID* pClassID) IPersistStream* iface,CLSID* pClassID)
{ {
TRACE("(%p)\n", pClassID); TRACE("(%p)\n", pClassID);
memcpy(pClassID, &CLSID_StdPicture, sizeof(*pClassID)); *pClassID = CLSID_StdPicture;
return S_OK; return S_OK;
} }
@ -2077,7 +2077,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
/* Fill out the BITMAPINFOHEADER */ /* Fill out the BITMAPINFOHEADER */
pIconBitmapHeader = (BITMAPINFOHEADER *)(pIconData + 3 * sizeof(WORD) + sizeof(CURSORICONFILEDIRENTRY)); 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 */ /* Find out whether a palette exists for the bitmap */
if ( (pInfoBitmap->bmiHeader.biBitCount == 16 && pInfoBitmap->bmiHeader.biCompression == BI_RGB) 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) if(!pguid)
return E_INVALIDARG; return E_INVALIDARG;
memcpy(pguid, &This->guid, sizeof(GUID)); *pguid = This->guid;
return S_OK; return S_OK;
} }
@ -557,7 +557,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
if(typeattr->typekind == TKIND_ALIAS) { if(typeattr->typekind == TKIND_ALIAS) {
hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.u.hreftype, &pTypeInfo); hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.u.hreftype, &pTypeInfo);
memcpy(&guid, &typeattr->guid, sizeof(GUID)); guid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(pTI, typeattr); ITypeInfo_ReleaseTypeAttr(pTI, typeattr);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("GetRefTypeInfo failed: %08x\n", hres); WARN("GetRefTypeInfo failed: %08x\n", hres);
@ -567,7 +567,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
}else { }else {
pTypeInfo = pTI; pTypeInfo = pTI;
ITypeInfo_AddRef(pTypeInfo); ITypeInfo_AddRef(pTypeInfo);
memcpy(&guid, &typeattr->guid, sizeof(GUID)); guid = typeattr->guid;
} }
if(typeattr->typekind != TKIND_RECORD) { if(typeattr->typekind != TKIND_RECORD) {
@ -585,7 +585,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
ret->size = typeattr->cbSizeInstance; ret->size = typeattr->cbSizeInstance;
ITypeInfo_ReleaseTypeAttr(pTypeInfo, typeattr); ITypeInfo_ReleaseTypeAttr(pTypeInfo, typeattr);
memcpy(&ret->guid, &guid, sizeof(GUID)); ret->guid = guid;
/* NOTE: Windows implementation calls ITypeInfo::GetCantainingTypeLib and /* NOTE: Windows implementation calls ITypeInfo::GetCantainingTypeLib and
* ITypeLib::GetLibAttr, but we currently don't need this. * ITypeLib::GetLibAttr, but we currently don't need this.

View File

@ -1802,7 +1802,7 @@ PSFacBuf_CreateProxy(
/* one reference for the proxy */ /* one reference for the proxy */
proxy->ref = 1; proxy->ref = 1;
proxy->tinfo = tinfo; proxy->tinfo = tinfo;
memcpy(&proxy->iid,riid,sizeof(*riid)); proxy->iid = *riid;
proxy->chanbuf = 0; proxy->chanbuf = 0;
InitializeCriticalSection(&proxy->crit); InitializeCriticalSection(&proxy->crit);
@ -2218,7 +2218,7 @@ PSFacBuf_CreateStub(
stub->tinfo = tinfo; stub->tinfo = tinfo;
stub->dispatch_stub = NULL; stub->dispatch_stub = NULL;
stub->dispatch_derivative = FALSE; stub->dispatch_derivative = FALSE;
memcpy(&(stub->iid),riid,sizeof(*riid)); stub->iid = *riid;
hres = IRpcStubBuffer_Connect((LPRPCSTUBBUFFER)stub,pUnkServer); hres = IRpcStubBuffer_Connect((LPRPCSTUBBUFFER)stub,pUnkServer);
*ppStub = (LPRPCSTUBBUFFER)stub; *ppStub = (LPRPCSTUBBUFFER)stub;
TRACE("IRpcStubBuffer: %p\n", 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 + pOtherTypeInfoBlks[i].name_offs +
pNameTable); pNameTable);
(*ppTypeInfoImpl)->dwHelpContext = pOtherTypeInfoBlks[i].helpcontext; (*ppTypeInfoImpl)->dwHelpContext = pOtherTypeInfoBlks[i].helpcontext;
memcpy(&((*ppTypeInfoImpl)->TypeAttr.guid), &pOtherTypeInfoBlks[i].uuid, (*ppTypeInfoImpl)->TypeAttr.guid = pOtherTypeInfoBlks[i].uuid;
sizeof(GUID));
(*ppTypeInfoImpl)->TypeAttr.typekind = pTIHeader->typekind; (*ppTypeInfoImpl)->TypeAttr.typekind = pTIHeader->typekind;
(*ppTypeInfoImpl)->TypeAttr.wMajorVerNum = pTIHeader->major_version; (*ppTypeInfoImpl)->TypeAttr.wMajorVerNum = pTIHeader->major_version;
(*ppTypeInfoImpl)->TypeAttr.wMinorVerNum = pTIHeader->minor_version; (*ppTypeInfoImpl)->TypeAttr.wMinorVerNum = pTIHeader->minor_version;
@ -3849,7 +3848,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLibImpl *This = (ITypeLibImpl *)iface; ITypeLibImpl *This = (ITypeLibImpl *)iface;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
*ppTLibAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTLibAttr)); *ppTLibAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTLibAttr));
memcpy(*ppTLibAttr, &This->LibAttr, sizeof(**ppTLibAttr)); **ppTLibAttr = This->LibAttr;
return S_OK; return S_OK;
} }
@ -4589,7 +4588,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
if (!*ppTypeAttr) if (!*ppTypeAttr)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(*ppTypeAttr, &This->TypeAttr, sizeof(**ppTypeAttr)); **ppTypeAttr = This->TypeAttr;
if (This->TypeAttr.typekind == TKIND_ALIAS) if (This->TypeAttr.typekind == TKIND_ALIAS)
TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias, 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 ) 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); *buffer = TLB_CopyTypeDesc(&dest->tdesc, &src->tdesc, *buffer);
if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
{ {
const PARAMDESCEX *pparamdescex_src = src->u.paramdesc.pparamdescex; const PARAMDESCEX *pparamdescex_src = src->u.paramdesc.pparamdescex;
PARAMDESCEX *pparamdescex_dest = dest->u.paramdesc.pparamdescex = (PARAMDESCEX *)*buffer; PARAMDESCEX *pparamdescex_dest = dest->u.paramdesc.pparamdescex = (PARAMDESCEX *)*buffer;
*buffer += sizeof(PARAMDESCEX); *buffer += sizeof(PARAMDESCEX);
memcpy(pparamdescex_dest, pparamdescex_src, sizeof(PARAMDESCEX)); *pparamdescex_dest = *pparamdescex_src;
VariantInit(&pparamdescex_dest->varDefaultValue); VariantInit(&pparamdescex_dest->varDefaultValue);
return VariantCopy(&pparamdescex_dest->varDefaultValue, return VariantCopy(&pparamdescex_dest->varDefaultValue,
(VARIANTARG *)&pparamdescex_src->varDefaultValue); (VARIANTARG *)&pparamdescex_src->varDefaultValue);
@ -4674,7 +4673,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
dest = (FUNCDESC *)SysAllocStringByteLen(NULL, size); dest = (FUNCDESC *)SysAllocStringByteLen(NULL, size);
if (!dest) return E_OUTOFMEMORY; if (!dest) return E_OUTOFMEMORY;
memcpy(dest, src, sizeof(FUNCDESC)); *dest = *src;
if (dispinterface) /* overwrite funckind */ if (dispinterface) /* overwrite funckind */
dest->funckind = FUNC_DISPATCH; dest->funckind = FUNC_DISPATCH;
buffer = (char *)(dest + 1); buffer = (char *)(dest + 1);

View File

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

View File

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