gdi32: Don't cast the void pointer returned by GDI_GetObjPtr().

This commit is contained in:
Michael Stefaniuc 2008-10-23 23:51:07 +02:00 committed by Alexandre Julliard
parent 6a262ac74f
commit 2d94915f27
9 changed files with 35 additions and 36 deletions

View File

@ -325,7 +325,7 @@ LONG WINAPI GetBitmapBits(
LONG count, /* [in] Number of bytes to copy */
LPVOID bits) /* [out] Pointer to buffer to receive bits */
{
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
LONG height, ret;
if (!bmp) return 0;
@ -436,7 +436,7 @@ LONG WINAPI SetBitmapBits(
LONG count, /* [in] Number of bytes in bitmap array */
LPCVOID bits) /* [in] Address of array with bitmap bits */
{
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
LONG height, ret;
if ((!bmp) || (!bits))
@ -729,7 +729,7 @@ BOOL WINAPI GetBitmapDimensionEx(
HBITMAP hbitmap, /* [in] Handle to bitmap */
LPSIZE size) /* [out] Address of struct receiving dimensions */
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
*size = bmp->size;
GDI_ReleaseObj( hbitmap );
@ -754,7 +754,7 @@ BOOL WINAPI SetBitmapDimensionEx(
INT y, /* [in] Bitmap height */
LPSIZE prevSize) /* [out] Address of structure for orig dims */
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
if (prevSize) *prevSize = bmp->size;
bmp->size.cx = x;

View File

@ -461,7 +461,7 @@ BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor )
BOOL16 res = FALSE;
TRACE("(hBrush %04x, newColor %08x)\n", hBrush, newColor);
if (!(brushPtr = (BRUSHOBJ *) GDI_GetObjPtr( HBRUSH_32(hBrush), BRUSH_MAGIC )))
if (!(brushPtr = GDI_GetObjPtr( HBRUSH_32(hBrush), BRUSH_MAGIC )))
return FALSE;
if (brushPtr->logbrush.lbStyle == BS_SOLID)

View File

@ -235,7 +235,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
dwRop == SRCCOPY)
{
BITMAPOBJ *bmp;
if ((bmp = (BITMAPOBJ *)GDI_GetObjPtr( hBitmap, BITMAP_MAGIC )))
if ((bmp = GDI_GetObjPtr( hBitmap, BITMAP_MAGIC )))
{
if (bmp->bitmap.bmBitsPixel == bpp &&
bmp->bitmap.bmWidth == widthSrc &&
@ -609,7 +609,7 @@ INT WINAPI GetDIBits(
return 0;
}
update_dc( dc );
if (!(bmp = (BITMAPOBJ *)GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
if (!(bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
{
release_dc_ptr( dc );
return 0;
@ -1153,7 +1153,7 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us
hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset );
if (hbitmap)
{
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr(hbitmap, BITMAP_MAGIC);
BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, BITMAP_MAGIC);
if (bmp && bmp->dib && bits32)
{
const BITMAPINFOHEADER *bi = &bmi->bmiHeader;

View File

@ -278,8 +278,8 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
*/
static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
{
ENHMETAFILEOBJ *metaObj = (ENHMETAFILEOBJ *)GDI_GetObjPtr( hmf,
ENHMETAFILE_MAGIC );
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, ENHMETAFILE_MAGIC );
if(!metaObj) return FALSE;
if(metaObj->on_disk)
@ -297,7 +297,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
static ENHMETAHEADER *EMF_GetEnhMetaHeader( HENHMETAFILE hmf )
{
ENHMETAHEADER *ret = NULL;
ENHMETAFILEOBJ *metaObj = (ENHMETAFILEOBJ *)GDI_GetObjPtr( hmf, ENHMETAFILE_MAGIC );
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, ENHMETAFILE_MAGIC );
TRACE("hmf %p -> enhmetaObj %p\n", hmf, metaObj);
if (metaObj)
{

View File

@ -828,7 +828,7 @@ INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
if(dc->gdiFont)
ret = WineEngGetTextFace(dc->gdiFont, count, name);
else if ((font = (FONTOBJ *) GDI_GetObjPtr( dc->hFont, FONT_MAGIC )))
else if ((font = GDI_GetObjPtr( dc->hFont, FONT_MAGIC )))
{
INT n = strlenW(font->logfont.lfFaceName) + 1;
if (name)

View File

@ -126,7 +126,7 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
static METAHEADER *MF_GetMetaHeader( HMETAFILE hmf )
{
METAHEADER *ret = NULL;
METAFILEOBJ * metaObj = (METAFILEOBJ *)GDI_GetObjPtr( hmf, METAFILE_MAGIC );
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, METAFILE_MAGIC );
if (metaObj)
{
ret = metaObj->mh;
@ -164,7 +164,7 @@ static POINT *convert_points( UINT count, POINT16 *pt16 )
BOOL WINAPI DeleteMetaFile( HMETAFILE hmf )
{
METAFILEOBJ * metaObj = (METAFILEOBJ *)GDI_GetObjPtr( hmf, METAFILE_MAGIC );
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, METAFILE_MAGIC );
if (!metaObj) return FALSE;
HeapFree( GetProcessHeap(), 0, metaObj->mh );
GDI_FreeObject( hmf, metaObj );

View File

@ -278,7 +278,7 @@ UINT WINAPI GetPaletteEntries(
TRACE("hpal = %p, count=%i\n", hpalette, count );
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (!palPtr) return 0;
/* NOTE: not documented but test show this to be the case */
@ -328,7 +328,7 @@ UINT WINAPI SetPaletteEntries(
TRACE("hpal=%p,start=%i,count=%i\n",hpalette,start,count );
if (hpalette == GetStockObject(DEFAULT_PALETTE)) return 0;
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (!palPtr) return 0;
numEntries = palPtr->logpalette.palNumEntries;
@ -359,7 +359,7 @@ BOOL WINAPI ResizePalette(
HPALETTE hPal, /* [in] Handle of logical palette */
UINT cEntries) /* [in] Number of entries in logical palette */
{
PALETTEOBJ * palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, PALETTE_MAGIC );
UINT cPrevEnt, prevVer;
int prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY);
@ -410,7 +410,7 @@ BOOL WINAPI AnimatePalette(
UINT pal_entries;
const PALETTEENTRY *pptr = PaletteColors;
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hPal, PALETTE_MAGIC );
if (!palPtr) return 0;
pal_entries = palPtr->logpalette.palNumEntries;
@ -537,7 +537,7 @@ UINT WINAPI GetNearestPaletteIndex(
HPALETTE hpalette, /* [in] Handle of logical color palette */
COLORREF color) /* [in] Color to be matched */
{
PALETTEOBJ* palObj = (PALETTEOBJ*)GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
UINT index = 0;
if( palObj )

View File

@ -603,7 +603,7 @@ static void REGION_OffsetRegion( WINEREGION *rgn, WINEREGION *srcrgn,
*/
INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
{
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ * obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
INT ret;
TRACE("%p %d,%d\n", hrgn, x, y);
@ -638,7 +638,7 @@ INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
*/
INT WINAPI GetRgnBox( HRGN hrgn, LPRECT rect )
{
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ * obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (obj)
{
INT ret;
@ -729,7 +729,7 @@ BOOL WINAPI SetRectRgn( HRGN hrgn, INT left, INT top,
TRACE("%p %d,%d-%d,%d\n", hrgn, left, top, right, bottom );
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
if (!(obj = GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
if (left > right) { INT tmp = left; left = right; right = tmp; }
if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; }
@ -953,7 +953,7 @@ HRGN WINAPI CreateEllipticRgnIndirect( const RECT *rect )
DWORD WINAPI GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata)
{
DWORD size;
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ *obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
TRACE(" %p count = %d, rgndata = %p\n", hrgn, count, rgndata);
@ -1067,7 +1067,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
if( (hrgn = REGION_CreateRegion( rgndata->rdh.nCount )) )
{
RECT *pCurRect, *pEndRect;
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ *obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (obj) {
pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
@ -1106,7 +1106,7 @@ BOOL WINAPI PtInRegion( HRGN hrgn, INT x, INT y )
RGNOBJ * obj;
BOOL ret = FALSE;
if ((obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC )))
if ((obj = GDI_GetObjPtr( hrgn, REGION_MAGIC )))
{
int i;
@ -1141,7 +1141,7 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
RGNOBJ * obj;
BOOL ret = FALSE;
if ((obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC )))
if ((obj = GDI_GetObjPtr( hrgn, REGION_MAGIC )))
{
RECT *pCurRect, *pRectEnd;
@ -1191,9 +1191,9 @@ BOOL WINAPI EqualRgn( HRGN hrgn1, HRGN hrgn2 )
RGNOBJ *obj1, *obj2;
BOOL ret = FALSE;
if ((obj1 = (RGNOBJ *) GDI_GetObjPtr( hrgn1, REGION_MAGIC )))
if ((obj1 = GDI_GetObjPtr( hrgn1, REGION_MAGIC )))
{
if ((obj2 = (RGNOBJ *) GDI_GetObjPtr( hrgn2, REGION_MAGIC )))
if ((obj2 = GDI_GetObjPtr( hrgn2, REGION_MAGIC )))
{
int i;
@ -1251,12 +1251,12 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
{
BOOL bRet;
RGNOBJ *srcObj = (RGNOBJ*) GDI_GetObjPtr( hSrc, REGION_MAGIC );
RGNOBJ *srcObj = GDI_GetObjPtr( hSrc, REGION_MAGIC );
if (!srcObj) return FALSE;
if (srcObj->rgn->numRects != 0)
{
RGNOBJ* destObj = (RGNOBJ*) GDI_GetObjPtr( hDest, REGION_MAGIC );
RGNOBJ* destObj = GDI_GetObjPtr( hDest, REGION_MAGIC );
WINEREGION *tmprgn = REGION_AllocWineRegion( srcObj->rgn->numRects);
REGION_OffsetRegion( destObj->rgn, srcObj->rgn, -x, 0);
@ -1309,13 +1309,13 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
*/
INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
{
RGNOBJ *destObj = (RGNOBJ *) GDI_GetObjPtr( hDest, REGION_MAGIC);
RGNOBJ *destObj = GDI_GetObjPtr( hDest, REGION_MAGIC);
INT result = ERROR;
TRACE(" %p,%p -> %p mode=%x\n", hSrc1, hSrc2, hDest, mode );
if (destObj)
{
RGNOBJ *src1Obj = (RGNOBJ *) GDI_GetObjPtr( hSrc1, REGION_MAGIC);
RGNOBJ *src1Obj = GDI_GetObjPtr( hSrc1, REGION_MAGIC);
if (src1Obj)
{
@ -1329,7 +1329,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
}
else
{
RGNOBJ *src2Obj = (RGNOBJ *) GDI_GetObjPtr( hSrc2, REGION_MAGIC);
RGNOBJ *src2Obj = GDI_GetObjPtr( hSrc2, REGION_MAGIC);
if (src2Obj)
{
@ -2790,7 +2790,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
if(!(hrgn = REGION_CreateRegion(nbpolygons)))
return 0;
obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
region = obj->rgn;
/* special case a rectangle */

View File

@ -144,8 +144,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
*/
SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
{
BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( HBITMAP_32(hWinGBitmap),
BITMAP_MAGIC );
BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), BITMAP_MAGIC );
SEGPTR res = 0;
TRACE("(%d,%p)\n", hWinGBitmap, bmpi);