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.
This commit is contained in:
Adam Jackson 2009-01-22 02:11:16 -05:00
parent 0fb4390526
commit 132b464d73
72 changed files with 343 additions and 376 deletions

View File

@ -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)
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)
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)
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)
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)
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)
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)
} }
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;

View File

@ -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)
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);

View File

@ -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)
* 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)
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;

View File

@ -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)
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)
} }
} }
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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;

View File

@ -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)
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)
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)
* 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;

View File

@ -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(
/* 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;

View File

@ -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)
*/ */
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)
} }
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)
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++) {

View File

@ -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)
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)
} }
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:
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;

View File

@ -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;

View File

@ -883,7 +883,7 @@ SyncCreateSystemCounter(
} }
} }
pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial); pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
if (pCounter) if (pCounter)
{ {

View File

@ -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;

View File

@ -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(
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(
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(
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(
? 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) {

View File

@ -273,7 +273,7 @@ XvScreenInit(ScreenPtr pScreen)
/* ALLOCATE SCREEN PRIVATE RECORD */ /* ALLOCATE SCREEN PRIVATE RECORD */
pxvs = (XvScreenPtr) xalloc (sizeof (XvScreenRec)); pxvs = xalloc (sizeof (XvScreenRec));
if (!pxvs) if (!pxvs)
{ {
ErrorF("XvScreenInit: Unable to allocate screen private structure\n"); ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
@ -367,11 +367,10 @@ XvDestroyPixmap(PixmapPtr pPix)
{ {
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
(void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw);
pp->pDraw);
pp->pDraw = (DrawablePtr)NULL; pp->pDraw = NULL;
pp->client = (ClientPtr)NULL; pp->client = NULL;
pp->time = currentTime; pp->time = currentTime;
} }
pp++; pp++;
@ -419,11 +418,10 @@ XvDestroyWindow(WindowPtr pWin)
{ {
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
(void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw);
pp->pDraw);
pp->pDraw = (DrawablePtr)NULL; pp->pDraw = NULL;
pp->client = (ClientPtr)NULL; pp->client = NULL;
pp->time = currentTime; pp->time = currentTime;
} }
pp++; pp++;
@ -455,8 +453,8 @@ XvdiVideoStopped(XvPortPtr pPort, int reason)
XvdiSendVideoNotify(pPort, pPort->pDraw, reason); XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
pPort->pDraw = (DrawablePtr)NULL; pPort->pDraw = NULL;
pPort->client = (ClientPtr)NULL; pPort->client = NULL;
pPort->time = currentTime; pPort->time = currentTime;
return Success; return Success;
@ -472,7 +470,7 @@ XvdiDestroyPort(pointer pPort, XID id)
static int static int
XvdiDestroyGrab(pointer pGrab, XID id) XvdiDestroyGrab(pointer pGrab, XID id)
{ {
((XvGrabPtr)pGrab)->client = (ClientPtr)NULL; ((XvGrabPtr)pGrab)->client = NULL;
return Success; return Success;
} }
@ -481,7 +479,7 @@ XvdiDestroyVideoNotify(pointer pn, XID id)
{ {
/* JUST CLEAR OUT THE client POINTER FIELD */ /* JUST CLEAR OUT THE client POINTER FIELD */
((XvVideoNotifyPtr)pn)->client = (ClientPtr)NULL; ((XvVideoNotifyPtr)pn)->client = NULL;
return Success; return Success;
} }
@ -490,7 +488,7 @@ XvdiDestroyPortNotify(pointer pn, XID id)
{ {
/* JUST CLEAR OUT THE client POINTER FIELD */ /* JUST CLEAR OUT THE client POINTER FIELD */
((XvPortNotifyPtr)pn)->client = (ClientPtr)NULL; ((XvPortNotifyPtr)pn)->client = NULL;
return Success; return Success;
} }
@ -852,7 +850,7 @@ XvdiGrabPort(
if ((pPort->pDraw) && (client != pPort->client)) if ((pPort->pDraw) && (client != pPort->client))
{ {
XvdiStopVideo((ClientPtr)NULL, pPort, pPort->pDraw); XvdiStopVideo(NULL, pPort, pPort->pDraw);
} }
pPort->grab.client = client; pPort->grab.client = client;
@ -891,7 +889,7 @@ XvdiUngrabPort(
/* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */ /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */
FreeResource(pPort->grab.id, XvRTGrab); FreeResource(pPort->grab.id, XvRTGrab);
pPort->grab.client = (ClientPtr)NULL; pPort->grab.client = NULL;
pPort->time = currentTime; pPort->time = currentTime;
@ -921,9 +919,9 @@ XvdiSelectVideoNotify(
if (!pn) if (!pn)
{ {
if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec)))) if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
return BadAlloc; return BadAlloc;
tpn->next = (XvVideoNotifyPtr)NULL; tpn->next = NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
{ {
xfree(tpn); xfree(tpn);
@ -934,13 +932,13 @@ XvdiSelectVideoNotify(
{ {
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */ /* LOOK TO SEE IF ENTRY ALREADY EXISTS */
fpn = (XvVideoNotifyPtr)NULL; fpn = NULL;
tpn = pn; tpn = pn;
while (tpn) while (tpn)
{ {
if (tpn->client == client) if (tpn->client == client)
{ {
if (!onoff) tpn->client = (ClientPtr)NULL; if (!onoff) tpn->client = NULL;
return Success; return Success;
} }
if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */ if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
@ -959,7 +957,7 @@ XvdiSelectVideoNotify(
} }
else else
{ {
if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec)))) if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
return BadAlloc; return BadAlloc;
tpn->next = pn->next; tpn->next = pn->next;
pn->next = tpn; pn->next = tpn;
@ -969,7 +967,7 @@ XvdiSelectVideoNotify(
/* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */ /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */
/* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */ /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */
tpn->client = (ClientPtr)NULL; tpn->client = NULL;
tpn->id = FakeClientID(client->index); tpn->id = FakeClientID(client->index);
AddResource(tpn->id, XvRTVideoNotify, tpn); AddResource(tpn->id, XvRTVideoNotify, tpn);
@ -988,7 +986,7 @@ XvdiSelectPortNotify(
/* SEE IF CLIENT IS ALREADY IN LIST */ /* SEE IF CLIENT IS ALREADY IN LIST */
tpn = (XvPortNotifyPtr)NULL; tpn = NULL;
pn = pPort->pNotify; pn = pPort->pNotify;
while (pn) while (pn)
{ {
@ -1005,7 +1003,7 @@ XvdiSelectPortNotify(
if (!onoff) if (!onoff)
{ {
pn->client = (ClientPtr)NULL; pn->client = NULL;
FreeResource(pn->id, XvRTPortNotify); FreeResource(pn->id, XvRTPortNotify);
} }
@ -1017,7 +1015,7 @@ XvdiSelectPortNotify(
if (!tpn) if (!tpn)
{ {
if (!(tpn = (XvPortNotifyPtr)xalloc(sizeof(XvPortNotifyRec)))) if (!(tpn = xalloc(sizeof(XvPortNotifyRec))))
return BadAlloc; return BadAlloc;
tpn->next = pPort->pNotify; tpn->next = pPort->pNotify;
pPort->pNotify = tpn; pPort->pNotify = tpn;
@ -1060,7 +1058,7 @@ XvdiStopVideo(
status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw); status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw);
pPort->pDraw = (DrawablePtr)NULL; pPort->pDraw = NULL;
pPort->client = (ClientPtr)client; pPort->client = (ClientPtr)client;
pPort->time = currentTime; pPort->time = currentTime;
@ -1084,7 +1082,7 @@ XvdiPreemptVideo(
status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw); status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw);
pPort->pDraw = (DrawablePtr)NULL; pPort->pDraw = NULL;
pPort->client = (ClientPtr)client; pPort->client = (ClientPtr)client;
pPort->time = currentTime; pPort->time = currentTime;

View File

@ -710,7 +710,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
XvMCScreenKey = &XvMCScreenKeyIndex; XvMCScreenKey = &XvMCScreenKeyIndex;
if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec)))) if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec))))
return BadAlloc; return BadAlloc;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);

View File

@ -109,7 +109,7 @@ MakeAtom(char *string, unsigned len, Bool makeit)
{ {
NodePtr nd; NodePtr nd;
nd = (NodePtr) xalloc(sizeof(NodeRec)); nd = xalloc(sizeof(NodeRec));
if (!nd) if (!nd)
return BAD_RESOURCE; return BAD_RESOURCE;
if (lastAtom < XA_LAST_PREDEFINED) if (lastAtom < XA_LAST_PREDEFINED)
@ -118,7 +118,7 @@ MakeAtom(char *string, unsigned len, Bool makeit)
} }
else else
{ {
nd->string = (char *) xalloc(len + 1); nd->string = xalloc(len + 1);
if (!nd->string) { if (!nd->string) {
xfree(nd); xfree(nd);
return BAD_RESOURCE; return BAD_RESOURCE;
@ -201,7 +201,7 @@ InitAtoms(void)
{ {
FreeAllAtoms(); FreeAllAtoms();
tableLength = InitialTableSize; tableLength = InitialTableSize;
nodeTable = (NodePtr *)xalloc(InitialTableSize*sizeof(NodePtr)); nodeTable = xalloc(InitialTableSize*sizeof(NodePtr));
if (!nodeTable) if (!nodeTable)
AtomError(); AtomError();
nodeTable[None] = (NodePtr)NULL; nodeTable[None] = (NodePtr)NULL;

View File

@ -274,7 +274,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
if ((class | DynamicClass) == DirectColor) if ((class | DynamicClass) == DirectColor)
sizebytes *= 3; sizebytes *= 3;
sizebytes += sizeof(ColormapRec); sizebytes += sizeof(ColormapRec);
pmap = (ColormapPtr) xalloc(sizebytes); pmap = xalloc(sizebytes);
if (!pmap) if (!pmap)
return (BadAlloc); return (BadAlloc);
#if defined(_XSERVER64) #if defined(_XSERVER64)
@ -310,7 +310,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
pent->refcnt = AllocPrivate; pent->refcnt = AllocPrivate;
pmap->freeRed = 0; pmap->freeRed = 0;
ppix = (Pixel *)xalloc(size * sizeof(Pixel)); ppix = xalloc(size * sizeof(Pixel));
if (!ppix) if (!ppix)
{ {
xfree(pmap); xfree(pmap);
@ -356,7 +356,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--)
pent->refcnt = AllocPrivate; pent->refcnt = AllocPrivate;
pmap->freeGreen = 0; pmap->freeGreen = 0;
ppix = (Pixel *) xalloc(size * sizeof(Pixel)); ppix = xalloc(size * sizeof(Pixel));
if (!ppix) if (!ppix)
{ {
xfree(pmap->clientPixelsRed[client]); xfree(pmap->clientPixelsRed[client]);
@ -372,7 +372,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--)
pent->refcnt = AllocPrivate; pent->refcnt = AllocPrivate;
pmap->freeBlue = 0; pmap->freeBlue = 0;
ppix = (Pixel *) xalloc(size * sizeof(Pixel)); ppix = xalloc(size * sizeof(Pixel));
if (!ppix) if (!ppix)
{ {
xfree(pmap->clientPixelsGreen[client]); xfree(pmap->clientPixelsGreen[client]);
@ -743,7 +743,7 @@ UpdateColors (ColormapPtr pmap)
pVisual = pmap->pVisual; pVisual = pmap->pVisual;
size = pVisual->ColormapEntries; size = pVisual->ColormapEntries;
defs = (xColorItem *)xalloc(size * sizeof(xColorItem)); defs = xalloc(size * sizeof(xColorItem));
if (!defs) if (!defs)
return; return;
n = 0; n = 0;
@ -962,7 +962,7 @@ AllocColor (ColormapPtr pmap,
{ {
colorResource *pcr; colorResource *pcr;
pcr = (colorResource *) xalloc(sizeof(colorResource)); pcr = xalloc(sizeof(colorResource));
if (!pcr) if (!pcr)
{ {
(void)FreeColors(pmap, client, 1, pPix, (Pixel)0); (void)FreeColors(pmap, client, 1, pPix, (Pixel)0);
@ -1578,7 +1578,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) if (!oldcount && (CLIENT_ID(pmap->mid) != client))
{ {
pcr = (colorResource *) xalloc(sizeof(colorResource)); pcr = xalloc(sizeof(colorResource));
if (!pcr) if (!pcr)
return (BadAlloc); return (BadAlloc);
} }
@ -1653,7 +1653,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) if (!oldcount && (CLIENT_ID(pmap->mid) != client))
{ {
pcr = (colorResource *) xalloc(sizeof(colorResource)); pcr = xalloc(sizeof(colorResource));
if (!pcr) if (!pcr)
return (BadAlloc); return (BadAlloc);
} }
@ -1745,9 +1745,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for(p = pixels; p < pixels + c; p++) for(p = pixels; p < pixels + c; p++)
*p = 0; *p = 0;
ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel)); ppixRed = xalloc(npixR * sizeof(Pixel));
ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel)); ppixGreen = xalloc(npixG * sizeof(Pixel));
ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel)); ppixBlue = xalloc(npixB * sizeof(Pixel));
if (!ppixRed || !ppixGreen || !ppixBlue) if (!ppixRed || !ppixGreen || !ppixBlue)
{ {
if (ppixBlue) xfree(ppixBlue); if (ppixBlue) xfree(ppixBlue);
@ -1852,7 +1852,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
npix = c << r; npix = c << r;
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
return(BadAlloc); return(BadAlloc);
if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel)))) if(!(ppixTemp = xalloc(npix * sizeof(Pixel))))
return(BadAlloc); return(BadAlloc);
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
@ -2082,14 +2082,13 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
npixClientNew = c << (r + g + b); npixClientNew = c << (r + g + b);
npixShared = (c << r) + (c << g) + (c << b); npixShared = (c << r) + (c << g) + (c << b);
psharedList = (SHAREDCOLOR **)xalloc(npixShared * psharedList = xalloc(npixShared * sizeof(SHAREDCOLOR *));
sizeof(SHAREDCOLOR *));
if (!psharedList) if (!psharedList)
return FALSE; return FALSE;
ppshared = psharedList; ppshared = psharedList;
for (z = npixShared; --z >= 0; ) for (z = npixShared; --z >= 0; )
{ {
if (!(ppshared[z] = (SHAREDCOLOR *)xalloc(sizeof(SHAREDCOLOR)))) if (!(ppshared[z] = xalloc(sizeof(SHAREDCOLOR))))
{ {
for (z++ ; z < npixShared; z++) for (z++ ; z < npixShared; z++)
xfree(ppshared[z]); xfree(ppshared[z]);
@ -2672,8 +2671,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
Colormap *pmaps; Colormap *pmaps;
int imap, nummaps, found; int imap, nummaps, found;
pmaps = (Colormap *) xalloc( pmaps = xalloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap));
pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
if(!pmaps) if(!pmaps)
return(FALSE); return(FALSE);
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)

View File

@ -345,7 +345,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
unsigned char *mskptr; unsigned char *mskptr;
n = BitmapBytePad(cm.width)*(long)cm.height; n = BitmapBytePad(cm.width)*(long)cm.height;
mskptr = mskbits = (unsigned char *)xalloc(n); mskptr = mskbits = xalloc(n);
if (!mskptr) if (!mskptr)
return BadAlloc; return BadAlloc;
while (--n >= 0) while (--n >= 0)
@ -405,7 +405,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
else else
{ {
bits->refcnt = 1; bits->refcnt = 1;
pShare = (GlyphSharePtr)xalloc(sizeof(GlyphShare)); pShare = xalloc(sizeof(GlyphShare));
if (!pShare) if (!pShare)
{ {
FreeCursorBits(bits); FreeCursorBits(bits);

View File

@ -1170,7 +1170,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
case PtrAccelPredictable: case PtrAccelPredictable:
{ {
DeviceVelocityPtr s; DeviceVelocityPtr s;
s = (DeviceVelocityPtr)xalloc(sizeof(DeviceVelocityRec)); s = xalloc(sizeof(DeviceVelocityRec));
if(!s) if(!s)
return FALSE; return FALSE;
InitVelocityData(s); InitVelocityData(s);
@ -1202,7 +1202,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
{ {
AbsoluteClassPtr abs; AbsoluteClassPtr abs;
abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec)); abs = xalloc(sizeof(AbsoluteClassRec));
if (!abs) if (!abs)
return FALSE; return FALSE;
@ -1233,7 +1233,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
{ {
FocusClassPtr focc; FocusClassPtr focc;
focc = (FocusClassPtr)xalloc(sizeof(FocusClassRec)); focc = xalloc(sizeof(FocusClassRec));
if (!focc) if (!focc)
return FALSE; return FALSE;
focc->win = PointerRootWin; focc->win = PointerRootWin;
@ -1251,7 +1251,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
{ {
PtrFeedbackPtr feedc; PtrFeedbackPtr feedc;
feedc = (PtrFeedbackPtr)xalloc(sizeof(PtrFeedbackClassRec)); feedc = xalloc(sizeof(PtrFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
@ -1289,17 +1289,15 @@ InitStringFeedbackClassDeviceStruct (
int i; int i;
StringFeedbackPtr feedc; StringFeedbackPtr feedc;
feedc = (StringFeedbackPtr)xalloc(sizeof(StringFeedbackClassRec)); feedc = xalloc(sizeof(StringFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
feedc->ctrl.num_symbols_supported = num_symbols_supported; feedc->ctrl.num_symbols_supported = num_symbols_supported;
feedc->ctrl.num_symbols_displayed = 0; feedc->ctrl.num_symbols_displayed = 0;
feedc->ctrl.max_symbols = max_symbols; feedc->ctrl.max_symbols = max_symbols;
feedc->ctrl.symbols_supported = (KeySym *) feedc->ctrl.symbols_supported = xalloc (sizeof (KeySym) * num_symbols_supported);
xalloc (sizeof (KeySym) * num_symbols_supported); feedc->ctrl.symbols_displayed = xalloc (sizeof (KeySym) * max_symbols);
feedc->ctrl.symbols_displayed = (KeySym *)
xalloc (sizeof (KeySym) * max_symbols);
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
{ {
if (feedc->ctrl.symbols_supported) if (feedc->ctrl.symbols_supported)
@ -1327,7 +1325,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
{ {
BellFeedbackPtr feedc; BellFeedbackPtr feedc;
feedc = (BellFeedbackPtr)xalloc(sizeof(BellFeedbackClassRec)); feedc = xalloc(sizeof(BellFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
@ -1346,7 +1344,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
{ {
LedFeedbackPtr feedc; LedFeedbackPtr feedc;
feedc = (LedFeedbackPtr)xalloc(sizeof(LedFeedbackClassRec)); feedc = xalloc(sizeof(LedFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
@ -1365,7 +1363,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
{ {
IntegerFeedbackPtr feedc; IntegerFeedbackPtr feedc;
feedc = (IntegerFeedbackPtr)xalloc(sizeof(IntegerFeedbackClassRec)); feedc = xalloc(sizeof(IntegerFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;

View File

@ -347,7 +347,7 @@ Dispatch(void)
nextFreeClientID = 1; nextFreeClientID = 1;
nClients = 0; nClients = 0;
clientReady = (int *) xalloc(sizeof(int) * MaxClients); clientReady = xalloc(sizeof(int) * MaxClients);
if (!clientReady) if (!clientReady)
return; return;
@ -848,7 +848,7 @@ ProcQueryTree(ClientPtr client)
{ {
int curChild = 0; int curChild = 0;
childIDs = (Window *) xalloc(numChildren * sizeof(Window)); childIDs = xalloc(numChildren * sizeof(Window));
if (!childIDs) if (!childIDs)
return BadAlloc; return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
@ -1142,7 +1142,7 @@ ProcQueryFont(ClientPtr client)
rlength = sizeof(xQueryFontReply) + rlength = sizeof(xQueryFontReply) +
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo); nprotoxcistructs * sizeof(xCharInfo);
reply = (xQueryFontReply *)xalloc(rlength); reply = xalloc(rlength);
if(!reply) if(!reply)
{ {
return(BadAlloc); return(BadAlloc);
@ -1970,7 +1970,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
xgi.length = length; xgi.length = length;
if (im_return) { if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length); pBuf = xalloc(sz_xGetImageReply + length);
if (!pBuf) if (!pBuf)
return (BadAlloc); return (BadAlloc);
if (widthBytesLine == 0) if (widthBytesLine == 0)
@ -2008,7 +2008,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
length += widthBytesLine; length += widthBytesLine;
} }
} }
if(!(pBuf = (char *) xalloc(length))) if(!(pBuf = xalloc(length)))
return (BadAlloc); return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
} }
@ -2380,8 +2380,7 @@ ProcListInstalledColormaps(ClientPtr client)
if (rc != Success) if (rc != Success)
goto out; goto out;
preply = (xListInstalledColormapsReply *) preply = xalloc(sizeof(xListInstalledColormapsReply) +
xalloc(sizeof(xListInstalledColormapsReply) +
pWin->drawable.pScreen->maxInstalledCmaps * pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap)); sizeof(Colormap));
if(!preply) if(!preply)
@ -2525,7 +2524,7 @@ ProcAllocColorCells (ClientPtr client)
} }
nmasks = stuff->planes; nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel); length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
ppixels = (Pixel *)xalloc(length); ppixels = xalloc(length);
if(!ppixels) if(!ppixels)
return(BadAlloc); return(BadAlloc);
pmasks = ppixels + npixels; pmasks = ppixels + npixels;
@ -2594,7 +2593,7 @@ ProcAllocColorPlanes(ClientPtr client)
acpr.sequenceNumber = client->sequence; acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels; acpr.nPixels = npixels;
length = (long)npixels * sizeof(Pixel); length = (long)npixels * sizeof(Pixel);
ppixels = (Pixel *)xalloc(length); ppixels = xalloc(length);
if(!ppixels) if(!ppixels)
return(BadAlloc); return(BadAlloc);
if( (rc = AllocColorPlanes(client->index, pcmp, npixels, if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
@ -2747,7 +2746,7 @@ ProcQueryColors(ClientPtr client)
xQueryColorsReply qcr; xQueryColorsReply qcr;
count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
prgbs = (xrgb *)xalloc(count * sizeof(xrgb)); prgbs = xalloc(count * sizeof(xrgb));
if(!prgbs && count) if(!prgbs && count)
return(BadAlloc); return(BadAlloc);
if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
@ -3504,7 +3503,7 @@ ClientPtr NextAvailableClient(pointer ospriv)
i = nextFreeClientID; i = nextFreeClientID;
if (i == MAXCLIENTS) if (i == MAXCLIENTS)
return (ClientPtr)NULL; return (ClientPtr)NULL;
clients[i] = client = (ClientPtr)xalloc(sizeof(ClientRec)); clients[i] = client = xalloc(sizeof(ClientRec));
if (!client) if (!client)
return (ClientPtr)NULL; return (ClientPtr)NULL;
InitClient(client, i, ospriv); InitClient(client, i, ospriv);

View File

@ -397,7 +397,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
#ifdef FONTDEBUG #ifdef FONTDEBUG
char *f; char *f;
f = (char *)xalloc(lenfname + 1); f = xalloc(lenfname + 1);
memmove(f, pfontname, lenfname); memmove(f, pfontname, lenfname);
f[lenfname] = '\0'; f[lenfname] = '\0';
ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f); ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f);
@ -434,10 +434,10 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
return Success; return Success;
} }
} }
c = (OFclosurePtr) xalloc(sizeof(OFclosureRec)); c = xalloc(sizeof(OFclosureRec));
if (!c) if (!c)
return BadAlloc; return BadAlloc;
c->fontname = (char *) xalloc(lenfname); c->fontname = xalloc(lenfname);
c->origFontName = pfontname; c->origFontName = pfontname;
c->origFontNameLen = lenfname; c->origFontNameLen = lenfname;
if (!c->fontname) { if (!c->fontname) {
@ -448,8 +448,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
* copy the current FPE list, so that if it gets changed by another client * copy the current FPE list, so that if it gets changed by another client
* while we're blocking, the request still appears atomic * while we're blocking, the request still appears atomic
*/ */
c->fpe_list = (FontPathElementPtr *) c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
xalloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) { if (!c->fpe_list) {
xfree(c->fontname); xfree(c->fontname);
xfree(c); xfree(c);
@ -683,7 +682,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
} }
if (err == FontNameAlias) { if (err == FontNameAlias) {
if (resolved) xfree(resolved); if (resolved) xfree(resolved);
resolved = (char *) xalloc(resolvedlen + 1); resolved = xalloc(resolvedlen + 1);
if (resolved) if (resolved)
memmove(resolved, tmpname, resolvedlen + 1); memmove(resolved, tmpname, resolvedlen + 1);
} }
@ -738,7 +737,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
c->haveSaved = TRUE; c->haveSaved = TRUE;
if (c->savedName) if (c->savedName)
xfree(c->savedName); xfree(c->savedName);
c->savedName = (char *)xalloc(namelen + 1); c->savedName = xalloc(namelen + 1);
if (c->savedName) if (c->savedName)
memmove(c->savedName, name, namelen + 1); memmove(c->savedName, name, namelen + 1);
c->savedNameLen = namelen; c->savedNameLen = namelen;
@ -799,7 +798,7 @@ finish:
reply.nFonts = nnames; reply.nFonts = nnames;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
bufptr = bufferStart = (char *) xalloc(reply.length << 2); bufptr = bufferStart = xalloc(reply.length << 2);
if (!bufptr && reply.length) { if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
@ -859,10 +858,9 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
if (i != Success) if (i != Success)
return i; return i;
if (!(c = (LFclosurePtr) xalloc(sizeof *c))) if (!(c = xalloc(sizeof *c)))
return BadAlloc; return BadAlloc;
c->fpe_list = (FontPathElementPtr *) c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
xalloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) { if (!c->fpe_list) {
xfree(c); xfree(c);
return BadAlloc; return BadAlloc;
@ -1001,7 +999,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
c->savedNumFonts = numFonts; c->savedNumFonts = numFonts;
if (c->savedName) if (c->savedName)
xfree(c->savedName); xfree(c->savedName);
c->savedName = (char *)xalloc(namelen + 1); c->savedName = xalloc(namelen + 1);
if (c->savedName) if (c->savedName)
memmove(c->savedName, name, namelen + 1); memmove(c->savedName, name, namelen + 1);
aliascount = 20; aliascount = 20;
@ -1135,10 +1133,9 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
if (i != Success) if (i != Success)
return i; return i;
if (!(c = (LFWIclosurePtr) xalloc(sizeof *c))) if (!(c = xalloc(sizeof *c)))
goto badAlloc; goto badAlloc;
c->fpe_list = (FontPathElementPtr *) c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
xalloc(sizeof(FontPathElementPtr) * num_fpes);
if (!c->fpe_list) if (!c->fpe_list)
{ {
xfree(c); xfree(c);
@ -1325,7 +1322,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
/* Step 1 */ /* Step 1 */
/* Allocate a malloc'd closure structure to replace /* Allocate a malloc'd closure structure to replace
the local one we were passed */ the local one we were passed */
new_closure = (PTclosurePtr) xalloc(sizeof(PTclosureRec)); new_closure = xalloc(sizeof(PTclosureRec));
if (!new_closure) if (!new_closure)
{ {
err = BadAlloc; err = BadAlloc;
@ -1335,7 +1332,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
c = new_closure; c = new_closure;
len = c->endReq - c->pElt; len = c->endReq - c->pElt;
c->data = (unsigned char *)xalloc(len); c->data = xalloc(len);
if (!c->data) if (!c->data)
{ {
xfree(c); xfree(c);
@ -1517,7 +1514,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
in doPolyText, but much simpler because the in doPolyText, but much simpler because the
request structure is much simpler. */ request structure is much simpler. */
new_closure = (ITclosurePtr) xalloc(sizeof(ITclosureRec)); new_closure = xalloc(sizeof(ITclosureRec));
if (!new_closure) if (!new_closure)
{ {
err = BadAlloc; err = BadAlloc;
@ -1526,7 +1523,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
*new_closure = *c; *new_closure = *c;
c = new_closure; c = new_closure;
data = (unsigned char *)xalloc(c->nChars * c->itemSize); data = xalloc(c->nChars * c->itemSize);
if (!data) if (!data)
{ {
xfree(c); xfree(c);
@ -1663,7 +1660,7 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force)
} }
FreeFPE(list[i]); FreeFPE(list[i]);
} }
xfree((char *) list); xfree(list);
} }
static FontPathElementPtr static FontPathElementPtr
@ -1690,8 +1687,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
unsigned char *cp = paths; unsigned char *cp = paths;
FontPathElementPtr fpe = NULL, *fplist; FontPathElementPtr fpe = NULL, *fplist;
fplist = (FontPathElementPtr *) fplist = xalloc(sizeof(FontPathElementPtr) * npaths);
xalloc(sizeof(FontPathElementPtr) * npaths);
if (!fplist) { if (!fplist) {
*bad = 0; *bad = 0;
return BadAlloc; return BadAlloc;
@ -1732,13 +1728,13 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
/* if error or can't do it, act like it's a new one */ /* if error or can't do it, act like it's a new one */
if (!fpe) if (!fpe)
{ {
fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec)); fpe = xalloc(sizeof(FontPathElementRec));
if (!fpe) if (!fpe)
{ {
err = BadAlloc; err = BadAlloc;
goto bail; goto bail;
} }
fpe->name = (char *) xalloc(len + 1); fpe->name = xalloc(len + 1);
if (!fpe->name) if (!fpe->name)
{ {
xfree(fpe); xfree(fpe);
@ -1826,7 +1822,7 @@ SetDefaultFontPath(char *path)
/* get enough for string, plus values -- use up commas */ /* get enough for string, plus values -- use up commas */
len = strlen(path) + 1; len = strlen(path) + 1;
nump = cp = newpath = (unsigned char *) xalloc(len); nump = cp = newpath = xalloc(len);
if (!newpath) if (!newpath)
return BadAlloc; return BadAlloc;
pp = (unsigned char *) path; pp = (unsigned char *) path;

View File

@ -567,7 +567,7 @@ QueueWorkProc (
{ {
WorkQueuePtr q; WorkQueuePtr q;
q = (WorkQueuePtr) xalloc (sizeof *q); q = xalloc (sizeof *q);
if (!q) if (!q)
return FALSE; return FALSE;
q->function = function; q->function = function;
@ -601,7 +601,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
{ {
SleepQueuePtr q; SleepQueuePtr q;
q = (SleepQueuePtr) xalloc (sizeof *q); q = xalloc (sizeof *q);
if (!q) if (!q)
return FALSE; return FALSE;
@ -681,7 +681,7 @@ _AddCallback(
{ {
CallbackPtr cbr; CallbackPtr cbr;
cbr = (CallbackPtr) xalloc(sizeof(CallbackRec)); cbr = xalloc(sizeof(CallbackRec));
if (!cbr) if (!cbr)
return FALSE; return FALSE;
cbr->proc = callback; cbr->proc = callback;
@ -824,7 +824,7 @@ CreateCallbackList(CallbackListPtr *pcbl)
int i; int i;
if (!pcbl) return FALSE; if (!pcbl) return FALSE;
cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec)); cbl = xalloc(sizeof(CallbackListRec));
if (!cbl) return FALSE; if (!cbl) return FALSE;
cbl->inCallback = 0; cbl->inCallback = 0;
cbl->deleted = FALSE; cbl->deleted = FALSE;

View File

@ -1131,7 +1131,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
if (xE->u.u.type == GenericEvent) /* count is 1 for GenericEvents */ if (xE->u.u.type == GenericEvent) /* count is 1 for GenericEvents */
eventlen += ((xGenericEvent*)xE)->length * 4; eventlen += ((xGenericEvent*)xE)->length * 4;
qe = (QdEventPtr)xalloc(sizeof(QdEventRec) + eventlen); qe = xalloc(sizeof(QdEventRec) + eventlen);
if (!qe) if (!qe)
return; return;
qe->next = (QdEventPtr)NULL; qe->next = (QdEventPtr)NULL;
@ -3824,7 +3824,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
check = 0; check = 0;
if (!pWin->optional && !MakeWindowOptional (pWin)) if (!pWin->optional && !MakeWindowOptional (pWin))
return BadAlloc; return BadAlloc;
others = (OtherClients *) xalloc(sizeof(OtherClients)); others = xalloc(sizeof(OtherClients));
if (!others) if (!others)
return BadAlloc; return BadAlloc;
others->mask = mask; others->mask = mask;

View File

@ -86,10 +86,10 @@ AddExtension(char *name, int NumEvents, int NumErrors,
(unsigned)(lastError + NumErrors > LAST_ERROR)) (unsigned)(lastError + NumErrors > LAST_ERROR))
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); ext = xalloc(sizeof(ExtensionEntry));
if (!ext) if (!ext)
return((ExtensionEntry *) NULL); return(NULL);
ext->name = (char *)xalloc(strlen(name) + 1); ext->name = xalloc(strlen(name) + 1);
ext->num_aliases = 0; ext->num_aliases = 0;
ext->aliases = (char **)NULL; ext->aliases = (char **)NULL;
ext->devPrivates = NULL; ext->devPrivates = NULL;
@ -156,7 +156,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
if (!aliases) if (!aliases)
return FALSE; return FALSE;
ext->aliases = aliases; ext->aliases = aliases;
name = (char *)xalloc(strlen(alias) + 1); name = xalloc(strlen(alias) + 1);
if (!name) if (!name)
return FALSE; return FALSE;
strcpy(name, alias); strcpy(name, alias);
@ -323,7 +323,7 @@ ProcListExtensions(ClientPtr client)
total_length += strlen(extensions[i]->aliases[j]) + 1; total_length += strlen(extensions[i]->aliases[j]) + 1;
} }
reply.length = (total_length + 3) >> 2; reply.length = (total_length + 3) >> 2;
buffer = bufptr = (char *)xalloc(total_length); buffer = bufptr = xalloc(total_length);
if (!buffer) if (!buffer)
return(BadAlloc); return(BadAlloc);
for (i=0; i<NumExtensions; i++) for (i=0; i<NumExtensions; i++)

View File

@ -470,7 +470,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
{ {
unsigned char *dash; unsigned char *dash;
dash = (unsigned char *)xalloc(2 * sizeof(unsigned char)); dash = xalloc(2 * sizeof(unsigned char));
if (dash) if (dash)
{ {
if (pGC->dash != DefaultDash) if (pGC->dash != DefaultDash)
@ -579,7 +579,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
{ {
GCPtr pGC; GCPtr pGC;
pGC = (GCPtr)xalloc(sizeof(GC)); pGC = xalloc(sizeof(GC));
if (!pGC) if (!pGC)
{ {
*pStatus = BadAlloc; *pStatus = BadAlloc;
@ -829,8 +829,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
unsigned char *dash; unsigned char *dash;
unsigned int i; unsigned int i;
dash = (unsigned char *)xalloc(pgcSrc->numInDashList * dash = xalloc(pgcSrc->numInDashList * sizeof(unsigned char));
sizeof(unsigned char));
if (dash) if (dash)
{ {
if (pgcDst->dash != DefaultDash) if (pgcDst->dash != DefaultDash)
@ -909,7 +908,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
{ {
GCPtr pGC; GCPtr pGC;
pGC = (GCPtr)xalloc(sizeof(GC)); pGC = xalloc(sizeof(GC));
if (!pGC) if (!pGC)
return (GCPtr)NULL; return (GCPtr)NULL;
@ -1069,9 +1068,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
} }
if (ndash & 1) if (ndash & 1)
p = (unsigned char *)xalloc(2 * ndash * sizeof(unsigned char)); p = xalloc(2 * ndash * sizeof(unsigned char));
else else
p = (unsigned char *)xalloc(ndash * sizeof(unsigned char)); p = xalloc(ndash * sizeof(unsigned char));
if (!p) if (!p)
return BadAlloc; return BadAlloc;
@ -1166,7 +1165,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
if (newct < 0) if (newct < 0)
return(BadMatch); return(BadMatch);
size = nrects * sizeof(xRectangle); size = nrects * sizeof(xRectangle);
prectsNew = (xRectangle *) xalloc(size); prectsNew = xalloc(size);
if (!prectsNew && size) if (!prectsNew && size)
return BadAlloc; return BadAlloc;

View File

@ -82,7 +82,7 @@ CreateGrab(
{ {
GrabPtr grab; GrabPtr grab;
grab = (GrabPtr)xalloc(sizeof(GrabRec)); grab = xalloc(sizeof(GrabRec));
if (!grab) if (!grab)
return (GrabPtr)NULL; return (GrabPtr)NULL;
grab->resource = FakeClientID(client); grab->resource = FakeClientID(client);
@ -158,7 +158,7 @@ DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail)
Mask *mask; Mask *mask;
int i; int i;
mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask); mask = xalloc(sizeof(Mask) * MasksPerDetailMask);
if (mask) if (mask)
{ {
if (pDetailMask) if (pDetailMask)
@ -395,10 +395,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
i++; i++;
if (!i) if (!i)
return TRUE; return TRUE;
deletes = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); deletes = xalloc(i * sizeof(GrabPtr));
adds = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); adds = xalloc(i * sizeof(GrabPtr));
updates = (Mask ***)xalloc(i * sizeof(Mask **)); updates = xalloc(i * sizeof(Mask **));
details = (Mask **)xalloc(i * sizeof(Mask *)); details = xalloc(i * sizeof(Mask *));
if (!deletes || !adds || !updates || !details) if (!deletes || !adds || !updates || !details)
{ {
if (details) xfree(details); if (details) xfree(details);

View File

@ -285,7 +285,7 @@ int main(int argc, char *argv[], char *envp[])
InitProcVectors(); InitProcVectors();
for (i=1; i<MAXCLIENTS; i++) for (i=1; i<MAXCLIENTS; i++)
clients[i] = NullClient; clients[i] = NullClient;
serverClient = (ClientPtr)xalloc(sizeof(ClientRec)); serverClient = xalloc(sizeof(ClientRec));
if (!serverClient) if (!serverClient)
FatalError("couldn't create server client"); FatalError("couldn't create server client");
InitClient(serverClient, 0, (pointer)NULL); InitClient(serverClient, 0, (pointer)NULL);
@ -515,7 +515,7 @@ CreateConnectionBlock(void)
((setup.nbytesVendor + 3) & ~3) + ((setup.nbytesVendor + 3) & ~3) +
(setup.numFormats * sizeof(xPixmapFormat)) + (setup.numFormats * sizeof(xPixmapFormat)) +
(setup.numRoots * sizeof(xWindowRoot)); (setup.numRoots * sizeof(xWindowRoot));
ConnectionInfo = (char *) xalloc(lenofblock); ConnectionInfo = xalloc(lenofblock);
if (!ConnectionInfo) if (!ConnectionInfo)
return FALSE; return FALSE;

View File

@ -113,7 +113,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
return NullPixmap; return NullPixmap;
pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); pPixmap = xalloc(pScreen->totalPixmapSize + pixDataSize);
if (!pPixmap) if (!pPixmap)
return NullPixmap; return NullPixmap;

View File

@ -312,7 +312,7 @@ dixResetPrivates(void)
if (offsets) if (offsets)
xfree(offsets); xfree(offsets);
offsetsSize = sizeof(offsetDefaults); offsetsSize = sizeof(offsetDefaults);
offsets = (int *)xalloc(offsetsSize); offsets = xalloc(offsetsSize);
offsetsSize /= sizeof(int); offsetsSize /= sizeof(int);
if (!offsets) if (!offsets)
return FALSE; return FALSE;

View File

@ -136,8 +136,8 @@ ProcRotateProperties(ClientPtr client)
return rc; return rc;
atoms = (Atom *) & stuff[1]; atoms = (Atom *) & stuff[1];
props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr)); props = xalloc(stuff->nAtoms * sizeof(PropertyPtr));
saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec)); saved = xalloc(stuff->nAtoms * sizeof(PropertyRec));
if (!props || !saved) { if (!props || !saved) {
rc = BadAlloc; rc = BadAlloc;
goto out; goto out;
@ -267,10 +267,10 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
{ {
if (!pWin->optional && !MakeWindowOptional (pWin)) if (!pWin->optional && !MakeWindowOptional (pWin))
return(BadAlloc); return(BadAlloc);
pProp = (PropertyPtr)xalloc(sizeof(PropertyRec)); pProp = xalloc(sizeof(PropertyRec));
if (!pProp) if (!pProp)
return(BadAlloc); return(BadAlloc);
data = (pointer)xalloc(totalSize); data = xalloc(totalSize);
if (!data && len) if (!data && len)
{ {
xfree(pProp); xfree(pProp);
@ -339,7 +339,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
} }
else if (mode == PropModePrepend) else if (mode == PropModePrepend)
{ {
data = (pointer)xalloc(sizeInBytes * (len + pProp->size)); data = xalloc(sizeInBytes * (len + pProp->size));
if (!data) if (!data)
return(BadAlloc); return(BadAlloc);
memmove(&((char *)data)[totalSize], (char *)pProp->data, memmove(&((char *)data)[totalSize], (char *)pProp->data,
@ -581,7 +581,7 @@ ProcListProperties(ClientPtr client)
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
numProps++; numProps++;
if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) if (numProps && !(pAtoms = xalloc(numProps * sizeof(Atom))))
return BadAlloc; return BadAlloc;
numProps = 0; numProps = 0;

View File

@ -255,8 +255,7 @@ InitClientResources(ClientPtr client)
TypeMask = RC_LASTPREDEF - 1; TypeMask = RC_LASTPREDEF - 1;
if (DeleteFuncs) if (DeleteFuncs)
xfree(DeleteFuncs); xfree(DeleteFuncs);
DeleteFuncs = (DeleteType *)xalloc((lastResourceType + 1) * DeleteFuncs = xalloc((lastResourceType + 1) * sizeof(DeleteType));
sizeof(DeleteType));
if (!DeleteFuncs) if (!DeleteFuncs)
return FALSE; return FALSE;
DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA;
@ -271,7 +270,7 @@ InitClientResources(ClientPtr client)
DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
} }
clientTable[i = client->index].resources = clientTable[i = client->index].resources =
(ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr)); xalloc(INITBUCKETS*sizeof(ResourcePtr));
if (!clientTable[i].resources) if (!clientTable[i].resources)
return FALSE; return FALSE;
clientTable[i].buckets = INITBUCKETS; clientTable[i].buckets = INITBUCKETS;
@ -459,7 +458,7 @@ AddResource(XID id, RESTYPE type, pointer value)
(rrec->hashsize < MAXHASHSIZE)) (rrec->hashsize < MAXHASHSIZE))
RebuildTable(client); RebuildTable(client);
head = &rrec->resources[Hash(client, id)]; head = &rrec->resources[Hash(client, id)];
res = (ResourcePtr)xalloc(sizeof(ResourceRec)); res = xalloc(sizeof(ResourceRec));
if (!res) if (!res)
{ {
(*DeleteFuncs[type & TypeMask])(value, id); (*DeleteFuncs[type & TypeMask])(value, id);
@ -491,10 +490,10 @@ RebuildTable(int client)
*/ */
j = 2 * clientTable[client].buckets; j = 2 * clientTable[client].buckets;
tails = (ResourcePtr **)xalloc(j * sizeof(ResourcePtr *)); tails = xalloc(j * sizeof(ResourcePtr *));
if (!tails) if (!tails)
return; return;
resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr)); resources = xalloc(j * sizeof(ResourcePtr));
if (!resources) if (!resources)
{ {
xfree(tails); xfree(tails);

View File

@ -99,7 +99,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
CARD32 tmpbuf[1]; CARD32 tmpbuf[1];
/* Allocate as big a buffer as we can... */ /* Allocate as big a buffer as we can... */
while (!(pbufT = (CARD32 *) xalloc(bufsize))) while (!(pbufT = xalloc(bufsize)))
{ {
bufsize >>= 1; bufsize >>= 1;
if (bufsize == 4) if (bufsize == 4)
@ -131,7 +131,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
} }
if (pbufT != tmpbuf) if (pbufT != tmpbuf)
xfree ((char *) pbufT); xfree (pbufT);
} }
/** /**
@ -147,7 +147,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
short tmpbuf[2]; short tmpbuf[2];
/* Allocate as big a buffer as we can... */ /* Allocate as big a buffer as we can... */
while (!(pbufT = (short *) xalloc(bufsize))) while (!(pbufT = xalloc(bufsize)))
{ {
bufsize >>= 1; bufsize >>= 1;
if (bufsize == 4) if (bufsize == 4)
@ -179,7 +179,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
} }
if (pbufT != tmpbuf) if (pbufT != tmpbuf)
xfree ((char *) pbufT); xfree (pbufT);
} }
@ -1262,7 +1262,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
{ {
char *pInfoTBase; char *pInfoTBase;
pInfoTBase = (char *) xalloc(size); pInfoTBase = xalloc(size);
if (!pInfoTBase) if (!pInfoTBase)
{ {
pClient->noClientException = -1; pClient->noClientException = -1;

View File

@ -360,7 +360,7 @@ CreateRootWindow(ScreenPtr pScreen)
BoxRec box; BoxRec box;
PixmapFormatRec *format; PixmapFormatRec *format;
pWin = (WindowPtr)xalloc(sizeof(WindowRec)); pWin = xalloc(sizeof(WindowRec));
if (!pWin) if (!pWin)
return FALSE; return FALSE;
@ -387,7 +387,7 @@ CreateRootWindow(ScreenPtr pScreen)
pWin->parent = NullWindow; pWin->parent = NullWindow;
SetWindowToDefaults(pWin); SetWindowToDefaults(pWin);
pWin->optional = (WindowOptRec *) xalloc (sizeof (WindowOptRec)); pWin->optional = xalloc (sizeof (WindowOptRec));
if (!pWin->optional) if (!pWin->optional)
return FALSE; return FALSE;
@ -647,7 +647,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
return NullWindow; return NullWindow;
} }
pWin = (WindowPtr)xalloc(sizeof(WindowRec)); pWin = xalloc(sizeof(WindowRec));
if (!pWin) if (!pWin)
{ {
*error = BadAlloc; *error = BadAlloc;
@ -3299,8 +3299,8 @@ TileScreenSaver(int i, int kind)
cm.height=16; cm.height=16;
cm.xhot=8; cm.xhot=8;
cm.yhot=8; cm.yhot=8;
srcbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); srcbits = xalloc( BitmapBytePad(32)*16);
mskbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); mskbits = xalloc( BitmapBytePad(32)*16);
if (!srcbits || !mskbits) if (!srcbits || !mskbits)
{ {
xfree(srcbits); xfree(srcbits);
@ -3460,7 +3460,7 @@ MakeWindowOptional (WindowPtr pWin)
if (pWin->optional) if (pWin->optional)
return TRUE; return TRUE;
optional = (WindowOptPtr) xalloc (sizeof (WindowOptRec)); optional = xalloc (sizeof (WindowOptRec));
if (!optional) if (!optional)
return FALSE; return FALSE;
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate]; optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
@ -3476,8 +3476,7 @@ MakeWindowOptional (WindowPtr pWin)
optional->inputMasks = NULL; optional->inputMasks = NULL;
optional->deviceCursors = NULL; optional->deviceCursors = NULL;
optional->geMasks = optional->geMasks = xalloc(sizeof(GenericClientMasksRec));
(GenericClientMasksPtr)xalloc(sizeof(GenericClientMasksRec));
if (!optional->geMasks) if (!optional->geMasks)
{ {
xfree(optional); xfree(optional);
@ -3576,7 +3575,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
if (!pCursor) if (!pCursor)
return Success; return Success;
pNewNode = (DevCursNodePtr)xalloc(sizeof(DevCursNodeRec)); pNewNode = xalloc(sizeof(DevCursNodeRec));
pNewNode->dev = pDev; pNewNode->dev = pDev;
pNewNode->next = pWin->optional->deviceCursors; pNewNode->next = pWin->optional->deviceCursors;
pWin->optional->deviceCursors = pNewNode; pWin->optional->deviceCursors = pNewNode;

View File

@ -880,8 +880,7 @@ miComputeWideEllipse(
{ {
if (spdata) if (spdata)
xfree(spdata); xfree(spdata);
spdata = (miArcSpanData *)xalloc(sizeof(miArcSpanData) + spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
sizeof(miArcSpan) * (k + 2));
lruent->spdata = spdata; lruent->spdata = spdata;
if (!spdata) if (!spdata)
{ {
@ -925,7 +924,7 @@ miFillWideEllipse(
yorgu = parc->height + pGC->lineWidth; yorgu = parc->height + pGC->lineWidth;
n = (sizeof(int) * 2) * yorgu; n = (sizeof(int) * 2) * yorgu;
widths = (int *)xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu); widths = xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
if (!widths) if (!widths)
return; return;
points = (DDXPointPtr)((char *)widths + n); points = (DDXPointPtr)((char *)widths + n);
@ -1361,7 +1360,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
arc.height = width; arc.height = width;
arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x); arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x);
arc.angle2 = a; arc.angle2 = a;
pArcPts = (SppPointPtr) xalloc (3 * sizeof (SppPointRec)); pArcPts = xalloc (3 * sizeof (SppPointRec));
if (!pArcPts) if (!pArcPts)
return; return;
pArcPts[0].x = otherCorner.x; pArcPts[0].x = otherCorner.x;
@ -1783,7 +1782,7 @@ addArc (
arc = (miArcDataPtr) xrealloc (*arcsp, arc = (miArcDataPtr) xrealloc (*arcsp,
newsize * sizeof (**arcsp)); newsize * sizeof (**arcsp));
if (!arc) if (!arc)
return (miArcDataPtr)NULL; return NULL;
*sizep = newsize; *sizep = newsize;
*arcsp = arc; *arcsp = arc;
} }
@ -1895,14 +1894,14 @@ miComputeArcs (
isDoubleDash = (pGC->lineStyle == LineDoubleDash); isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashOffset = pGC->dashOffset; dashOffset = pGC->dashOffset;
data = (struct arcData *) xalloc (narcs * sizeof (struct arcData)); data = xalloc (narcs * sizeof (struct arcData));
if (!data) if (!data)
return (miPolyArcPtr)NULL; return NULL;
arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); arcs = xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
if (!arcs) if (!arcs)
{ {
xfree(data); xfree(data);
return (miPolyArcPtr)NULL; return NULL;
} }
for (i = 0; i < narcs; i++) { for (i = 0; i < narcs; i++) {
a0 = todeg (parcs[i].angle1); a0 = todeg (parcs[i].angle1);
@ -2255,7 +2254,7 @@ miComputeArcs (
arcfail: arcfail:
miFreeArcs(arcs, pGC); miFreeArcs(arcs, pGC);
xfree(data); xfree(data);
return (miPolyArcPtr)NULL; return NULL;
} }
static double static double
@ -3111,7 +3110,7 @@ realAllocSpan (void)
struct finalSpan *span; struct finalSpan *span;
int i; int i;
newChunk = (struct finalSpanChunk *) xalloc (sizeof (struct finalSpanChunk)); newChunk = xalloc (sizeof (struct finalSpanChunk));
if (!newChunk) if (!newChunk)
return (struct finalSpan *) NULL; return (struct finalSpan *) NULL;
newChunk->next = chunks; newChunk->next = chunks;
@ -3158,8 +3157,8 @@ fillSpans (
if (nspans == 0) if (nspans == 0)
return; return;
xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec)); xSpan = xSpans = xalloc (nspans * sizeof (DDXPointRec));
xWidth = xWidths = (int *) xalloc (nspans * sizeof (int)); xWidth = xWidths = xalloc (nspans * sizeof (int));
if (xSpans && xWidths) if (xSpans && xWidths)
{ {
i = 0; i = 0;
@ -3216,10 +3215,9 @@ realFindSpan (int y)
else else
change = SPAN_REALLOC; change = SPAN_REALLOC;
newSize = finalSize + change; newSize = finalSize + change;
newSpans = (struct finalSpan **) xalloc newSpans = xalloc(newSize * sizeof (struct finalSpan *));
(newSize * sizeof (struct finalSpan *));
if (!newSpans) if (!newSpans)
return (struct finalSpan **)NULL; return NULL;
newMiny = finalMiny; newMiny = finalMiny;
newMaxy = finalMaxy; newMaxy = finalMaxy;
if (y < finalMiny) if (y < finalMiny)

View File

@ -171,8 +171,7 @@ typedef struct _miBankQueue
(*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \ (*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \
(pScreenPriv->BankInfo.BankSize * (_no))) (pScreenPriv->BankInfo.BankSize * (_no)))
#define xalloc_ARRAY(atype, ntype) \ #define xalloc_ARRAY(atype, ntype) xalloc((ntype) * sizeof(atype))
(atype *)xalloc((ntype) * sizeof(atype))
static int miBankScreenKeyIndex; static int miBankScreenKeyIndex;
static DevPrivateKey miBankScreenKey = &miBankScreenKeyIndex; static DevPrivateKey miBankScreenKey = &miBankScreenKeyIndex;
@ -955,7 +954,7 @@ miBankCopy(
paddedWidth = PixmapBytePad(maxWidth, paddedWidth = PixmapBytePad(maxWidth,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pImage = (char *)xalloc(paddedWidth * maxHeight); pImage = xalloc(paddedWidth * maxHeight);
pGC->fExpose = FALSE; pGC->fExpose = FALSE;
@ -1750,7 +1749,7 @@ miBankGetImage(
paddedWidth = PixmapBytePad(w, paddedWidth = PixmapBytePad(w,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pBankImage = (char *)xalloc(paddedWidth * h); pBankImage = xalloc(paddedWidth * h);
if (pBankImage) if (pBankImage)
{ {
@ -1811,7 +1810,7 @@ miBankGetSpans(
paddedWidth = paddedWidth =
PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width, PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pBankImage = (char *)xalloc(paddedWidth); pBankImage = xalloc(paddedWidth);
if (pBankImage) if (pBankImage)
{ {

View File

@ -104,7 +104,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
/* If the destination isn't realized, this is easy */ /* If the destination isn't realized, this is easy */
if (pDstDrawable->type == DRAWABLE_WINDOW && if (pDstDrawable->type == DRAWABLE_WINDOW &&
!((WindowPtr)pDstDrawable)->realized) !((WindowPtr)pDstDrawable)->realized)
return (RegionPtr)NULL; return NULL;
/* clip the source */ /* clip the source */
if (pSrcDrawable->type == DRAWABLE_PIXMAP) if (pSrcDrawable->type == DRAWABLE_PIXMAP)
@ -143,14 +143,11 @@ miCopyArea(DrawablePtr pSrcDrawable,
dsty += pDstDrawable->y; dsty += pDstDrawable->y;
} }
pptFirst = ppt = (DDXPointPtr) pptFirst = ppt = xalloc(heightSrc * sizeof(DDXPointRec));
xalloc(heightSrc * sizeof(DDXPointRec)); pwidthFirst = pwidth = xalloc(heightSrc * sizeof(unsigned int));
pwidthFirst = pwidth = (unsigned int *)
xalloc(heightSrc * sizeof(unsigned int));
numRects = REGION_NUM_RECTS(prgnSrcClip); numRects = REGION_NUM_RECTS(prgnSrcClip);
boxes = REGION_RECTS(prgnSrcClip); boxes = REGION_RECTS(prgnSrcClip);
ordering = (unsigned int *) ordering = xalloc(numRects * sizeof(unsigned int));
xalloc(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering) if(!pptFirst || !pwidthFirst || !ordering)
{ {
if (ordering) if (ordering)
@ -159,7 +156,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
xfree(pwidthFirst); xfree(pwidthFirst);
if (pptFirst) if (pptFirst)
xfree(pptFirst); xfree(pptFirst);
return (RegionPtr)NULL; return NULL;
} }
/* If not the same drawable then order of move doesn't matter. /* If not the same drawable then order of move doesn't matter.
@ -238,8 +235,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
ppt++->y = y++; ppt++->y = y++;
*pwidth++ = width; *pwidth++ = width;
} }
pbits = (unsigned int *)xalloc(height * PixmapBytePad(width, pbits = xalloc(height * PixmapBytePad(width, pSrcDrawable->depth));
pSrcDrawable->depth));
if (pbits) if (pbits)
{ {
(*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst, (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst,
@ -319,7 +315,7 @@ miGetPlane(
if(!result) if(!result)
result = xcalloc(h, widthInBytes); result = xcalloc(h, widthInBytes);
if (!result) if (!result)
return (MiBits *)NULL; return NULL;
bitsPerPixel = pDraw->bitsPerPixel; bitsPerPixel = pDraw->bitsPerPixel;
pOut = (OUT_TYPE *) result; pOut = (OUT_TYPE *) result;
if(bitsPerPixel == 1) if(bitsPerPixel == 1)
@ -433,8 +429,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
ValidateGC((DrawablePtr)pPixmap, pGCT); ValidateGC((DrawablePtr)pPixmap, pGCT);
miClearDrawable((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT);
ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec)); ppt = pptFirst = xalloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int)); pwidth = pwidthFirst = xalloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) xfree(pwidthFirst); if (pwidthFirst) xfree(pwidthFirst);
@ -651,7 +647,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
int i, linelength, width, srcx, srcy; int i, linelength, width, srcx, srcy;
DDXPointRec pt = {0, 0}; DDXPointRec pt = {0, 0};
XID gcv[2]; XID gcv[2];
PixmapPtr pPixmap = (PixmapPtr)NULL; PixmapPtr pPixmap = NULL;
GCPtr pGC = NULL; GCPtr pGC = NULL;
depth = pDraw->depth; depth = pDraw->depth;
@ -802,8 +798,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
break; break;
case ZPixmap: case ZPixmap:
ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec)); ppt = pptFirst = xalloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int)); pwidth = pwidthFirst = xalloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) if (pwidthFirst)

View File

@ -398,7 +398,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
miVisualsPtr new, *prev, v; miVisualsPtr new, *prev, v;
int count; int count;
new = (miVisualsPtr) xalloc (sizeof *new); new = xalloc (sizeof *new);
if (!new) if (!new)
return FALSE; return FALSE;
if (!redMask || !greenMask || !blueMask) if (!redMask || !greenMask || !blueMask)
@ -539,9 +539,9 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
ndepth++; ndepth++;
nvisual += visuals->count; nvisual += visuals->count;
} }
depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec)); depth = xalloc (ndepth * sizeof (DepthRec));
visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec)); visual = xalloc (nvisual * sizeof (VisualRec));
preferredCVCs = (int *)xalloc(ndepth * sizeof(int)); preferredCVCs = xalloc(ndepth * sizeof(int));
if (!depth || !visual || !preferredCVCs) if (!depth || !visual || !preferredCVCs)
{ {
xfree (depth); xfree (depth);
@ -565,7 +565,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
vid = NULL; vid = NULL;
if (nvtype) if (nvtype)
{ {
vid = (VisualID *) xalloc (nvtype * sizeof (VisualID)); vid = xalloc (nvtype * sizeof (VisualID));
if (!vid) { if (!vid) {
xfree(preferredCVCs); xfree(preferredCVCs);
return FALSE; return FALSE;

View File

@ -140,7 +140,7 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{ {
miDCScreenPtr pScreenPriv; miDCScreenPtr pScreenPriv;
pScreenPriv = (miDCScreenPtr) xalloc (sizeof (miDCScreenRec)); pScreenPriv = xalloc (sizeof (miDCScreenRec));
if (!pScreenPriv) if (!pScreenPriv)
return FALSE; return FALSE;
@ -229,9 +229,9 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
GCPtr pGC; GCPtr pGC;
XID gcvals[3]; XID gcvals[3];
pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec)); pPriv = xalloc (sizeof (miDCCursorRec));
if (!pPriv) if (!pPriv)
return (miDCCursorPtr)NULL; return NULL;
#ifdef ARGB_CURSOR #ifdef ARGB_CURSOR
if (pCursor->bits->argb) if (pCursor->bits->argb)
{ {
@ -243,7 +243,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
if (!pFormat) if (!pFormat)
{ {
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
pPriv->sourceBits = 0; pPriv->sourceBits = 0;
@ -254,14 +254,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
if (!pPixmap) if (!pPixmap)
{ {
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
pGC = GetScratchGC (32, pScreen); pGC = GetScratchGC (32, pScreen);
if (!pGC) if (!pGC)
{ {
(*pScreen->DestroyPixmap) (pPixmap); (*pScreen->DestroyPixmap) (pPixmap);
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
ValidateGC (&pPixmap->drawable, pGC); ValidateGC (&pPixmap->drawable, pGC);
(*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32,
@ -275,7 +275,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
if (!pPriv->pPicture) if (!pPriv->pPicture)
{ {
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv); dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
return pPriv; return pPriv;
@ -286,14 +286,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
if (!pPriv->sourceBits) if (!pPriv->sourceBits)
{ {
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
if (!pPriv->maskBits) if (!pPriv->maskBits)
{ {
(*pScreen->DestroyPixmap) (pPriv->sourceBits); (*pScreen->DestroyPixmap) (pPriv->sourceBits);
xfree ((pointer) pPriv); xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL; return NULL;
} }
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv); dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
@ -303,7 +303,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
if (!pGC) if (!pGC)
{ {
(void) miDCUnrealizeCursor (pScreen, pCursor); (void) miDCUnrealizeCursor (pScreen, pCursor);
return (miDCCursorPtr)NULL; return NULL;
} }
ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC);

View File

@ -207,7 +207,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
box.y2 = pSrcDrawable->height; box.y2 = pSrcDrawable->height;
prgnSrcClip = &rgnSrcRec; prgnSrcClip = &rgnSrcRec;
REGION_INIT(pscr, prgnSrcClip, &box, 1); REGION_INIT(pscr, prgnSrcClip, &box, 1);
pSrcWin = (WindowPtr)NULL; pSrcWin = NULL;
} }
if (pDstDrawable == pSrcDrawable) if (pDstDrawable == pSrcDrawable)
@ -354,7 +354,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
pBox = REGION_RECTS(pRgn); pBox = REGION_RECTS(pRgn);
if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent)))) if(!(pEvent = xalloc(numRects * sizeof(xEvent))))
return; return;
pe = pEvent; pe = pEvent;
@ -397,7 +397,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
pBox = REGION_RECTS(pRgn); pBox = REGION_RECTS(pRgn);
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent)))) if(!(pEvent = xalloc(numRects * sizeof(xEvent))))
return; return;
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
@ -600,8 +600,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
} }
prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) * prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
sizeof(xRectangle));
if (!prect) if (!prect)
return; return;

View File

@ -546,10 +546,10 @@ miFillEllipseI(
int *widths; int *widths;
int *wids; int *wids;
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height); points = xalloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)xalloc(sizeof(int) * arc->height); widths = xalloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
xfree(points); xfree(points);
@ -589,10 +589,10 @@ miFillEllipseD(
int *widths; int *widths;
int *wids; int *wids;
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height); points = xalloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)xalloc(sizeof(int) * arc->height); widths = xalloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
xfree(points); xfree(points);
@ -661,10 +661,10 @@ miFillArcSliceI(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw); points = xalloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)xalloc(sizeof(int) * slw); widths = xalloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
xfree(points); xfree(points);
@ -725,10 +725,10 @@ miFillArcSliceD(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw); points = xalloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)xalloc(sizeof(int) * slw); widths = xalloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
xfree(points); xfree(points);

View File

@ -107,8 +107,8 @@ miPolyFillRect(
maxheight = max(maxheight, prect->height); maxheight = max(maxheight, prect->height);
} }
pptFirst = (DDXPointPtr) xalloc(maxheight * sizeof(DDXPointRec)); pptFirst = xalloc(maxheight * sizeof(DDXPointRec));
pwFirst = (int *) xalloc(maxheight * sizeof(int)); pwFirst = xalloc(maxheight * sizeof(int));
if(!pptFirst || !pwFirst) if(!pptFirst || !pwFirst)
{ {
if (pwFirst) xfree(pwFirst); if (pwFirst) xfree(pwFirst);

View File

@ -116,9 +116,9 @@ miFillSppPoly(
y = ymax - ymin + 1; y = ymax - ymin + 1;
if ((count < 3) || (y <= 0)) if ((count < 3) || (y <= 0))
return; return;
ptsOut = FirstPoint = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * y); ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec) * y);
width = FirstWidth = (int *) xalloc(sizeof(int) * y); width = FirstWidth = xalloc(sizeof(int) * y);
Marked = (int *) xalloc(sizeof(int) * count); Marked = xalloc(sizeof(int) * count);
if(!ptsOut || !width || !Marked) if(!ptsOut || !width || !Marked)
{ {

View File

@ -141,7 +141,7 @@ miPolyGlyphBlt(
DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
nbyLine = BitmapBytePad(width); nbyLine = BitmapBytePad(width);
pbits = (unsigned char *)xalloc(height*nbyLine); pbits = xalloc(height*nbyLine);
if (!pbits) if (!pbits)
{ {
(*pDrawable->pScreen->DestroyPixmap)(pPixmap); (*pDrawable->pScreen->DestroyPixmap)(pPixmap);

View File

@ -900,7 +900,7 @@ miOverlayHandleExposures(WindowPtr pWin)
REGION_UNINIT(pScreen, &val->after.borderExposed); REGION_UNINIT(pScreen, &val->after.borderExposed);
REGION_UNINIT(pScreen, &val->after.exposed); REGION_UNINIT(pScreen, &val->after.exposed);
xfree(val); xfree(val);
pChild->valdata = (ValidatePtr)NULL; pChild->valdata = NULL;
if (pChild->firstChild) if (pChild->firstChild)
{ {
pChild = pChild->firstChild; pChild = pChild->firstChild;

View File

@ -88,7 +88,7 @@ miPointerInitialize (ScreenPtr pScreen,
{ {
miPointerScreenPtr pScreenPriv; miPointerScreenPtr pScreenPriv;
pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec)); pScreenPriv = xalloc (sizeof (miPointerScreenRec));
if (!pScreenPriv) if (!pScreenPriv)
return FALSE; return FALSE;
pScreenPriv->spriteFuncs = spriteFuncs; pScreenPriv->spriteFuncs = spriteFuncs;

View File

@ -105,8 +105,8 @@ miFillConvexPoly(
dy = ymax - ymin + 1; dy = ymax - ymin + 1;
if ((count < 3) || (dy < 0)) if ((count < 3) || (dy < 0))
return(TRUE); return(TRUE);
ptsOut = FirstPoint = (DDXPointPtr )xalloc(sizeof(DDXPointRec)*dy); ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec)*dy);
width = FirstWidth = (int *)xalloc(sizeof(int) * dy); width = FirstWidth = xalloc(sizeof(int) * dy);
if(!FirstPoint || !FirstWidth) if(!FirstPoint || !FirstWidth)
{ {
if (FirstWidth) xfree(FirstWidth); if (FirstWidth) xfree(FirstWidth);

View File

@ -92,8 +92,7 @@ miFillGeneralPoly(
if (count < 3) if (count < 3)
return(TRUE); return(TRUE);
if(!(pETEs = (EdgeTableEntry *) if(!(pETEs = xalloc(sizeof(EdgeTableEntry) * count)))
xalloc(sizeof(EdgeTableEntry) * count)))
return(FALSE); return(FALSE);
ptsOut = FirstPoint; ptsOut = FirstPoint;
width = FirstWidth; width = FirstWidth;

View File

@ -107,7 +107,7 @@ miPolyPoint(
DoChangeGC(pGC, GCFillStyle, &fsNew, 0); DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
} }
if(!(pwidthInit = (int *)xalloc(npt * sizeof(int)))) if(!(pwidthInit = xalloc(npt * sizeof(int))))
return; return;
pwidth = pwidthInit; pwidth = pwidthInit;
for(i = 0; i < npt; i++) for(i = 0; i < npt; i++)

View File

@ -90,7 +90,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
offset2 = pGC->lineWidth; offset2 = pGC->lineWidth;
offset1 = offset2 >> 1; offset1 = offset2 >> 1;
offset3 = offset2 - offset1; offset3 = offset2 - offset1;
tmp = (xRectangle *) xalloc(ntmp * sizeof (xRectangle)); tmp = xalloc(ntmp * sizeof (xRectangle));
if (!tmp) if (!tmp)
return; return;
t = tmp; t = tmp;

View File

@ -99,19 +99,18 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
{ {
if (*iSLLBlock > SLLSPERBLOCK-1) if (*iSLLBlock > SLLSPERBLOCK-1)
{ {
tmpSLLBlock = tmpSLLBlock = xalloc(sizeof(ScanLineListBlock));
(ScanLineListBlock *)xalloc(sizeof(ScanLineListBlock));
if (!tmpSLLBlock) if (!tmpSLLBlock)
return FALSE; return FALSE;
(*SLLBlock)->next = tmpSLLBlock; (*SLLBlock)->next = tmpSLLBlock;
tmpSLLBlock->next = (ScanLineListBlock *)NULL; tmpSLLBlock->next = NULL;
*SLLBlock = tmpSLLBlock; *SLLBlock = tmpSLLBlock;
*iSLLBlock = 0; *iSLLBlock = 0;
} }
pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
pSLL->next = pPrevSLL->next; pSLL->next = pPrevSLL->next;
pSLL->edgelist = (EdgeTableEntry *)NULL; pSLL->edgelist = NULL;
pPrevSLL->next = pSLL; pPrevSLL->next = pSLL;
} }
pSLL->scanline = scanline; pSLL->scanline = scanline;
@ -119,7 +118,7 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
/* /*
* now insert the edge in the right bucket * now insert the edge in the right bucket
*/ */
prev = (EdgeTableEntry *)NULL; prev = NULL;
start = pSLL->edgelist; start = pSLL->edgelist;
while (start && (start->bres.minor < ETE->bres.minor)) while (start && (start->bres.minor < ETE->bres.minor))
{ {
@ -175,18 +174,18 @@ miCreateETandAET(int count, DDXPointPtr pts, EdgeTable *ET, EdgeTableEntry *AET,
/* /*
* initialize the Active Edge Table * initialize the Active Edge Table
*/ */
AET->next = (EdgeTableEntry *)NULL; AET->next = NULL;
AET->back = (EdgeTableEntry *)NULL; AET->back = NULL;
AET->nextWETE = (EdgeTableEntry *)NULL; AET->nextWETE = NULL;
AET->bres.minor = MININT; AET->bres.minor = MININT;
/* /*
* initialize the Edge Table. * initialize the Edge Table.
*/ */
ET->scanlines.next = (ScanLineList *)NULL; ET->scanlines.next = NULL;
ET->ymax = MININT; ET->ymax = MININT;
ET->ymin = MAXINT; ET->ymin = MAXINT;
pSLLBlock->next = (ScanLineListBlock *)NULL; pSLLBlock->next = NULL;
PrevPt = &pts[count-1]; PrevPt = &pts[count-1];
@ -305,7 +304,7 @@ micomputeWAET(EdgeTableEntry *AET)
int inside = 1; int inside = 1;
int isInside = 0; int isInside = 0;
AET->nextWETE = (EdgeTableEntry *)NULL; AET->nextWETE = NULL;
pWETE = AET; pWETE = AET;
AET = AET->next; AET = AET->next;
while (AET) while (AET)
@ -324,7 +323,7 @@ micomputeWAET(EdgeTableEntry *AET)
} }
AET = AET->next; AET = AET->next;
} }
pWETE->nextWETE = (EdgeTableEntry *)NULL; pWETE->nextWETE = NULL;
} }
/* /*

View File

@ -123,7 +123,7 @@ miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
LONG2CHARSDIFFORDER((MiBits)(-1) >> 1); LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
#endif #endif
pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx)); pwLineStart = xalloc(BitmapBytePad(dx));
if (!pwLineStart) if (!pwLineStart)
return; return;
ipt = 0; ipt = 0;

View File

@ -171,7 +171,7 @@ Equipment Corporation.
((r1)->y1 <= (r2)->y1) && \ ((r1)->y1 <= (r2)->y1) && \
((r1)->y2 >= (r2)->y2) ) ((r1)->y2 >= (r2)->y2) )
#define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n)) #define xallocData(n) xalloc(REGION_SZOF(n))
#define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data)
#define RECTALLOC_BAIL(pReg,n,bail) \ #define RECTALLOC_BAIL(pReg,n,bail) \
@ -654,7 +654,7 @@ miRegionOp(
assert(r1 != r1End); assert(r1 != r1End);
assert(r2 != r2End); assert(r2 != r2End);
oldData = (RegDataPtr)NULL; oldData = NULL;
if (((newReg == reg1) && (newSize > 1)) || if (((newReg == reg1) && (newSize > 1)) ||
((newReg == reg2) && (numRects > 1))) ((newReg == reg2) && (numRects > 1)))
{ {
@ -808,7 +808,7 @@ miRegionOp(
{ {
newReg->extents = *REGION_BOXPTR(newReg); newReg->extents = *REGION_BOXPTR(newReg);
xfreeData(newReg); xfreeData(newReg);
newReg->data = (RegDataPtr)NULL; newReg->data = NULL;
} }
else else
{ {
@ -1039,7 +1039,7 @@ miRegionAppend(RegionPtr dstrgn, RegionPtr rgn)
if (!rgn->data && (dstrgn->data == &miEmptyData)) if (!rgn->data && (dstrgn->data == &miEmptyData))
{ {
dstrgn->extents = rgn->extents; dstrgn->extents = rgn->extents;
dstrgn->data = (RegDataPtr)NULL; dstrgn->data = NULL;
return TRUE; return TRUE;
} }
@ -1343,7 +1343,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
rit->prevBand = 0; rit->prevBand = 0;
rit->curBand = 0; rit->curBand = 0;
rit->reg.extents = *box; rit->reg.extents = *box;
rit->reg.data = (RegDataPtr)NULL; rit->reg.data = NULL;
if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
goto bail; goto bail;
NextRect: ; NextRect: ;
@ -1362,7 +1362,7 @@ NextRect: ;
if (reg->data->numRects == 1) /* keep unions happy below */ if (reg->data->numRects == 1) /* keep unions happy below */
{ {
xfreeData(reg); xfreeData(reg);
reg->data = (RegDataPtr)NULL; reg->data = NULL;
} }
} }
@ -1428,7 +1428,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
pRgn->extents.y1 = y1; pRgn->extents.y1 = y1;
pRgn->extents.x2 = x2; pRgn->extents.x2 = x2;
pRgn->extents.y2 = y2; pRgn->extents.y2 = y2;
pRgn->data = (RegDataPtr)NULL; pRgn->data = NULL;
} }
return pRgn; return pRgn;
} }

View File

@ -180,7 +180,7 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
* to the screen, until CreateScreenResources can put them in the * to the screen, until CreateScreenResources can put them in the
* screen pixmap. * screen pixmap.
*/ */
pScrInitParms = (miScreenInitParmsPtr)xalloc(sizeof(miScreenInitParmsRec)); pScrInitParms = xalloc(sizeof(miScreenInitParmsRec));
if (!pScrInitParms) if (!pScrInitParms)
return FALSE; return FALSE;
pScrInitParms->pbits = pbits; pScrInitParms->pbits = pbits;

View File

@ -405,8 +405,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
ylength = spanGroup->ymax - ymin + 1; ylength = spanGroup->ymax - ymin + 1;
/* Allocate Spans for y buckets */ /* Allocate Spans for y buckets */
yspans = (Spans *) xalloc(ylength * sizeof(Spans)); yspans = xalloc(ylength * sizeof(Spans));
ysizes = (int *) xalloc(ylength * sizeof (int)); ysizes = xalloc(ylength * sizeof (int));
if (!yspans || !ysizes) if (!yspans || !ysizes)
{ {
@ -479,8 +479,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
} /* for i thorough Spans */ } /* for i thorough Spans */
/* Now sort by x and uniquify each bucket into the final array */ /* Now sort by x and uniquify each bucket into the final array */
points = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec)); points = xalloc(count * sizeof(DDXPointRec));
widths = (int *) xalloc(count * sizeof(int)); widths = xalloc(count * sizeof(int));
if (!points || !widths) if (!points || !widths)
{ {
int i; int i;

View File

@ -226,7 +226,7 @@ miSpriteInitialize (ScreenPtr pScreen,
if (!DamageSetup (pScreen)) if (!DamageSetup (pScreen))
return FALSE; return FALSE;
pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); pScreenPriv = xalloc (sizeof (miSpriteScreenRec));
if (!pScreenPriv) if (!pScreenPriv)
return FALSE; return FALSE;

View File

@ -769,7 +769,7 @@ miValidateTree (
if (pScreen->ClipNotify) if (pScreen->ClipNotify)
(* pScreen->ClipNotify) (pWin, 0, 0); (* pScreen->ClipNotify) (pWin, 0, 0);
REGION_EMPTY( pScreen, &pWin->borderClip); REGION_EMPTY( pScreen, &pWin->borderClip);
pWin->valdata = (ValidatePtr)NULL; pWin->valdata = NULL;
} }
} }
} }

View File

@ -95,10 +95,10 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
if (!spanData) if (!spanData)
{ {
pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt)); pptInit = xalloc (overall_height * sizeof(*ppt));
if (!pptInit) if (!pptInit)
return; return;
pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth)); pwidthInit = xalloc (overall_height * sizeof(*pwidth));
if (!pwidthInit) if (!pwidthInit)
{ {
xfree (pptInit); xfree (pptInit);
@ -116,10 +116,10 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
} }
else else
{ {
spanRec.points = (DDXPointPtr) xalloc (overall_height * sizeof (*ppt)); spanRec.points = xalloc (overall_height * sizeof (*ppt));
if (!spanRec.points) if (!spanRec.points)
return; return;
spanRec.widths = (int *) xalloc (overall_height * sizeof (int)); spanRec.widths = xalloc (overall_height * sizeof (int));
if (!spanRec.widths) if (!spanRec.widths)
{ {
xfree (spanRec.points); xfree (spanRec.points);
@ -221,10 +221,10 @@ miFillRectPolyHelper (
} }
else else
{ {
spanRec.points = (DDXPointPtr) xalloc (h * sizeof (*ppt)); spanRec.points = xalloc (h * sizeof (*ppt));
if (!spanRec.points) if (!spanRec.points)
return; return;
spanRec.widths = (int *) xalloc (h * sizeof (int)); spanRec.widths = xalloc (h * sizeof (int));
if (!spanRec.widths) if (!spanRec.widths)
{ {
xfree (spanRec.points); xfree (spanRec.points);
@ -1045,10 +1045,10 @@ miLineArc (
} }
if (!spanData) if (!spanData)
{ {
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth); points = xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
if (!points) if (!points)
return; return;
widths = (int *)xalloc(sizeof(int) * pGC->lineWidth); widths = xalloc(sizeof(int) * pGC->lineWidth);
if (!widths) if (!widths)
{ {
xfree(points); xfree(points);
@ -1064,10 +1064,10 @@ miLineArc (
} }
else else
{ {
points = (DDXPointPtr) xalloc (pGC->lineWidth * sizeof (DDXPointRec)); points = xalloc (pGC->lineWidth * sizeof (DDXPointRec));
if (!points) if (!points)
return; return;
widths = (int *) xalloc (pGC->lineWidth * sizeof (int)); widths = xalloc (pGC->lineWidth * sizeof (int));
if (!widths) if (!widths)
{ {
xfree (points); xfree (points);

View File

@ -245,7 +245,7 @@ miHandleValidateExposures(WindowPtr pWin)
(*WindowExposures)(pChild, &val->after.exposed, NullRegion); (*WindowExposures)(pChild, &val->after.exposed, NullRegion);
REGION_UNINIT(pScreen, &val->after.exposed); REGION_UNINIT(pScreen, &val->after.exposed);
xfree(val); xfree(val);
pChild->valdata = (ValidatePtr)NULL; pChild->valdata = NULL;
if (pChild->firstChild) if (pChild->firstChild)
{ {
pChild = pChild->firstChild; pChild = pChild->firstChild;
@ -305,10 +305,10 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
{ {
if (pLayerWin == pWin) if (pLayerWin == pWin)
anyMarked |= (*pScreen->MarkOverlappedWindows) anyMarked |= (*pScreen->MarkOverlappedWindows)
(pWin, windowToValidate, (WindowPtr *)NULL); (pWin, windowToValidate, NULL);
else else
anyMarked |= (*pScreen->MarkOverlappedWindows) anyMarked |= (*pScreen->MarkOverlappedWindows)
(pWin, pLayerWin, (WindowPtr *)NULL); (pWin, pLayerWin, NULL);
if (anyMarked) if (anyMarked)
@ -500,10 +500,10 @@ miSlideAndSizeWindow(WindowPtr pWin,
if (pLayerWin == pWin) if (pLayerWin == pWin)
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
(WindowPtr *)NULL); NULL);
else else
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
(WindowPtr *)NULL); NULL);
if (pWin->valdata) if (pWin->valdata)
{ {
@ -729,7 +729,7 @@ miSetShape(WindowPtr pWin)
if (WasViewable) if (WasViewable)
{ {
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
(WindowPtr *)NULL); NULL);
if (anyMarked) if (anyMarked)

View File

@ -737,7 +737,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
dospans = (pGC->fillStyle != FillSolid); dospans = (pGC->fillStyle != FillSolid);
if (dospans) if (dospans)
{ {
widths = (int *)xalloc(sizeof(int) * numPts); widths = xalloc(sizeof(int) * numPts);
if (!widths) if (!widths)
return; return;
maxw = 0; maxw = 0;
@ -754,7 +754,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
(unsigned char *) pGC->dash, (int)pGC->numInDashList, (unsigned char *) pGC->dash, (int)pGC->numInDashList,
&dinfo.dashOffsetInit); &dinfo.dashOffsetInit);
} }
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * numPts); points = xalloc(sizeof(DDXPointRec) * numPts);
if (!points) if (!points)
{ {
if (dospans) if (dospans)

View File

@ -155,8 +155,8 @@ miZeroLine(
width = xright - xleft + 1; width = xright - xleft + 1;
height = ybottom - ytop + 1; height = ybottom - ytop + 1;
list_len = (height >= width) ? height : width; list_len = (height >= width) ? height : width;
pspanInit = (DDXPointPtr)xalloc(list_len * sizeof(DDXPointRec)); pspanInit = xalloc(list_len * sizeof(DDXPointRec));
pwidthInit = (int *)xalloc(list_len * sizeof(int)); pwidthInit = xalloc(list_len * sizeof(int));
if (!pspanInit || !pwidthInit) if (!pspanInit || !pwidthInit)
return; return;

View File

@ -484,7 +484,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec))) if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec)))
return; return;
pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); pScreenPriv = xalloc(sizeof(cwScreenRec));
if (!pScreenPriv) if (!pScreenPriv)
return; return;

View File

@ -1514,7 +1514,7 @@ damageText (DrawablePtr pDrawable,
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
charinfo = (CharInfoPtr *) xalloc(count * sizeof(CharInfoPtr)); charinfo = xalloc(count * sizeof(CharInfoPtr));
if (!charinfo) if (!charinfo)
return x; return x;
@ -1873,7 +1873,7 @@ DamageSetup (ScreenPtr pScreen)
if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec))) if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec)))
return FALSE; return FALSE;
pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec)); pScrPriv = xalloc (sizeof (DamageScrPrivRec));
if (!pScrPriv) if (!pScrPriv)
return FALSE; return FALSE;

View File

@ -624,7 +624,7 @@ RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */
if (pScreen->ClipNotify) if (pScreen->ClipNotify)
(* pScreen->ClipNotify) (pWin, 0, 0); (* pScreen->ClipNotify) (pWin, 0, 0);
REGION_EMPTY( pScreen, &pWin->borderClip); REGION_EMPTY( pScreen, &pWin->borderClip);
pWin->valdata = (ValidatePtr)NULL; pWin->valdata = NULL;
} }
} }
} }

View File

@ -139,7 +139,7 @@ shadowSetup(ScreenPtr pScreen)
if (!DamageSetup(pScreen)) if (!DamageSetup(pScreen))
return FALSE; return FALSE;
pBuf = (shadowBufPtr) xalloc(sizeof(shadowBufRec)); pBuf = xalloc(sizeof(shadowBufRec));
if (!pBuf) if (!pBuf)
return FALSE; return FALSE;
#ifdef BACKWARDS_COMPATIBILITY #ifdef BACKWARDS_COMPATIBILITY

View File

@ -430,7 +430,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
if (!timer) if (!timer)
{ {
timer = (OsTimerPtr)xalloc(sizeof(struct _OsTimerRec)); timer = xalloc(sizeof(struct _OsTimerRec));
if (!timer) if (!timer)
return NULL; return NULL;
} }

View File

@ -216,7 +216,7 @@ typedef struct _host {
int requested; int requested;
} HOST; } HOST;
#define MakeHost(h,l) (h)=(HOST *) xalloc(sizeof *(h)+(l));\ #define MakeHost(h,l) (h)=xalloc(sizeof *(h)+(l));\
if (h) { \ if (h) { \
(h)->addr=(unsigned char *) ((h) + 1);\ (h)->addr=(unsigned char *) ((h) + 1);\
(h)->requested = FALSE; \ (h)->requested = FALSE; \
@ -1109,12 +1109,12 @@ Bool LocalClient(ClientPtr client)
&alen, (pointer *)&addr); &alen, (pointer *)&addr);
if (family == -1) if (family == -1)
{ {
xfree ((char *) from); xfree (from);
return FALSE; return FALSE;
} }
if (family == FamilyLocal) if (family == FamilyLocal)
{ {
xfree ((char *) from); xfree (from);
return TRUE; return TRUE;
} }
for (host = selfhosts; host; host = host->next) for (host = selfhosts; host; host = host->next)
@ -1122,7 +1122,7 @@ Bool LocalClient(ClientPtr client)
if (addrEqual (family, addr, alen, host)) if (addrEqual (family, addr, alen, host))
return TRUE; return TRUE;
} }
xfree ((char *) from); xfree (from);
} }
return FALSE; return FALSE;
} }
@ -1462,7 +1462,7 @@ GetHosts (
} }
if (n) if (n)
{ {
*data = ptr = (pointer) xalloc (n); *data = ptr = xalloc (n);
if (!ptr) if (!ptr)
{ {
return(BadAlloc); return(BadAlloc);
@ -1721,7 +1721,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
} }
} }
s = (struct siType *) xalloc(sizeof(struct siType)); s = xalloc(sizeof(struct siType));
if (s == NULL) if (s == NULL)
return BadAlloc; return BadAlloc;

View File

@ -227,7 +227,7 @@ void SetConnectionTranslation(int conn, int client)
} }
node = &((*node)->next); node = &((*node)->next);
} }
*node = (struct _ct_node*)xalloc(sizeof(struct _ct_node)); *node = xalloc(sizeof(struct _ct_node));
(*node)->next = NULL; (*node)->next = NULL;
(*node)->key = conn; (*node)->key = conn;
(*node)->value = client; (*node)->value = client;
@ -407,7 +407,7 @@ CreateWellKnownSockets(void)
} }
else else
{ {
ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int)); ListenTransFds = xalloc (ListenTransCount * sizeof (int));
for (i = 0; i < ListenTransCount; i++) for (i = 0; i < ListenTransCount; i++)
{ {
@ -689,7 +689,7 @@ ClientAuthorized(ClientPtr client,
proto_n, auth_proto, auth_id); proto_n, auth_proto, auth_id);
} }
xfree ((char *) from); xfree (from);
} }
if (auth_id == (XID) ~0L) { if (auth_id == (XID) ~0L) {
@ -711,7 +711,7 @@ ClientAuthorized(ClientPtr client,
AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
proto_n, auth_proto, auth_id); proto_n, auth_proto, auth_id);
xfree ((char *) from); xfree (from);
} }
} }
priv->auth_id = auth_id; priv->auth_id = auth_id;
@ -747,7 +747,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
#endif #endif
) )
return NullClient; return NullClient;
oc = (OsCommPtr)xalloc(sizeof(OsCommRec)); oc = xalloc(sizeof(OsCommRec));
if (!oc) if (!oc)
return NullClient; return NullClient;
oc->trans_conn = trans_conn; oc->trans_conn = trans_conn;

16
os/io.c
View File

@ -1011,14 +1011,14 @@ AllocateInputBuffer(void)
{ {
ConnectionInputPtr oci; ConnectionInputPtr oci;
oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); oci = xalloc(sizeof(ConnectionInput));
if (!oci) if (!oci)
return (ConnectionInputPtr)NULL; return NULL;
oci->buffer = (char *)xalloc(BUFSIZE); oci->buffer = xalloc(BUFSIZE);
if (!oci->buffer) if (!oci->buffer)
{ {
xfree(oci); xfree(oci);
return (ConnectionInputPtr)NULL; return NULL;
} }
oci->size = BUFSIZE; oci->size = BUFSIZE;
oci->bufptr = oci->buffer; oci->bufptr = oci->buffer;
@ -1032,14 +1032,14 @@ AllocateOutputBuffer(void)
{ {
ConnectionOutputPtr oco; ConnectionOutputPtr oco;
oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); oco = xalloc(sizeof(ConnectionOutput));
if (!oco) if (!oco)
return (ConnectionOutputPtr)NULL; return NULL;
oco->buf = (unsigned char *) xcalloc(1, BUFSIZE); oco->buf = xcalloc(1, BUFSIZE);
if (!oco->buf) if (!oco->buf)
{ {
xfree(oco); xfree(oco);
return (ConnectionOutputPtr)NULL; return NULL;
} }
oco->size = BUFSIZE; oco->size = BUFSIZE;
oco->count = 0; oco->count = 0;

View File

@ -55,10 +55,10 @@ MitAddCookie (
{ {
struct auth *new; struct auth *new;
new = (struct auth *) xalloc (sizeof (struct auth)); new = xalloc (sizeof (struct auth));
if (!new) if (!new)
return 0; return 0;
new->data = (char *) xalloc ((unsigned) data_length); new->data = xalloc ((unsigned) data_length);
if (!new->data) { if (!new->data) {
xfree(new); xfree(new);
return 0; return 0;

View File

@ -66,7 +66,7 @@ authdes_ezdecode(char *inmsg, int len)
XDR xdr; XDR xdr;
SVCXPRT xprt; SVCXPRT xprt;
temp_inmsg = (char *) xalloc(len); temp_inmsg = xalloc(len);
memmove(temp_inmsg, inmsg, len); memmove(temp_inmsg, inmsg, len);
memset((char *)&msg, 0, sizeof(msg)); memset((char *)&msg, 0, sizeof(msg));
@ -79,7 +79,7 @@ authdes_ezdecode(char *inmsg, int len)
why = AUTH_FAILED; why = AUTH_FAILED;
xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE);
if ((r.rq_clntcred = (caddr_t) xalloc(MAX_AUTH_BYTES)) == NULL) if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL)
goto bad1; goto bad1;
r.rq_xprt = &xprt; r.rq_xprt = &xprt;

View File

@ -1404,7 +1404,7 @@ Popen(char *command, char *type)
if ((*type != 'r' && *type != 'w') || type[1]) if ((*type != 'r' && *type != 'w') || type[1])
return NULL; return NULL;
if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) if ((cur = xalloc(sizeof(struct pid))) == NULL)
return NULL; return NULL;
if (pipe(pdes) < 0) { if (pipe(pdes) < 0) {
@ -1490,7 +1490,7 @@ Fopen(char *file, char *type)
if ((*type != 'r' && *type != 'w') || type[1]) if ((*type != 'r' && *type != 'w') || type[1])
return NULL; return NULL;
if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) if ((cur = xalloc(sizeof(struct pid))) == NULL)
return NULL; return NULL;
if (pipe(pdes) < 0) { if (pipe(pdes) < 0) {

View File

@ -259,7 +259,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
*reason = "Bad XDM authorization key length"; *reason = "Bad XDM authorization key length";
return NULL; return NULL;
} }
client = (XdmClientAuthPtr) xalloc (sizeof (XdmClientAuthRec)); client = xalloc (sizeof (XdmClientAuthRec));
if (!client) if (!client)
return NULL; return NULL;
XdmClientAuthDecode (plain, client); XdmClientAuthDecode (plain, client);
@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id)
/* the first octet of the key must be zero */ /* the first octet of the key must be zero */
if (key_bits[0] != '\0') if (key_bits[0] != '\0')
return 0; return 0;
new = (XdmAuthorizationPtr) xalloc (sizeof (XdmAuthorizationRec)); new = xalloc (sizeof (XdmAuthorizationRec));
if (!new) if (!new)
return 0; return 0;
new->next = xdmAuth; new->next = xdmAuth;
@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie,
/* Auth packets must be a multiple of 8 bytes long */ /* Auth packets must be a multiple of 8 bytes long */
if (cookie_length & 7) if (cookie_length & 7)
return (XID) -1; return (XID) -1;
plain = (unsigned char *) xalloc (cookie_length); plain = xalloc (cookie_length);
if (!plain) if (!plain)
return (XID) -1; return (XID) -1;
for (auth = xdmAuth; auth; auth=auth->next) { for (auth = xdmAuth; auth; auth=auth->next) {
@ -430,7 +430,7 @@ XdmToID (unsigned short cookie_length, char *cookie)
XdmClientAuthPtr client; XdmClientAuthPtr client;
unsigned char *plain; unsigned char *plain;
plain = (unsigned char *) xalloc (cookie_length); plain = xalloc (cookie_length);
if (!plain) if (!plain)
return (XID) -1; return (XID) -1;
for (auth = xdmAuth; auth; auth=auth->next) { for (auth = xdmAuth; auth; auth=auth->next) {

View File

@ -391,8 +391,7 @@ XdmcpRegisterAuthentication (
AuthenticationNames.length + 1) && AuthenticationNames.length + 1) &&
XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas,
AuthenticationDatas.length + 1) && AuthenticationDatas.length + 1) &&
(newFuncs = (AuthenticationFuncsPtr) xalloc ( (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
(AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
{ {
XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationName);
XdmcpDisposeARRAY8 (&AuthenticationData); XdmcpDisposeARRAY8 (&AuthenticationData);
@ -491,7 +490,7 @@ XdmcpRegisterConnection (
return; return;
} }
} }
newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8)); newAddress = xalloc (addrlen * sizeof (CARD8));
if (!newAddress) if (!newAddress)
return; return;
if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1))
@ -532,7 +531,7 @@ XdmcpRegisterAuthorization (char *name, int namelen)
ARRAY8 authName; ARRAY8 authName;
int i; int i;
authName.data = (CARD8 *) xalloc (namelen * sizeof (CARD8)); authName.data = xalloc (namelen * sizeof (CARD8));
if (!authName.data) if (!authName.data)
return; return;
if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1))