diff --git a/configure b/configure index 36798bc171eb184edbc6060b2a19d55c589b0707..c2b9fd4aba24a36fae4ace495b53e6fa70131aea 100755 --- a/configure +++ b/configure @@ -10668,7 +10668,7 @@ fi if test "x${GCC}" = "xyes" then - CFLAGS="$CFLAGS -Wall" + CFLAGS="$CFLAGS -Wall -Wpointer-arith" echo "$as_me:$LINENO: checking for gcc strength-reduce bug" >&5 echo $ECHO_N "checking for gcc strength-reduce bug... $ECHO_C" >&6 if test "${ac_cv_c_gcc_strength_bug+set}" = set; then diff --git a/configure.ac b/configure.ac index 30b170002fee6d5d00bf9cdf325804f2f11b7bf7..f2d1b8365027c21600e0dd9912a78616c9e9b1c1 100644 --- a/configure.ac +++ b/configure.ac @@ -638,7 +638,7 @@ dnl **** Check for gcc strength-reduce bug **** if test "x${GCC}" = "xyes" then - CFLAGS="$CFLAGS -Wall" + CFLAGS="$CFLAGS -Wall -Wpointer-arith" AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug, AC_TRY_RUN([ int L[[4]] = {0,1,2,3}; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index e7c70d019b7d2715676406ecce397e7b1454b373..14f8d490958d1ce0b1ea200b1080c3a969380c22 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -143,10 +143,10 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, BOOL isLastUByte4; int numTextures; int textureNo; - const void *curVtx = NULL; + const char *curVtx = NULL; const short *pIdxBufS = NULL; const long *pIdxBufL = NULL; - const void *curPos; + const char *curPos; BOOL isLightingOn = FALSE; BOOL enableTexture = FALSE; int vx_index; @@ -286,7 +286,7 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, glBegin(primType); /* Draw the primitives */ - curVtx = vertexBufData + (StartVertexIndex * skip); + curVtx = (const char *)vertexBufData + (StartVertexIndex * skip); for (vx_index = 0; vx_index < NumVertexes; vx_index++) { @@ -580,7 +580,7 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, /* Faster version, harder to debug */ /* Shuffle to the beginning of the vertexes to render and index from there */ - curVtx = vertexBufData + (StartVertexIndex * skip); + curVtx = (const char *)vertexBufData + (StartVertexIndex * skip); curPos = curVtx; /* Set up the vertex pointers */ @@ -727,17 +727,19 @@ void DrawPrimitiveI(LPDIRECT3DDEVICE8 iface, TRACE("glElements(%x, %d, %d, ...)\n", primType, NumVertexes, minIndex); if (idxBytes==2) { #if 1 /* FIXME: Want to use DrawRangeElements, but wrong calculation! */ - glDrawElements(primType, NumVertexes, GL_UNSIGNED_SHORT, idxData+(2 * StartIdx)); + glDrawElements(primType, NumVertexes, GL_UNSIGNED_SHORT, + (char *)idxData+(2 * StartIdx)); #else glDrawRangeElements(primType, minIndex, minIndex+NumVertexes-1, NumVertexes, - GL_UNSIGNED_SHORT, idxData+(2 * StartIdx)); + GL_UNSIGNED_SHORT, (char *)idxData+(2 * StartIdx)); #endif } else { #if 1 /* FIXME: Want to use DrawRangeElements, but wrong calculation! */ - glDrawElements(primType, NumVertexes, GL_UNSIGNED_INT, idxData+(4 * StartIdx)); + glDrawElements(primType, NumVertexes, GL_UNSIGNED_INT, + (char *)idxData+(4 * StartIdx)); #else glDrawRangeElements(primType, minIndex, minIndex+NumVertexes-1, NumVertexes, - GL_UNSIGNED_INT, idxData+(2 * StartIdx)); + GL_UNSIGNED_INT, (char *)idxData+(2 * StartIdx)); #endif } checkGLcall("glDrawRangeElements"); @@ -1436,15 +1438,15 @@ HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, IDirect int pitchFrom = ((IDirect3DSurface8Impl *)pSourceSurface)->myDesc.Width * bytesPerPixel; int pitchTo = ((IDirect3DSurface8Impl *)pDestinationSurface)->myDesc.Width * bytesPerPixel; - void *copyfrom = ((IDirect3DSurface8Impl *)pSourceSurface)->allocatedMemory; - void *copyto = ((IDirect3DSurface8Impl *)pDestinationSurface)->allocatedMemory; + char *copyfrom = ((IDirect3DSurface8Impl *)pSourceSurface)->allocatedMemory; + char *copyto = ((IDirect3DSurface8Impl *)pDestinationSurface)->allocatedMemory; /* Copy rect by rect */ for (i=0; i<cRects; i++) { CONST RECT *r = &pSourceRectsArray[i]; CONST POINT *p = &pDestPointsArray[i]; - void *from; - void *to; + char *from; + char *to; int copyperline = (r->right - r->left) * bytesPerPixel; int j; diff --git a/dlls/d3d8/indexbuffer.c b/dlls/d3d8/indexbuffer.c index 7a0244b79fc36f6a47f4e99b26ffbf8e61a26771..cba7ae7f9e544b21f22d36ff93c96a0c83bd8575 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -107,7 +107,7 @@ HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 ifa } else { FIXME("(%p) : stub, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags); } - *ppbData = This->allocatedMemory + OffsetToLock; + *ppbData = (BYTE *)This->allocatedMemory + OffsetToLock; return D3D_OK; } diff --git a/dlls/d3d8/shader.c b/dlls/d3d8/shader.c index f62b4c7e1dfaa451d425d0175d86b58aa648beb9..36fe0839c2958c3628f191fbd67489a838da9b50 100644 --- a/dlls/d3d8/shader.c +++ b/dlls/d3d8/shader.c @@ -957,7 +957,7 @@ void vshader_fill_input(VERTEXSHADER8* vshader, /*DWORD tokenlen;*/ DWORD tokentype; /** for input readers */ - const void* curPos = NULL; + const char* curPos = NULL; FLOAT x, y, z, w; SHORT u, v, r, t; DWORD dw; @@ -970,7 +970,7 @@ void vshader_fill_input(VERTEXSHADER8* vshader, /** FVF generation block */ if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) { IDirect3DVertexBuffer8* pVB; - const void* startVtx = NULL; + const char* startVtx = NULL; int skip = 0; ++pToken; @@ -982,7 +982,7 @@ void vshader_fill_input(VERTEXSHADER8* vshader, if (0 == stream) { skip = device->StateBlock.stream_stride[0]; - startVtx = vertexFirstStream + (StartVertexIndex * skip); + startVtx = (const char *)vertexFirstStream + (StartVertexIndex * skip); curPos = startVtx + idxDecal; /*TRACE(" using stream[%lu] with %lu decal => curPos %p\n", stream, idxDecal, curPos);*/ } else { diff --git a/dlls/ddraw/d3dexecutebuffer.c b/dlls/ddraw/d3dexecutebuffer.c index 656857a39f2c81c2fbcde70b5fab792e56f898a1..53ff2f27fac419e97e6d608f7b06aacdb3094cd3 100644 --- a/dlls/ddraw/d3dexecutebuffer.c +++ b/dlls/ddraw/d3dexecutebuffer.c @@ -192,8 +192,8 @@ static void execute(IDirect3DExecuteBufferImpl *This, /* DWORD vc = This->data.dwVertexCount; */ DWORD is = This->data.dwInstructionOffset; /* DWORD il = This->data.dwInstructionLength; */ - - void *instr = This->desc.lpData + is; + + char *instr = (char *)This->desc.lpData + is; /* Should check if the viewport was added or not to the device */ @@ -504,7 +504,7 @@ static void execute(IDirect3DExecuteBufferImpl *This, /* Enough for the moment */ if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) { int nb; - D3DVERTEX *src = ((LPD3DVERTEX) (This->desc.lpData + vs)) + ci->wStart; + D3DVERTEX *src = ((LPD3DVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; OGL_Vertex *dst = ((OGL_Vertex *) (This->vertex_data)) + ci->wDest; D3DMATRIX *mat = lpDevice->world_mat; @@ -533,7 +533,7 @@ static void execute(IDirect3DExecuteBufferImpl *This, } } else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) { int nb; - D3DLVERTEX *src = ((LPD3DLVERTEX) (This->desc.lpData + vs)) + ci->wStart; + D3DLVERTEX *src = ((LPD3DLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; OGL_LVertex *dst = ((OGL_LVertex *) (This->vertex_data)) + ci->wDest; D3DMATRIX *mat = lpDevice->world_mat; @@ -558,7 +558,7 @@ static void execute(IDirect3DExecuteBufferImpl *This, dst++; } } else if (ci->dwFlags == D3DPROCESSVERTICES_COPY) { - D3DTLVERTEX *src = ((LPD3DTLVERTEX) (This->desc.lpData + vs)) + ci->wStart; + D3DTLVERTEX *src = ((LPD3DTLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; This->vertex_type = D3DVT_TLVERTEX; diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c index 65e7cc9952f71c6e6ed85dfb35f8339c0623a2dd..6865b1d0cc2e2c60eda0c8ad49f9f87adbc25fbc 100644 --- a/dlls/gdi/freetype.c +++ b/dlls/gdi/freetype.c @@ -1597,7 +1597,7 @@ DWORD WineEngGetGlyphOutline(GdiFont font, UINT glyph, UINT format, for(contour = 0; contour < outline->n_contours; contour++) { pph_start = needed; - pph = buf + needed; + pph = (TTPOLYGONHEADER *)((char *)buf + needed); first_pt = point; if(buf) { pph->dwType = TT_POLYGON_TYPE; @@ -1606,7 +1606,7 @@ DWORD WineEngGetGlyphOutline(GdiFont font, UINT glyph, UINT format, needed += sizeof(*pph); point++; while(point <= outline->contours[contour]) { - ppc = buf + needed; + ppc = (TTPOLYCURVE *)((char *)buf + needed); type = (outline->tags[point] & FT_Curve_Tag_On) ? TT_PRIM_LINE : TT_PRIM_QSPLINE; cpfx = 0; @@ -1673,7 +1673,7 @@ DWORD WineEngGetGlyphOutline(GdiFont font, UINT glyph, UINT format, for(contour = 0; contour < outline->n_contours; contour++) { pph_start = needed; - pph = buf + needed; + pph = (TTPOLYGONHEADER *)((char *)buf + needed); first_pt = point; if(buf) { pph->dwType = TT_POLYGON_TYPE; @@ -1682,7 +1682,7 @@ DWORD WineEngGetGlyphOutline(GdiFont font, UINT glyph, UINT format, needed += sizeof(*pph); point++; while(point <= outline->contours[contour]) { - ppc = buf + needed; + ppc = (TTPOLYCURVE *)((char *)buf + needed); type = (outline->tags[point] & FT_Curve_Tag_On) ? TT_PRIM_LINE : TT_PRIM_CSPLINE; cpfx = 0; diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index 3b73a6d502721db0120f2b61ca0e1d9958214678..aad20d6dc7f78b029f4dc8d43fdf5705947ec065 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -1172,7 +1172,7 @@ static DWORD CDROM_ScsiPassThrough(int dev, PSCSI_PASS_THROUGH pPacket) } else { - cmd.buffer = ((void*)pPacket) + pPacket->DataBufferOffset; + cmd.buffer = (char*)pPacket + pPacket->DataBufferOffset; } cmd.buflen = pPacket->DataTransferLength; cmd.sense = &sense; diff --git a/dlls/oleaut32/safearray.c b/dlls/oleaut32/safearray.c index 5805de9da801e4f19094cc971e9bb6515d411f47..ef4e035ed08d34862206464887b0bb06ce9d33c2 100644 --- a/dlls/oleaut32/safearray.c +++ b/dlls/oleaut32/safearray.c @@ -165,7 +165,7 @@ HRESULT WINAPI SafeArrayAllocDescriptor( { SAFEARRAYBOUND *sab; LONG allocSize = 0; - LPVOID ptr; + char *ptr; if (!cDims || cDims >= 0x10000) /* 65536 appears to be the limit */ return E_INVALIDARG; @@ -181,7 +181,7 @@ HRESULT WINAPI SafeArrayAllocDescriptor( ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, allocSize); if (!ptr) return E_OUTOFMEMORY; - *ppsaOut = ptr+sizeof(GUID); + *ppsaOut = (SAFEARRAY *)(ptr + sizeof(GUID)); (*ppsaOut)->cDims = cDims; TRACE("(%d): %lu bytes allocated for descriptor.\n", cDims, allocSize); diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c index 42fe308ee9d73196a65662ce4e0c7676aa16a11e..c655bfed26c90bcef5e0383b78f1c9c2774fc162 100644 --- a/dlls/winedos/vga.c +++ b/dlls/winedos/vga.c @@ -76,7 +76,7 @@ static int vga_fb_depth; static int vga_fb_pitch; static int vga_fb_offset; static int vga_fb_size = 0; -static void *vga_fb_data = 0; +static char *vga_fb_data = 0; static int vga_fb_window = 0; /* diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index 333e9d1c9256db7ba8b278c44eec6a51bb459b0b..05e7f0164c6943d05531a137dd93f8932a80007a 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c @@ -290,21 +290,21 @@ LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags, DWORD* dwCallback, DWORD* dwInstance, BOOL bFrom32) { LPWINE_MLD mld; + UINT i; mld = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); if (!mld) return NULL; /* find an empty slot in MM_MLDrvs table */ - for (*hndl = 0; (DWORD)*hndl < MAX_MM_MLDRVS; (*hndl)++) { - if (!MM_MLDrvs[(UINT)*hndl]) break; - } - if ((DWORD)*hndl == MAX_MM_MLDRVS) { + for (i = 0; i < MAX_MM_MLDRVS; i++) if (!MM_MLDrvs[i]) break; + + if (i == MAX_MM_MLDRVS) { /* the MM_MLDrvs table could be made growable in the future if needed */ ERR("Too many open drivers\n"); return NULL; } - MM_MLDrvs[(UINT)*hndl] = mld; - *hndl = (HANDLE)((UINT)*hndl | 0x8000); + MM_MLDrvs[i] = mld; + *hndl = (HANDLE)(i | 0x8000); mld->type = type; if ((UINT)*hndl < MMDRV_GetNum(type) || HIWORD(*hndl) != 0) { diff --git a/dlls/winmm/wineoss/audio.c b/dlls/winmm/wineoss/audio.c index 675101d5e2036d6903aafca488f6c7aa5feb3b61..ab24acfdd1d0f84b52bdeb141c09e2000e98c9ac 100644 --- a/dlls/winmm/wineoss/audio.c +++ b/dlls/winmm/wineoss/audio.c @@ -2257,7 +2257,7 @@ static DWORD CALLBACK widRecorder(LPVOID pmt) DWORD dwSleepTime; DWORD bytesRead; LPVOID buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, wwi->dwFragmentSize); - LPVOID pOffset = buffer; + char *pOffset = buffer; audio_buf_info info; int xs; enum win_wm_message msg; diff --git a/dlls/x11drv/clipboard.c b/dlls/x11drv/clipboard.c index f92397c51591a404a87e034498c2492cb5b59695..eea0cde4d1ece4625f245deca8ddecaa5a7bb9e9 100644 --- a/dlls/x11drv/clipboard.c +++ b/dlls/x11drv/clipboard.c @@ -1363,10 +1363,10 @@ HANDLE X11DRV_CLIPBOARD_SerializeMetafile(INT wformat, HANDLE hdata, INT cbytes, h = GlobalAlloc(0, size + sizeof(METAFILEPICT)); if (h) { - LPVOID pdata = GlobalLock(h); + METAFILEPICT *pdata = GlobalLock(h); memcpy(pdata, lpmfp, sizeof(METAFILEPICT)); - GetMetaFileBitsEx(lpmfp->hMF, size, pdata + sizeof(METAFILEPICT)); + GetMetaFileBitsEx(lpmfp->hMF, size, pdata + 1); GlobalUnlock(h); } @@ -1397,7 +1397,7 @@ HANDLE X11DRV_CLIPBOARD_SerializeMetafile(INT wformat, HANDLE hdata, INT cbytes, memcpy(pmfp, (LPVOID)hdata, sizeof(METAFILEPICT)); pmfp->hMF = SetMetaFileBitsEx(cbytes - sizeof(METAFILEPICT), - (LPVOID)hdata + sizeof(METAFILEPICT)); + (char *)hdata + sizeof(METAFILEPICT)); GlobalUnlock(h); } diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 4fed93726065466a1e1603fc63171e66d2139300..8609680d73097acc58b66fb2bf2e614169add0be 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -122,20 +122,22 @@ static inline unsigned char hex_to0(int x) static void hex_from(void* dst, const char* src, size_t len) { + unsigned char *p = dst; while (len--) { - *(unsigned char*)dst++ = (hex_from0(src[0]) << 4) | hex_from0(src[1]); + *p++ = (hex_from0(src[0]) << 4) | hex_from0(src[1]); src += 2; } } static void hex_to(char* dst, const void* src, size_t len) { + const unsigned char *p = src; while (len--) { - *dst++ = hex_to0(*(const unsigned char*)src >> 4); - *dst++ = hex_to0(*(const unsigned char*)src & 0x0F); - src++; + *dst++ = hex_to0(*p >> 4); + *dst++ = hex_to0(*p & 0x0F); + p++; } }