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++)
{
pScreen = screenInfo.screens[i];
if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
if (!(pMultibufferScreen = xalloc (sizeof (MultibufferScreenRec))))
{
for (j = 0; j < i; j++)
xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey));
@ -348,8 +348,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
xRectangle clearRect;
DestroyImageBuffers(pWin);
pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) +
nbuf * sizeof (MultibufferRec));
pMultibuffers = xalloc (sizeof (MultibuffersRec) + nbuf * sizeof (MultibufferRec));
if (!pMultibuffers)
return BadAlloc;
pMultibuffers->pWindow = pWin;
@ -504,8 +503,8 @@ ProcDisplayImageBuffers (client)
return Success;
minDelay = stuff->minDelay;
ids = (XID *) &stuff[1];
ppMultibuffers = (MultibuffersPtr *) xalloc(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) xalloc(nbuf * sizeof (MultibufferPtr));
ppMultibuffers = xalloc(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = xalloc(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer)
{
if (ppMultibuffers) xfree(ppMultibuffers);
@ -645,7 +644,7 @@ ProcGetMBufferAttributes (client)
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadAccess;
ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
ids = xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
if (!ids)
return BadAlloc;
for (i = 0; i < pMultibuffers->numMultibuffer; i++)
@ -782,8 +781,7 @@ ProcGetBufferInfo (client)
pDepth = &pScreen->allowedDepths[i];
nInfo += pDepth->numVids;
}
pInfo = (xMbufBufferInfo *)
xalloc (nInfo * sizeof (xMbufBufferInfo));
pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo)
return BadAlloc;
@ -1264,8 +1262,8 @@ DisplayImageBuffers (ids, nbuf)
MultibuffersPtr *pMultibuffers;
int i, j;
pMultibuffer = (MultibufferPtr *) xalloc (nbuf * sizeof *pMultibuffer +
nbuf * sizeof *pMultibuffers);
pMultibuffer = xalloc (nbuf * sizeof *pMultibuffer +
nbuf * sizeof *pMultibuffers);
if (!pMultibuffer)
return BadAlloc;
pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf);
@ -1390,7 +1388,7 @@ MultibufferExpose (pMultibuffer, pRegion)
numRects = REGION_NUM_RECTS(pRegion);
pBox = REGION_RECTS(pRegion);
pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent));
pEvent = xalloc(numRects * sizeof(xEvent));
if (pEvent) {
pe = pEvent;
@ -1744,7 +1742,7 @@ EventSelectForMultibuffer (pMultibuffer, client, mask)
}
if (!other)
{ /* new client that never selected events on this buffer before */
other = (OtherClients *) xalloc (sizeof (OtherClients));
other = xalloc (sizeof (OtherClients));
if (!other)
return BadAlloc;
other->mask = mask;

View File

@ -221,7 +221,7 @@ bufMultibufferInit(pScreen, pMBScreen)
pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
pMBScreen->ResetProc = bufResetProc;
/* Create devPrivate part */
pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv);
pMBPriv = xalloc(sizeof *pMBPriv);
if (!pMBPriv)
return (FALSE);
@ -611,8 +611,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
if (!pGC)
return;
prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
sizeof(xRectangle));
prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
if (!prect)
{
FreeScratchGC(pGC);

View File

@ -90,7 +90,7 @@ pixMultibufferInit(pScreen, pMBScreen)
nInfo += pDepth->numVids;
}
pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo));
pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo)
return FALSE;
@ -114,7 +114,7 @@ pixMultibufferInit(pScreen, pMBScreen)
* Setup the devPrivate to mbufScreenRec
*/
pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv));
pMBPriv = xalloc(sizeof(* pMBPriv));
if (!pMBPriv)
{
xfree(pInfo);
@ -261,7 +261,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
int nrects = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion);
pRects = (xRectangle *)xalloc(nrects * sizeof(xRectangle));
pRects = xalloc(nrects * sizeof(xRectangle));
if (pRects)
{
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;
newWin->type = XRT_WINDOW;
@ -644,7 +644,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
client, stuff->drawable, XRC_DRAWABLE, DixReadAccess)))
return BadDrawable;
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
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;
newGC->type = XRT_GC;
@ -1256,7 +1256,7 @@ int PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) {
origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
origPts = xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@ -1314,7 +1314,7 @@ int PanoramiXPolyLine(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){
origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
origPts = xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@ -1375,7 +1375,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(nsegs & 4) return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
origSegs = (xSegment *) xalloc(nsegs * sizeof(xSegment));
origSegs = xalloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){
@ -1437,7 +1437,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(nrects & 4) return BadLength;
nrects >>= 3;
if (nrects > 0){
origRecs = (xRectangle *) xalloc(nrects * sizeof(xRectangle));
origRecs = xalloc(nrects * sizeof(xRectangle));
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@ -1497,7 +1497,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0){
origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
origArcs = xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@ -1553,7 +1553,7 @@ int PanoramiXFillPoly(ClientPtr client)
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){
locPts = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec));
locPts = xalloc(count * sizeof(DDXPointRec));
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){
@ -1614,7 +1614,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(things & 4) return BadLength;
things >>= 3;
if (things > 0){
origRects = (xRectangle *) xalloc(things * sizeof(xRectangle));
origRects = xalloc(things * sizeof(xRectangle));
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@ -1673,7 +1673,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
IF_RETURN((narcs % sizeof(xArc)), BadLength);
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
origArcs = xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@ -2071,7 +2071,7 @@ int PanoramiXCreateColormap(ClientPtr client)
client, stuff->window, XRT_WINDOW, DixReadAccess)))
return BadWindow;
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@ -2140,7 +2140,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
DixReadAccess | DixWriteAccess)))
return BadColor;
if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;

View File

@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) ((t *) xalloc (sizeof (t)))
#define New(t) (xalloc (sizeof (t)))
/****************
* ScreenSaverExtensionInit
@ -639,8 +639,7 @@ CreateSaverWindow (ScreenPtr pScreen)
wantMap = wColormap (pWin);
if (wantMap == None)
return TRUE;
installedMaps = (Colormap *) xalloc (pScreen->maxInstalledCmaps *
sizeof (Colormap));
installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps);
for (i = 0; i < numInstalled; i++)
@ -977,7 +976,7 @@ ScreenSaverSetAttributes (ClientPtr client)
goto bail;
}
/* over allocate for override redirect */
values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long));
values = xalloc ((len + 1) * sizeof (unsigned long));
if (!values)
{
ret = BadAlloc;
@ -1379,7 +1378,7 @@ ProcScreenSaverSuspend (ClientPtr client)
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = (ScreenSaverSuspensionPtr) xalloc (sizeof (ScreenSaverSuspensionRec));
this = xalloc (sizeof (ScreenSaverSuspensionRec));
if (!this)
return BadAlloc;

View File

@ -407,7 +407,7 @@ SecurityEventSelectForAuthorization(
}
}
pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
pEventClient = xalloc(sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
@ -539,7 +539,7 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */
pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
pAuth = xalloc(sizeof(SecurityAuthorizationRec));
if (!pAuth)
{
err = BadAlloc;

View File

@ -804,8 +804,7 @@ ProcShapeSelectInput (ClientPtr client)
}
/* build the entry */
pNewShapeEvent = (ShapeEventPtr)
xalloc (sizeof (ShapeEventRec));
pNewShapeEvent = xalloc (sizeof (ShapeEventRec));
if (!pNewShapeEvent)
return BadAlloc;
pNewShapeEvent->next = 0;
@ -827,7 +826,7 @@ ProcShapeSelectInput (ClientPtr client)
*/
if (!pHead)
{
pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr));
pHead = xalloc (sizeof (ShapeEventPtr));
if (!pHead ||
!AddResource (pWin->drawable.id, EventType, (pointer)pHead))
{
@ -1014,7 +1013,7 @@ ProcShapeGetRectangles (ClientPtr client)
}
if (!region) {
nrects = 1;
rects = (xRectangle *) xalloc (sizeof (xRectangle));
rects = xalloc (sizeof (xRectangle));
if (!rects)
return BadAlloc;
switch (stuff->kind) {
@ -1041,7 +1040,7 @@ ProcShapeGetRectangles (ClientPtr client)
BoxPtr box;
nrects = REGION_NUM_RECTS(region);
box = REGION_RECTS(region);
rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle));
rects = xalloc (nrects * sizeof (xRectangle));
if (!rects && nrects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {

View File

@ -198,7 +198,7 @@ static Bool CheckForShmSyscall(void)
if (shmid != -1)
{
/* Successful allocation - clean up */
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
shmctl(shmid, IPC_RMID, NULL);
}
else
{
@ -265,7 +265,7 @@ ShmResetProc(ExtensionEntry *extEntry)
for (i = 0; i < MAXSCREENS; i++)
{
shmFuncs[i] = (ShmFuncsPtr)NULL;
shmFuncs[i] = NULL;
}
}
@ -422,7 +422,7 @@ ProcShmAttach(ClientPtr client)
}
else
{
shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec));
shmdesc = xalloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
shmdesc->addr = shmat(stuff->shmid, 0,
@ -727,7 +727,7 @@ CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;

View File

@ -93,7 +93,7 @@ ClientSleepUntil (ClientPtr client,
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec));
pRequest = xalloc (sizeof (SertafiedRec));
if (!pRequest)
return FALSE;
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)
{

View File

@ -284,7 +284,7 @@ XaceCensorImage(
/* convert region to list-of-rectangles for PolyFillRect */
pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle));
pRects = xalloc(nRects * sizeof(xRectangle));
if (!pRects)
{
failed = TRUE;

View File

@ -125,7 +125,7 @@ CheckForShmSyscall(void)
if (shmid != -1)
{
/* Successful allocation - clean up */
shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
shmctl(shmid, IPC_RMID, NULL);
}
else
{
@ -229,7 +229,7 @@ shmalloc(
if (size < 3500)
return (ShmDescPtr) NULL;
pDesc = (ShmDescRec *) xalloc(sizeof(ShmDescRec));
pDesc = xalloc(sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
@ -473,8 +473,7 @@ ProcXF86BigfontQueryFont(
shmid = pDesc->shmid;
} else {
#endif
pCI = (xCharInfo *)
xalloc(nCharInfos * sizeof(xCharInfo));
pCI = xalloc(nCharInfos * sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef HAS_SHM
@ -536,8 +535,7 @@ ProcXF86BigfontQueryFont(
if (hashModulus > nCharInfos+1)
hashModulus = nCharInfos+1;
tmp = (CARD16*)
xalloc((4*nCharInfos+1) * sizeof(CARD16));
tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) {
if (!pDesc) xfree(pCI);
return BadAlloc;
@ -621,8 +619,7 @@ ProcXF86BigfontQueryFont(
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply* reply =
(xXF86BigfontQueryFontReply *) xalloc(rlength);
xXF86BigfontQueryFontReply* reply = xalloc(rlength);
char* p;
if (!reply) {
if (nCharInfos > 0) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -567,7 +567,7 @@ QueueWorkProc (
{
WorkQueuePtr q;
q = (WorkQueuePtr) xalloc (sizeof *q);
q = xalloc (sizeof *q);
if (!q)
return FALSE;
q->function = function;
@ -601,7 +601,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
{
SleepQueuePtr q;
q = (SleepQueuePtr) xalloc (sizeof *q);
q = xalloc (sizeof *q);
if (!q)
return FALSE;
@ -681,7 +681,7 @@ _AddCallback(
{
CallbackPtr cbr;
cbr = (CallbackPtr) xalloc(sizeof(CallbackRec));
cbr = xalloc(sizeof(CallbackRec));
if (!cbr)
return FALSE;
cbr->proc = callback;
@ -824,7 +824,7 @@ CreateCallbackList(CallbackListPtr *pcbl)
int i;
if (!pcbl) return FALSE;
cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec));
cbl = xalloc(sizeof(CallbackListRec));
if (!cbl) return FALSE;
cbl->inCallback = 0;
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 */
eventlen += ((xGenericEvent*)xE)->length * 4;
qe = (QdEventPtr)xalloc(sizeof(QdEventRec) + eventlen);
qe = xalloc(sizeof(QdEventRec) + eventlen);
if (!qe)
return;
qe->next = (QdEventPtr)NULL;
@ -3824,7 +3824,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
check = 0;
if (!pWin->optional && !MakeWindowOptional (pWin))
return BadAlloc;
others = (OtherClients *) xalloc(sizeof(OtherClients));
others = xalloc(sizeof(OtherClients));
if (!others)
return BadAlloc;
others->mask = mask;

View File

@ -86,10 +86,10 @@ AddExtension(char *name, int NumEvents, int NumErrors,
(unsigned)(lastError + NumErrors > LAST_ERROR))
return((ExtensionEntry *) NULL);
ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry));
ext = xalloc(sizeof(ExtensionEntry));
if (!ext)
return((ExtensionEntry *) NULL);
ext->name = (char *)xalloc(strlen(name) + 1);
return(NULL);
ext->name = xalloc(strlen(name) + 1);
ext->num_aliases = 0;
ext->aliases = (char **)NULL;
ext->devPrivates = NULL;
@ -156,7 +156,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
if (!aliases)
return FALSE;
ext->aliases = aliases;
name = (char *)xalloc(strlen(alias) + 1);
name = xalloc(strlen(alias) + 1);
if (!name)
return FALSE;
strcpy(name, alias);
@ -323,7 +323,7 @@ ProcListExtensions(ClientPtr client)
total_length += strlen(extensions[i]->aliases[j]) + 1;
}
reply.length = (total_length + 3) >> 2;
buffer = bufptr = (char *)xalloc(total_length);
buffer = bufptr = xalloc(total_length);
if (!buffer)
return(BadAlloc);
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;
dash = (unsigned char *)xalloc(2 * sizeof(unsigned char));
dash = xalloc(2 * sizeof(unsigned char));
if (dash)
{
if (pGC->dash != DefaultDash)
@ -579,7 +579,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
{
GCPtr pGC;
pGC = (GCPtr)xalloc(sizeof(GC));
pGC = xalloc(sizeof(GC));
if (!pGC)
{
*pStatus = BadAlloc;
@ -829,8 +829,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
unsigned char *dash;
unsigned int i;
dash = (unsigned char *)xalloc(pgcSrc->numInDashList *
sizeof(unsigned char));
dash = xalloc(pgcSrc->numInDashList * sizeof(unsigned char));
if (dash)
{
if (pgcDst->dash != DefaultDash)
@ -909,7 +908,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
{
GCPtr pGC;
pGC = (GCPtr)xalloc(sizeof(GC));
pGC = xalloc(sizeof(GC));
if (!pGC)
return (GCPtr)NULL;
@ -1069,9 +1068,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
}
if (ndash & 1)
p = (unsigned char *)xalloc(2 * ndash * sizeof(unsigned char));
p = xalloc(2 * ndash * sizeof(unsigned char));
else
p = (unsigned char *)xalloc(ndash * sizeof(unsigned char));
p = xalloc(ndash * sizeof(unsigned char));
if (!p)
return BadAlloc;
@ -1166,7 +1165,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
if (newct < 0)
return(BadMatch);
size = nrects * sizeof(xRectangle);
prectsNew = (xRectangle *) xalloc(size);
prectsNew = xalloc(size);
if (!prectsNew && size)
return BadAlloc;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -207,7 +207,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
box.y2 = pSrcDrawable->height;
prgnSrcClip = &rgnSrcRec;
REGION_INIT(pscr, prgnSrcClip, &box, 1);
pSrcWin = (WindowPtr)NULL;
pSrcWin = NULL;
}
if (pDstDrawable == pSrcDrawable)
@ -354,7 +354,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
numRects = REGION_NUM_RECTS(pRgn);
pBox = REGION_RECTS(pRgn);
if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent))))
if(!(pEvent = xalloc(numRects * sizeof(xEvent))))
return;
pe = pEvent;
@ -397,7 +397,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
pBox = REGION_RECTS(pRgn);
numRects = REGION_NUM_RECTS(pRgn);
if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent))))
if(!(pEvent = xalloc(numRects * sizeof(xEvent))))
return;
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;
}
prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
sizeof(xRectangle));
prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
if (!prect)
return;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -171,7 +171,7 @@ Equipment Corporation.
((r1)->y1 <= (r2)->y1) && \
((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 RECTALLOC_BAIL(pReg,n,bail) \
@ -654,7 +654,7 @@ miRegionOp(
assert(r1 != r1End);
assert(r2 != r2End);
oldData = (RegDataPtr)NULL;
oldData = NULL;
if (((newReg == reg1) && (newSize > 1)) ||
((newReg == reg2) && (numRects > 1)))
{
@ -808,7 +808,7 @@ miRegionOp(
{
newReg->extents = *REGION_BOXPTR(newReg);
xfreeData(newReg);
newReg->data = (RegDataPtr)NULL;
newReg->data = NULL;
}
else
{
@ -1039,7 +1039,7 @@ miRegionAppend(RegionPtr dstrgn, RegionPtr rgn)
if (!rgn->data && (dstrgn->data == &miEmptyData))
{
dstrgn->extents = rgn->extents;
dstrgn->data = (RegDataPtr)NULL;
dstrgn->data = NULL;
return TRUE;
}
@ -1343,7 +1343,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
rit->prevBand = 0;
rit->curBand = 0;
rit->reg.extents = *box;
rit->reg.data = (RegDataPtr)NULL;
rit->reg.data = NULL;
if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
goto bail;
NextRect: ;
@ -1362,7 +1362,7 @@ NextRect: ;
if (reg->data->numRects == 1) /* keep unions happy below */
{
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.x2 = x2;
pRgn->extents.y2 = y2;
pRgn->data = (RegDataPtr)NULL;
pRgn->data = NULL;
}
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
* screen pixmap.
*/
pScrInitParms = (miScreenInitParmsPtr)xalloc(sizeof(miScreenInitParmsRec));
pScrInitParms = xalloc(sizeof(miScreenInitParmsRec));
if (!pScrInitParms)
return FALSE;
pScrInitParms->pbits = pbits;

View File

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

View File

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

View File

@ -769,7 +769,7 @@ miValidateTree (
if (pScreen->ClipNotify)
(* pScreen->ClipNotify) (pWin, 0, 0);
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)
{
pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt));
pptInit = xalloc (overall_height * sizeof(*ppt));
if (!pptInit)
return;
pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth));
pwidthInit = xalloc (overall_height * sizeof(*pwidth));
if (!pwidthInit)
{
xfree (pptInit);
@ -116,10 +116,10 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
}
else
{
spanRec.points = (DDXPointPtr) xalloc (overall_height * sizeof (*ppt));
spanRec.points = xalloc (overall_height * sizeof (*ppt));
if (!spanRec.points)
return;
spanRec.widths = (int *) xalloc (overall_height * sizeof (int));
spanRec.widths = xalloc (overall_height * sizeof (int));
if (!spanRec.widths)
{
xfree (spanRec.points);
@ -221,10 +221,10 @@ miFillRectPolyHelper (
}
else
{
spanRec.points = (DDXPointPtr) xalloc (h * sizeof (*ppt));
spanRec.points = xalloc (h * sizeof (*ppt));
if (!spanRec.points)
return;
spanRec.widths = (int *) xalloc (h * sizeof (int));
spanRec.widths = xalloc (h * sizeof (int));
if (!spanRec.widths)
{
xfree (spanRec.points);
@ -1045,10 +1045,10 @@ miLineArc (
}
if (!spanData)
{
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
points = xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
if (!points)
return;
widths = (int *)xalloc(sizeof(int) * pGC->lineWidth);
widths = xalloc(sizeof(int) * pGC->lineWidth);
if (!widths)
{
xfree(points);
@ -1064,10 +1064,10 @@ miLineArc (
}
else
{
points = (DDXPointPtr) xalloc (pGC->lineWidth * sizeof (DDXPointRec));
points = xalloc (pGC->lineWidth * sizeof (DDXPointRec));
if (!points)
return;
widths = (int *) xalloc (pGC->lineWidth * sizeof (int));
widths = xalloc (pGC->lineWidth * sizeof (int));
if (!widths)
{
xfree (points);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

16
os/io.c
View File

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

View File

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

View File

@ -66,7 +66,7 @@ authdes_ezdecode(char *inmsg, int len)
XDR xdr;
SVCXPRT xprt;
temp_inmsg = (char *) xalloc(len);
temp_inmsg = xalloc(len);
memmove(temp_inmsg, inmsg, len);
memset((char *)&msg, 0, sizeof(msg));
@ -79,7 +79,7 @@ authdes_ezdecode(char *inmsg, int len)
why = AUTH_FAILED;
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;
r.rq_xprt = &xprt;

View File

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

View File

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

View File

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