PATCH: strict aliasing in dlls/ole32/
Marcus Meissner
marcus at jet.franken.de
Sat May 1 08:25:38 CDT 2004
Hi,
This fixes strict aliasing warnings/issues in dlls/ole32/.
This goes the weasly way by inserting a (char*) cast (instead of
union magic), basically telling the compiler that the &thing can alias
anything.
Ciao, Marcus
Changelog:
Fixed strict aliasing issues in dlls/ole32.
Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.91
diff -u -r1.91 compobj.c
--- dlls/ole32/compobj.c 29 Mar 2004 21:41:33 -0000 1.91
+++ dlls/ole32/compobj.c 1 May 2004 13:02:11 -0000
@@ -1015,7 +1015,7 @@
strcpy(pipefn,PIPEPREF);
WINE_StringFromCLSID(&newClass->classIdentifier,pipefn+strlen(PIPEPREF));
- hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)&classfac);
+ hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)(char*)&classfac);
if (hres) return hres;
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
@@ -1543,7 +1543,7 @@
pUnkOuter,
dwClsContext,
&IID_IUnknown,
- (VOID**)&pUnk);
+ (VOID**)(char*)&pUnk);
if (hr)
return hr;
Index: dlls/ole32/datacache.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/datacache.c,v
retrieving revision 1.22
diff -u -r1.22 datacache.c
--- dlls/ole32/datacache.c 23 Jan 2004 01:51:34 -0000 1.22
+++ dlls/ole32/datacache.c 1 May 2004 13:02:11 -0000
@@ -1085,7 +1085,7 @@
{
/* Get the Persist Storage */
- hr = IDataObject_QueryInterface(iface, &IID_IPersistStorage, (void**)&pPersistStorage);
+ hr = IDataObject_QueryInterface(iface, &IID_IPersistStorage, (void**)(char*)&pPersistStorage);
if (hr != S_OK)
goto cleanup;
@@ -1214,7 +1214,7 @@
TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
- hres = IDataObject_QueryInterface(iface, &IID_IOleCache2, (void**)&oleCache);
+ hres = IDataObject_QueryInterface(iface, &IID_IOleCache2, (void**)(char*)&oleCache);
if (FAILED(hres))
return E_UNEXPECTED;
Index: dlls/ole32/defaulthandler.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/defaulthandler.c,v
retrieving revision 1.15
diff -u -r1.15 defaulthandler.c
--- dlls/ole32/defaulthandler.c 12 Apr 2004 22:02:37 -0000 1.15
+++ dlls/ole32/defaulthandler.c 1 May 2004 13:02:12 -0000
@@ -1103,7 +1103,7 @@
TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
- hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)&cacheView);
+ hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)(char*)&cacheView);
if (FAILED(hres))
return E_UNEXPECTED;
@@ -1337,7 +1337,7 @@
hres = IUnknown_QueryInterface(this->dataCache,
&IID_IDataObject,
- (void**)&cacheDataObject);
+ (void**)(char*)&cacheDataObject);
if (FAILED(hres))
return E_UNEXPECTED;
@@ -1381,7 +1381,7 @@
hres = IUnknown_QueryInterface(this->dataCache,
&IID_IDataObject,
- (void**)&cacheDataObject);
+ (void**)(char*)&cacheDataObject);
if (FAILED(hres))
return E_UNEXPECTED;
@@ -1434,7 +1434,7 @@
hres = IUnknown_QueryInterface(this->dataCache,
&IID_IDataObject,
- (void**)&cacheDataObject);
+ (void**)(char*)&cacheDataObject);
if (FAILED(hres))
return E_UNEXPECTED;
Index: dlls/ole32/filemoniker.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/filemoniker.c,v
retrieving revision 1.32
diff -u -r1.32 filemoniker.c
--- dlls/ole32/filemoniker.c 20 Apr 2004 01:12:17 -0000 1.32
+++ dlls/ole32/filemoniker.c 1 May 2004 13:02:12 -0000
@@ -587,7 +587,7 @@
res=GetClassFile(This->filePathName,&clsID);
if (SUCCEEDED(res)){
- res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IPersistFile,(void**)&ppf);
+ res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IPersistFile,(void**)(char*)&ppf);
if (SUCCEEDED(res)){
res=IPersistFile_Load(ppf,This->filePathName,STGM_READ);
@@ -602,11 +602,11 @@
}
}
else{
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassFactory,(void**)&pcf);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassFactory,(void**)(char*)&pcf);
if (res==E_NOINTERFACE){
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)(char*)&pca);
if (res==E_NOINTERFACE)
return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED;
Index: dlls/ole32/ifs.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ifs.c,v
retrieving revision 1.37
diff -u -r1.37 ifs.c
--- dlls/ole32/ifs.c 23 Mar 2004 23:20:16 -0000 1.37
+++ dlls/ole32/ifs.c 1 May 2004 13:02:13 -0000
@@ -144,7 +144,7 @@
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMalloc,refiid)) {
- *obj = (LPMALLOC)&Malloc32;
+ *obj = (LPMALLOC)(char*)&Malloc32;
return S_OK;
}
return E_NOINTERFACE;
@@ -380,7 +380,7 @@
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) {
- *obj = (LPMALLOC)&MallocSpy;
+ *obj = (LPMALLOC)(char*)&MallocSpy;
return S_OK;
}
return E_NOINTERFACE;
@@ -530,7 +530,7 @@
*/
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
{
- *lpMalloc = (LPMALLOC)&Malloc32;
+ *lpMalloc = (LPMALLOC)(char*)&Malloc32;
return S_OK;
}
@@ -541,14 +541,14 @@
*/
LPVOID WINAPI CoTaskMemAlloc(ULONG size)
{
- return IMalloc_Alloc((LPMALLOC)&Malloc32,size);
+ return IMalloc_Alloc((LPMALLOC)(char*)&Malloc32,size);
}
/***********************************************************************
* CoTaskMemFree [OLE32.@]
*/
VOID WINAPI CoTaskMemFree(LPVOID ptr)
{
- IMalloc_Free((LPMALLOC)&Malloc32, ptr);
+ IMalloc_Free((LPMALLOC)(char*)&Malloc32, ptr);
}
/***********************************************************************
@@ -558,7 +558,7 @@
*/
LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size)
{
- return IMalloc_Realloc((LPMALLOC)&Malloc32, pvOld, size);
+ return IMalloc_Realloc((LPMALLOC)(char*)&Malloc32, pvOld, size);
}
/***********************************************************************
@@ -576,13 +576,13 @@
TRACE("\n");
/* HACK TO ACTIVATE OUT SPY */
- if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy;
+ if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)(char*)&MallocSpy;
if(Malloc32.pSpy) return CO_E_OBJISREG;
EnterCriticalSection(&IMalloc32_SpyCS);
- if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)&pSpy))) {
+ if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)(char*)&pSpy))) {
Malloc32.pSpy = pSpy;
hres = S_OK;
}
@@ -607,7 +607,7 @@
EnterCriticalSection(&IMalloc32_SpyCS);
/* if it's our spy it's time to dump the leaks */
- if (Malloc32.pSpy == (IMallocSpy*)&MallocSpy) {
+ if (Malloc32.pSpy == (IMallocSpy*)(char*)&MallocSpy) {
MallocSpyDumpLeaks();
}
Index: dlls/ole32/itemmoniker.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/itemmoniker.c,v
retrieving revision 1.23
diff -u -r1.23 itemmoniker.c
--- dlls/ole32/itemmoniker.c 23 Jan 2004 22:51:42 -0000 1.23
+++ dlls/ole32/itemmoniker.c 1 May 2004 13:02:13 -0000
@@ -454,7 +454,7 @@
*ppvResult=0;
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&refid,(void**)&poic);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&refid,(void**)(char*)&poic);
if (SUCCEEDED(res)){
@@ -487,7 +487,7 @@
if(pmkToLeft==NULL)
return E_INVALIDARG;
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
if (SUCCEEDED(res)){
@@ -715,7 +715,7 @@
/* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/
/* passing the string contained within this moniker. */
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
if (SUCCEEDED(res)){
@@ -876,11 +876,11 @@
/* Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an */
/* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */
/* name to IParseDisplayName::ParseDisplayName */
- res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
+ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
if (SUCCEEDED(res)){
- res=IOleItemContainer_GetObject(poic,This->itemName,BINDSPEED_MODERATE,pbc,&IID_IParseDisplayName,(void**)&ppdn);
+ res=IOleItemContainer_GetObject(poic,This->itemName,BINDSPEED_MODERATE,pbc,&IID_IParseDisplayName,(void**)(char*)&ppdn);
res=IMoniker_GetDisplayName(iface,pbc,NULL,&displayName);
Index: dlls/ole32/marshal.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/marshal.c,v
retrieving revision 1.13
diff -u -r1.13 marshal.c
--- dlls/ole32/marshal.c 30 Apr 2004 18:32:36 -0000 1.13
+++ dlls/ole32/marshal.c 1 May 2004 13:02:13 -0000
@@ -256,7 +256,7 @@
IPSFactoryBuffer *psfacbuf;
TRACE("(...,%s,...)\n",debugstr_guid(riid));
- IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)&pUnk);
+ IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)(char*)&pUnk);
mid.processid = GetCurrentProcessId();
mid.objectid = (DWORD)pUnk; /* FIXME */
IUnknown_Release(pUnk);
@@ -280,7 +280,7 @@
FIXME("Failed to create a stub for %s\n",debugstr_guid(riid));
return hres;
}
- IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)&pUnk);
+ IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)(char*)&pUnk);
MARSHAL_Register_Stub(&mid,pUnk,stub);
IUnknown_Release(pUnk);
return S_OK;
@@ -448,7 +448,7 @@
);
STUBMGR_Start(); /* Just to be sure we have one running. */
mid.processid = GetCurrentProcessId();
- IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)&pUnknown);
+ IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)(char*)&pUnknown);
mid.objectid = (DWORD)pUnknown;
IUnknown_Release(pUnknown);
memcpy(&mid.iid,riid,sizeof(mid.iid));
@@ -523,7 +523,7 @@
FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid));
return hres;
}
- hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)&pUnk);
+ hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)(char*)&pUnk);
if (hres) {
FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid));
return hres;
Index: dlls/ole32/moniker.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/moniker.c,v
retrieving revision 1.28
diff -u -r1.28 moniker.c
--- dlls/ole32/moniker.c 20 Feb 2004 20:19:23 -0000 1.28
+++ dlls/ole32/moniker.c 1 May 2004 13:02:13 -0000
@@ -505,7 +505,7 @@
ICOM_THIS(IRunnableObject,pUnknown);
LRESULT ret;
- ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable);
+ ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)(char*)&runable);
if (ret)
return 0; /* Appears to return no error. */
ret = IRunnableObject_Run(runable,NULL);
Index: dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.50
diff -u -r1.50 ole2.c
--- dlls/ole32/ole2.c 30 Mar 2004 05:13:58 -0000 1.50
+++ dlls/ole32/ole2.c 1 May 2004 13:02:15 -0000
@@ -710,7 +710,7 @@
hres = IUnknown_QueryInterface(pUnknown,
&IID_IRunnableObject,
- (void**)&runnable);
+ (void**)(char*)&runnable);
if (SUCCEEDED(hres))
{
@@ -756,7 +756,7 @@
NULL,
CLSCTX_INPROC_HANDLER,
&IID_IOleObject,
- (void**)&oleObject);
+ (void**)(char*)&oleObject);
/*
* If that fails, as it will most times, load the default
@@ -767,7 +767,7 @@
hres = OleCreateDefaultHandler(&storageInfo.clsid,
NULL,
&IID_IOleObject,
- (void**)&oleObject);
+ (void**)(char*)&oleObject);
}
/*
@@ -786,7 +786,7 @@
*/
hres = IOleObject_QueryInterface(oleObject,
&IID_IPersistStorage,
- (void**)&persistStorage);
+ (void**)(char*)&persistStorage);
if (SUCCEEDED(hres))
{
@@ -860,7 +860,7 @@
hres = IUnknown_QueryInterface(pUnknown,
&IID_IRunnableObject,
- (void**)&runnable);
+ (void**)(char*)&runnable);
if (SUCCEEDED(hres))
{
@@ -2229,7 +2229,7 @@
hres = IUnknown_QueryInterface(pUnk,
&IID_IViewObject,
- (void**)&viewobject);
+ (void**)(char*)&viewobject);
if (SUCCEEDED(hres))
{
@@ -2284,20 +2284,20 @@
FIXME("\n\t%s\n\t%s semi-stub!\n", debugstr_guid(rclsid), debugstr_guid(riid));
- if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)&pUnk))))
+ if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)(char*)&pUnk))))
{
if (pClientSite)
{
IOleObject * pOE;
IPersistStorage * pPS;
- if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)&pOE))))
+ if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)(char*)&pOE))))
{
TRACE("trying to set clientsite %p\n", pClientSite);
hres1 = IOleObject_SetClientSite(pOE, pClientSite);
TRACE("-- result 0x%08lx\n", hres1);
IOleObject_Release(pOE);
}
- if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
+ if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)(char*)&pPS))))
{
TRACE("trying to set stg %p\n", pStg);
hres1 = IPersistStorage_InitNew(pPS, pStg);
Index: dlls/ole32/ole2impl.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2impl.c,v
retrieving revision 1.9
diff -u -r1.9 ole2impl.c
--- dlls/ole32/ole2impl.c 11 Sep 2003 03:06:25 -0000 1.9
+++ dlls/ole32/ole2impl.c 1 May 2004 13:02:15 -0000
@@ -151,7 +151,7 @@
/* Create default handler for Persist storage */
if (hr1 == S_OK)
- hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)&pPersistStorage);
+ hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)(char*)&pPersistStorage);
/* Load the storage to Persist storage */
@@ -161,7 +161,7 @@
/* Query for IOleObject */
if (hr1 == S_OK)
- hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)&pOleObject);
+ hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)(char*)&pOleObject);
/* Set client site with the IOleObject */
Index: dlls/ole32/oleproxy.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/oleproxy.c,v
retrieving revision 1.13
diff -u -r1.13 oleproxy.c
--- dlls/ole32/oleproxy.c 23 Jan 2004 01:51:34 -0000 1.13
+++ dlls/ole32/oleproxy.c 1 May 2004 13:02:15 -0000
@@ -155,12 +155,12 @@
}
memcpy(&iid,msg->Buffer,sizeof(iid));
TRACE("->CreateInstance(%s)\n",debugstr_guid(&iid));
- hres = IUnknown_QueryInterface(This->pUnkServer,&IID_IClassFactory,(LPVOID*)&classfac);
+ hres = IUnknown_QueryInterface(This->pUnkServer,&IID_IClassFactory,(LPVOID*)(char*)&classfac);
if (hres) {
FIXME("Ole server does not provide a IClassFactory?\n");
return hres;
}
- hres = IClassFactory_CreateInstance(classfac,NULL,&iid,(LPVOID*)&ppv);
+ hres = IClassFactory_CreateInstance(classfac,NULL,&iid,(LPVOID*)(char*)&ppv);
IClassFactory_Release(classfac);
if (hres) {
msg->cbBuffer = 0;
Index: dlls/ole32/storage32.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.c,v
retrieving revision 1.50
diff -u -r1.50 storage32.c
--- dlls/ole32/storage32.c 30 Apr 2004 18:32:20 -0000 1.50
+++ dlls/ole32/storage32.c 1 May 2004 13:02:17 -0000
@@ -5898,7 +5898,7 @@
res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
if (!SUCCEEDED(res))
return res;
- res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)&xstm);
+ res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)(char*)&xstm);
if (!SUCCEEDED(res)) {
IUnknown_Release((IUnknown*)*ppvObj);
return res;
More information about the wine-patches
mailing list