Commit 132b464d authored by Adam Jackson's avatar Adam Jackson 🎧

Remove a bunch of useless casts.

We've had void * for twenty years now people let's try to act like we
know how it works.
parent 0fb43905
...@@ -203,7 +203,7 @@ MultibufferExtensionInit() ...@@ -203,7 +203,7 @@ MultibufferExtensionInit()
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
pScreen = screenInfo.screens[i]; pScreen = screenInfo.screens[i];
if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) if (!(pMultibufferScreen = xalloc (sizeof (MultibufferScreenRec))))
{ {
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey)); xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey));
...@@ -348,8 +348,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint) ...@@ -348,8 +348,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
xRectangle clearRect; xRectangle clearRect;
DestroyImageBuffers(pWin); DestroyImageBuffers(pWin);
pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) + pMultibuffers = xalloc (sizeof (MultibuffersRec) + nbuf * sizeof (MultibufferRec));
nbuf * sizeof (MultibufferRec));
if (!pMultibuffers) if (!pMultibuffers)
return BadAlloc; return BadAlloc;
pMultibuffers->pWindow = pWin; pMultibuffers->pWindow = pWin;
...@@ -504,8 +503,8 @@ ProcDisplayImageBuffers (client) ...@@ -504,8 +503,8 @@ ProcDisplayImageBuffers (client)
return Success; return Success;
minDelay = stuff->minDelay; minDelay = stuff->minDelay;
ids = (XID *) &stuff[1]; ids = (XID *) &stuff[1];
ppMultibuffers = (MultibuffersPtr *) xalloc(nbuf * sizeof (MultibuffersPtr)); ppMultibuffers = xalloc(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) xalloc(nbuf * sizeof (MultibufferPtr)); pMultibuffer = xalloc(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer) if (!ppMultibuffers || !pMultibuffer)
{ {
if (ppMultibuffers) xfree(ppMultibuffers); if (ppMultibuffers) xfree(ppMultibuffers);
...@@ -645,7 +644,7 @@ ProcGetMBufferAttributes (client) ...@@ -645,7 +644,7 @@ ProcGetMBufferAttributes (client)
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers) if (!pMultibuffers)
return BadAccess; return BadAccess;
ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID)); ids = xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
if (!ids) if (!ids)
return BadAlloc; return BadAlloc;
for (i = 0; i < pMultibuffers->numMultibuffer; i++) for (i = 0; i < pMultibuffers->numMultibuffer; i++)
...@@ -782,8 +781,7 @@ ProcGetBufferInfo (client) ...@@ -782,8 +781,7 @@ ProcGetBufferInfo (client)
pDepth = &pScreen->allowedDepths[i]; pDepth = &pScreen->allowedDepths[i];
nInfo += pDepth->numVids; nInfo += pDepth->numVids;
} }
pInfo = (xMbufBufferInfo *) pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo) if (!pInfo)
return BadAlloc; return BadAlloc;
...@@ -1264,7 +1262,7 @@ DisplayImageBuffers (ids, nbuf) ...@@ -1264,7 +1262,7 @@ DisplayImageBuffers (ids, nbuf)
MultibuffersPtr *pMultibuffers; MultibuffersPtr *pMultibuffers;
int i, j; int i, j;
pMultibuffer = (MultibufferPtr *) xalloc (nbuf * sizeof *pMultibuffer + pMultibuffer = xalloc (nbuf * sizeof *pMultibuffer +
nbuf * sizeof *pMultibuffers); nbuf * sizeof *pMultibuffers);
if (!pMultibuffer) if (!pMultibuffer)
return BadAlloc; return BadAlloc;
...@@ -1390,7 +1388,7 @@ MultibufferExpose (pMultibuffer, pRegion) ...@@ -1390,7 +1388,7 @@ MultibufferExpose (pMultibuffer, pRegion)
numRects = REGION_NUM_RECTS(pRegion); numRects = REGION_NUM_RECTS(pRegion);
pBox = REGION_RECTS(pRegion); pBox = REGION_RECTS(pRegion);
pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent)); pEvent = xalloc(numRects * sizeof(xEvent));
if (pEvent) { if (pEvent) {
pe = pEvent; pe = pEvent;
...@@ -1744,7 +1742,7 @@ EventSelectForMultibuffer (pMultibuffer, client, mask) ...@@ -1744,7 +1742,7 @@ EventSelectForMultibuffer (pMultibuffer, client, mask)
} }
if (!other) if (!other)
{ /* new client that never selected events on this buffer before */ { /* new client that never selected events on this buffer before */
other = (OtherClients *) xalloc (sizeof (OtherClients)); other = xalloc (sizeof (OtherClients));
if (!other) if (!other)
return BadAlloc; return BadAlloc;
other->mask = mask; other->mask = mask;
......
...@@ -221,7 +221,7 @@ bufMultibufferInit(pScreen, pMBScreen) ...@@ -221,7 +221,7 @@ bufMultibufferInit(pScreen, pMBScreen)
pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs; pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
pMBScreen->ResetProc = bufResetProc; pMBScreen->ResetProc = bufResetProc;
/* Create devPrivate part */ /* Create devPrivate part */
pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv); pMBPriv = xalloc(sizeof *pMBPriv);
if (!pMBPriv) if (!pMBPriv)
return (FALSE); return (FALSE);
...@@ -611,8 +611,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) ...@@ -611,8 +611,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
if (!pGC) if (!pGC)
return; return;
prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) * prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
sizeof(xRectangle));
if (!prect) if (!prect)
{ {
FreeScratchGC(pGC); FreeScratchGC(pGC);
......
...@@ -90,7 +90,7 @@ pixMultibufferInit(pScreen, pMBScreen) ...@@ -90,7 +90,7 @@ pixMultibufferInit(pScreen, pMBScreen)
nInfo += pDepth->numVids; nInfo += pDepth->numVids;
} }
pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo)); pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo) if (!pInfo)
return FALSE; return FALSE;
...@@ -114,7 +114,7 @@ pixMultibufferInit(pScreen, pMBScreen) ...@@ -114,7 +114,7 @@ pixMultibufferInit(pScreen, pMBScreen)
* Setup the devPrivate to mbufScreenRec * Setup the devPrivate to mbufScreenRec
*/ */
pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv)); pMBPriv = xalloc(sizeof(* pMBPriv));
if (!pMBPriv) if (!pMBPriv)
{ {
xfree(pInfo); xfree(pInfo);
...@@ -261,7 +261,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion) ...@@ -261,7 +261,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
int nrects = REGION_NUM_RECTS(pRegion); int nrects = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion);
pRects = (xRectangle *)xalloc(nrects * sizeof(xRectangle)); pRects = xalloc(nrects * sizeof(xRectangle));
if (pRects) if (pRects)
{ {
int i; int i;
......
...@@ -116,7 +116,7 @@ int PanoramiXCreateWindow(ClientPtr client) ...@@ -116,7 +116,7 @@ int PanoramiXCreateWindow(ClientPtr client)
} }
} }
if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newWin = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newWin->type = XRT_WINDOW; newWin->type = XRT_WINDOW;
...@@ -644,7 +644,7 @@ int PanoramiXCreatePixmap(ClientPtr client) ...@@ -644,7 +644,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable; return BadDrawable;
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newPix = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newPix->type = XRT_PIXMAP; newPix->type = XRT_PIXMAP;
...@@ -744,7 +744,7 @@ int PanoramiXCreateGC(ClientPtr client) ...@@ -744,7 +744,7 @@ int PanoramiXCreateGC(ClientPtr client)
} }
} }
if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newGC = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newGC->type = XRT_GC; newGC->type = XRT_GC;
...@@ -1256,7 +1256,7 @@ int PanoramiXPolyPoint(ClientPtr client) ...@@ -1256,7 +1256,7 @@ int PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) { if (npoint > 0) {
origPts = (xPoint *) xalloc(npoint * sizeof(xPoint)); origPts = xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1314,7 +1314,7 @@ int PanoramiXPolyLine(ClientPtr client) ...@@ -1314,7 +1314,7 @@ int PanoramiXPolyLine(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){ if (npoint > 0){
origPts = (xPoint *) xalloc(npoint * sizeof(xPoint)); origPts = xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1375,7 +1375,7 @@ int PanoramiXPolySegment(ClientPtr client) ...@@ -1375,7 +1375,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(nsegs & 4) return BadLength; if(nsegs & 4) return BadLength;
nsegs >>= 3; nsegs >>= 3;
if (nsegs > 0) { if (nsegs > 0) {
origSegs = (xSegment *) xalloc(nsegs * sizeof(xSegment)); origSegs = xalloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1437,7 +1437,7 @@ int PanoramiXPolyRectangle(ClientPtr client) ...@@ -1437,7 +1437,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(nrects & 4) return BadLength; if(nrects & 4) return BadLength;
nrects >>= 3; nrects >>= 3;
if (nrects > 0){ if (nrects > 0){
origRecs = (xRectangle *) xalloc(nrects * sizeof(xRectangle)); origRecs = xalloc(nrects * sizeof(xRectangle));
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle)); memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1497,7 +1497,7 @@ int PanoramiXPolyArc(ClientPtr client) ...@@ -1497,7 +1497,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(narcs % sizeof(xArc)) return BadLength; if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc); narcs /= sizeof(xArc);
if (narcs > 0){ if (narcs > 0){
origArcs = (xArc *) xalloc(narcs * sizeof(xArc)); origArcs = xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1553,7 +1553,7 @@ int PanoramiXFillPoly(ClientPtr client) ...@@ -1553,7 +1553,7 @@ int PanoramiXFillPoly(ClientPtr client)
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){ if (count > 0){
locPts = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec)); locPts = xalloc(count * sizeof(DDXPointRec));
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec)); memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1614,7 +1614,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) ...@@ -1614,7 +1614,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(things & 4) return BadLength; if(things & 4) return BadLength;
things >>= 3; things >>= 3;
if (things > 0){ if (things > 0){
origRects = (xRectangle *) xalloc(things * sizeof(xRectangle)); origRects = xalloc(things * sizeof(xRectangle));
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle)); memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -1673,7 +1673,7 @@ int PanoramiXPolyFillArc(ClientPtr client) ...@@ -1673,7 +1673,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
IF_RETURN((narcs % sizeof(xArc)), BadLength); IF_RETURN((narcs % sizeof(xArc)), BadLength);
narcs /= sizeof(xArc); narcs /= sizeof(xArc);
if (narcs > 0) { if (narcs > 0) {
origArcs = (xArc *) xalloc(narcs * sizeof(xArc)); origArcs = xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
...@@ -2071,7 +2071,7 @@ int PanoramiXCreateColormap(ClientPtr client) ...@@ -2071,7 +2071,7 @@ int PanoramiXCreateColormap(ClientPtr client)
client, stuff->window, XRT_WINDOW, DixReadAccess))) client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow; return BadWindow;
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newCmap->type = XRT_COLORMAP; newCmap->type = XRT_COLORMAP;
...@@ -2140,7 +2140,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) ...@@ -2140,7 +2140,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
DixReadAccess | DixWriteAccess))) DixReadAccess | DixWriteAccess)))
return BadColor; return BadColor;
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newCmap->type = XRT_COLORMAP; newCmap->type = XRT_COLORMAP;
......
...@@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex; ...@@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v); dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL) #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) ((t *) xalloc (sizeof (t))) #define New(t) (xalloc (sizeof (t)))
/**************** /****************
* ScreenSaverExtensionInit * ScreenSaverExtensionInit
...@@ -639,8 +639,7 @@ CreateSaverWindow (ScreenPtr pScreen) ...@@ -639,8 +639,7 @@ CreateSaverWindow (ScreenPtr pScreen)
wantMap = wColormap (pWin); wantMap = wColormap (pWin);
if (wantMap == None) if (wantMap == None)
return TRUE; return TRUE;
installedMaps = (Colormap *) xalloc (pScreen->maxInstalledCmaps * installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap));
sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps); (pScreen, installedMaps);
for (i = 0; i < numInstalled; i++) for (i = 0; i < numInstalled; i++)
...@@ -977,7 +976,7 @@ ScreenSaverSetAttributes (ClientPtr client) ...@@ -977,7 +976,7 @@ ScreenSaverSetAttributes (ClientPtr client)
goto bail; goto bail;
} }
/* over allocate for override redirect */ /* over allocate for override redirect */
values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long)); values = xalloc ((len + 1) * sizeof (unsigned long));
if (!values) if (!values)
{ {
ret = BadAlloc; ret = BadAlloc;
...@@ -1379,7 +1378,7 @@ ProcScreenSaverSuspend (ClientPtr client) ...@@ -1379,7 +1378,7 @@ ProcScreenSaverSuspend (ClientPtr client)
* to the record, so the screensaver will be reenabled and the record freed * to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first. * if the client disconnects without reenabling it first.
*/ */
this = (ScreenSaverSuspensionPtr) xalloc (sizeof (ScreenSaverSuspensionRec)); this = xalloc (sizeof (ScreenSaverSuspensionRec));
if (!this) if (!this)
return BadAlloc; return BadAlloc;
......
...@@ -407,7 +407,7 @@ SecurityEventSelectForAuthorization( ...@@ -407,7 +407,7 @@ SecurityEventSelectForAuthorization(
} }
} }
pEventClient = (OtherClients *) xalloc(sizeof(OtherClients)); pEventClient = xalloc(sizeof(OtherClients));
if (!pEventClient) if (!pEventClient)
return BadAlloc; return BadAlloc;
pEventClient->mask = mask; pEventClient->mask = mask;
...@@ -539,7 +539,7 @@ ProcSecurityGenerateAuthorization( ...@@ -539,7 +539,7 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */ /* associate additional information with this auth ID */
pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec)); pAuth = xalloc(sizeof(SecurityAuthorizationRec));
if (!pAuth) if (!pAuth)
{ {
err = BadAlloc; err = BadAlloc;
......
...@@ -804,8 +804,7 @@ ProcShapeSelectInput (ClientPtr client) ...@@ -804,8 +804,7 @@ ProcShapeSelectInput (ClientPtr client)
} }
/* build the entry */ /* build the entry */
pNewShapeEvent = (ShapeEventPtr) pNewShapeEvent = xalloc (sizeof (ShapeEventRec));
xalloc (sizeof (ShapeEventRec));
if (!pNewShapeEvent) if (!pNewShapeEvent)
return BadAlloc; return BadAlloc;
pNewShapeEvent->next = 0; pNewShapeEvent->next = 0;
...@@ -827,7 +826,7 @@ ProcShapeSelectInput (ClientPtr client) ...@@ -827,7 +826,7 @@ ProcShapeSelectInput (ClientPtr client)
*/ */
if (!pHead) if (!pHead)
{ {
pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr)); pHead = xalloc (sizeof (ShapeEventPtr));
if (!pHead || if (!pHead ||
!AddResource (pWin->drawable.id, EventType, (pointer)pHead)) !AddResource (pWin->drawable.id, EventType, (pointer)pHead))
{ {
...@@ -1014,7 +1013,7 @@ ProcShapeGetRectangles (ClientPtr client) ...@@ -1014,7 +1013,7 @@ ProcShapeGetRectangles (ClientPtr client)
} }
if (!region) { if (!region) {
nrects = 1; nrects = 1;
rects = (xRectangle *) xalloc (sizeof (xRectangle)); rects = xalloc (sizeof (xRectangle));
if (!rects) if (!rects)
return BadAlloc; return BadAlloc;
switch (stuff->kind) { switch (stuff->kind) {
...@@ -1041,7 +1040,7 @@ ProcShapeGetRectangles (ClientPtr client) ...@@ -1041,7 +1040,7 @@ ProcShapeGetRectangles (ClientPtr client)
BoxPtr box; BoxPtr box;
nrects = REGION_NUM_RECTS(region); nrects = REGION_NUM_RECTS(region);
box = REGION_RECTS(region); box = REGION_RECTS(region);
rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle)); rects = xalloc (nrects * sizeof (xRectangle));
if (!rects && nrects) if (!rects && nrects)
return BadAlloc; return BadAlloc;
for (i = 0; i < nrects; i++, box++) { for (i = 0; i < nrects; i++, box++) {
......
...@@ -198,7 +198,7 @@ static Bool CheckForShmSyscall(void) ...@@ -198,7 +198,7 @@ static Bool CheckForShmSyscall(void)
if (shmid != -1) if (shmid != -1)
{ {
/* Successful allocation - clean up */ /* Successful allocation - clean up */
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); shmctl(shmid, IPC_RMID, NULL);
} }
else else
{ {
...@@ -265,7 +265,7 @@ ShmResetProc(ExtensionEntry *extEntry) ...@@ -265,7 +265,7 @@ ShmResetProc(ExtensionEntry *extEntry)
for (i = 0; i < MAXSCREENS; i++) for (i = 0; i < MAXSCREENS; i++)
{ {
shmFuncs[i] = (ShmFuncsPtr)NULL; shmFuncs[i] = NULL;
} }
} }
...@@ -422,7 +422,7 @@ ProcShmAttach(ClientPtr client) ...@@ -422,7 +422,7 @@ ProcShmAttach(ClientPtr client)
} }
else else
{ {
shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec)); shmdesc = xalloc(sizeof(ShmDescRec));
if (!shmdesc) if (!shmdesc)
return BadAlloc; return BadAlloc;
shmdesc->addr = shmat(stuff->shmid, 0, shmdesc->addr = shmat(stuff->shmid, 0,
...@@ -727,7 +727,7 @@ CreatePmap: ...@@ -727,7 +727,7 @@ CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) if(!(newPix = xalloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
newPix->type = XRT_PIXMAP; newPix->type = XRT_PIXMAP;
......
...@@ -93,7 +93,7 @@ ClientSleepUntil (ClientPtr client, ...@@ -93,7 +93,7 @@ ClientSleepUntil (ClientPtr client,
SertafiedGeneration = serverGeneration; SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE; BlockHandlerRegistered = FALSE;
} }
pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec)); pRequest = xalloc (sizeof (SertafiedRec));
if (!pRequest) if (!pRequest)
return FALSE; return FALSE;
pRequest->pClient = client; pRequest->pClient = client;
......
...@@ -883,7 +883,7 @@ SyncCreateSystemCounter( ...@@ -883,7 +883,7 @@ SyncCreateSystemCounter(
} }
} }
pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial); pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
if (pCounter) if (pCounter)
{ {
......
...@@ -284,7 +284,7 @@ XaceCensorImage( ...@@ -284,7 +284,7 @@ XaceCensorImage(
/* convert region to list-of-rectangles for PolyFillRect */ /* convert region to list-of-rectangles for PolyFillRect */
pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle)); pRects = xalloc(nRects * sizeof(xRectangle));
if (!pRects) if (!pRects)
{ {
failed = TRUE; failed = TRUE;
......
...@@ -125,7 +125,7 @@ CheckForShmSyscall(void) ...@@ -125,7 +125,7 @@ CheckForShmSyscall(void)
if (shmid != -1) if (shmid != -1)
{ {
/* Successful allocation - clean up */ /* Successful allocation - clean up */
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); shmctl(shmid, IPC_RMID, NULL);
} }
else else
{ {
...@@ -229,7 +229,7 @@ shmalloc( ...@@ -229,7 +229,7 @@ shmalloc(
if (size < 3500) if (size < 3500)
return (ShmDescPtr) NULL; return (ShmDescPtr) NULL;
pDesc = (ShmDescRec *) xalloc(sizeof(ShmDescRec)); pDesc = xalloc(sizeof(ShmDescRec));
if (!pDesc) if (!pDesc)
return (ShmDescPtr) NULL; return (ShmDescPtr) NULL;
...@@ -473,8 +473,7 @@ ProcXF86BigfontQueryFont( ...@@ -473,8 +473,7 @@ ProcXF86BigfontQueryFont(
shmid = pDesc->shmid; shmid = pDesc->shmid;
} else { } else {
#endif #endif
pCI = (xCharInfo *) pCI = xalloc(nCharInfos * sizeof(xCharInfo));
xalloc(nCharInfos * sizeof(xCharInfo));
if (!pCI) if (!pCI)
return BadAlloc; return BadAlloc;
#ifdef HAS_SHM #ifdef HAS_SHM
...@@ -536,8 +535,7 @@ ProcXF86BigfontQueryFont( ...@@ -536,8 +535,7 @@ ProcXF86BigfontQueryFont(
if (hashModulus > nCharInfos+1) if (hashModulus > nCharInfos+1)
hashModulus = nCharInfos+1; hashModulus = nCharInfos+1;
tmp = (CARD16*) tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
xalloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) { if (!tmp) {
if (!pDesc) xfree(pCI); if (!pDesc) xfree(pCI);
return BadAlloc; return BadAlloc;
...@@ -621,8 +619,7 @@ ProcXF86BigfontQueryFont( ...@@ -621,8 +619,7 @@ ProcXF86BigfontQueryFont(
? nUniqCharInfos * sizeof(xCharInfo) ? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16) + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0); : 0);
xXF86BigfontQueryFontReply* reply = xXF86BigfontQueryFontReply* reply = xalloc(rlength);
(xXF86BigfontQueryFontReply *) xalloc(rlength);
char* p; char* p;
if (!reply) { if (!reply) {
if (nCharInfos > 0) { if (nCharInfos > 0) {
......
...@@ -273,7 +273,7 @@ XvScreenInit(ScreenPtr pScreen) ...@@ -273,7 +273,7 @@ XvScreenInit(ScreenPtr pScreen)