aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r--xorg-server/dix/dispatch.c448
1 files changed, 161 insertions, 287 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 3e5a7ac74..07a371f3c 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -180,13 +180,6 @@ CallbackListPtr ClientStateCallback;
volatile char dispatchException = 0;
volatile char isItTimeToYield;
-/* Various of the DIX function interfaces were not designed to allow
- * the client->errorValue to be set on BadValue and other errors.
- * Rather than changing interfaces and breaking untold code we introduce
- * a new global that dispatch can use.
- */
-XID clientErrorValue; /* XXX this is a kludge */
-
#define SAME_SCREENS(a, b) (\
(a.pScreen == b.pScreen))
@@ -363,7 +356,7 @@ Dispatch(void)
nextFreeClientID = 1;
nClients = 0;
- clientReady = xalloc(sizeof(int) * MaxClients);
+ clientReady = malloc(sizeof(int) * MaxClients);
if (!clientReady)
return;
@@ -472,16 +465,18 @@ Dispatch(void)
}
#endif
- if (result != Success)
+ if (client->noClientException != Success)
{
- if (client->noClientException != Success)
- CloseDownClient(client);
- else
- SendErrorToClient(client, MAJOROP,
- MinorOpcodeOfRequest(client),
- client->errorValue, result);
+ CloseDownClient(client);
break;
- }
+ }
+ else if (result != Success)
+ {
+ SendErrorToClient(client, MAJOROP,
+ MinorOpcodeOfRequest(client),
+ client->errorValue, result);
+ break;
+ }
}
FlushAllOutput();
client = clients[clientReady[nready]];
@@ -494,7 +489,7 @@ Dispatch(void)
ddxBeforeReset ();
#endif
KillAllClients();
- xfree(clientReady);
+ free(clientReady);
dispatchException &= ~DE_RESET;
SmartScheduleLatencyLimited = 0;
}
@@ -558,7 +553,7 @@ CreateConnectionBlock(void)
pad_to_int32(setup.nbytesVendor) +
(setup.numFormats * sizeof(xPixmapFormat)) +
(setup.numRoots * sizeof(xWindowRoot));
- ConnectionInfo = xalloc(lenofblock);
+ ConnectionInfo = malloc(lenofblock);
if (!ConnectionInfo)
return FALSE;
@@ -620,10 +615,10 @@ CreateConnectionBlock(void)
{
lenofblock += sizeof(xDepth) +
(pDepth->numVids * sizeof(xVisualType));
- pBuf = (char *)xrealloc(ConnectionInfo, lenofblock);
+ pBuf = (char *)realloc(ConnectionInfo, lenofblock);
if (!pBuf)
{
- xfree(ConnectionInfo);
+ free(ConnectionInfo);
return FALSE;
}
ConnectionInfo = pBuf;
@@ -703,10 +698,7 @@ ProcCreateWindow(ClientPtr client)
return BadAlloc;
pWin->eventMask = mask;
}
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
+ return rc;
}
int
@@ -714,7 +706,7 @@ ProcChangeWindowAttributes(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq);
- int result, len, rc;
+ int len, rc;
Mask access_mode = 0;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
@@ -726,14 +718,10 @@ ProcChangeWindowAttributes(ClientPtr client)
len = client->req_len - bytes_to_int32(sizeof(xChangeWindowAttributesReq));
if (len != Ones(stuff->valueMask))
return BadLength;
- result = ChangeWindowAttributes(pWin,
+ return ChangeWindowAttributes(pWin,
stuff->valueMask,
(XID *) &stuff[1],
client);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
}
int
@@ -751,7 +739,7 @@ ProcGetWindowAttributes(ClientPtr client)
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
- return(client->noClientException);
+ return Success;
}
int
@@ -772,7 +760,7 @@ ProcDestroyWindow(ClientPtr client)
return rc;
FreeResource(stuff->id, RT_NONE);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -787,7 +775,7 @@ ProcDestroySubwindows(ClientPtr client)
if (rc != Success)
return rc;
DestroySubwindows(pWin, client);
- return(client->noClientException);
+ return Success;
}
int
@@ -795,7 +783,7 @@ ProcChangeSaveSet(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xChangeSaveSetReq);
- int result, rc;
+ int rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
@@ -804,18 +792,9 @@ ProcChangeSaveSet(ClientPtr client)
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch;
if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
- {
- result = AlterSaveSetForClient(client, pWin, stuff->mode, FALSE, TRUE);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
- }
- else
- {
- client->errorValue = stuff->mode;
- return( BadValue );
- }
+ return AlterSaveSetForClient(client, pWin, stuff->mode, FALSE, TRUE);
+ client->errorValue = stuff->mode;
+ return BadValue;
}
int
@@ -823,7 +802,7 @@ ProcReparentWindow(ClientPtr client)
{
WindowPtr pWin, pParent;
REQUEST(xReparentWindowReq);
- int result, rc;
+ int rc;
REQUEST_SIZE_MATCH(xReparentWindowReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
@@ -832,23 +811,16 @@ ProcReparentWindow(ClientPtr client)
rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
if (rc != Success)
return rc;
- if (SAME_SCREENS(pWin->drawable, pParent->drawable))
- {
- if ((pWin->backgroundState == ParentRelative) &&
- (pParent->drawable.depth != pWin->drawable.depth))
- return BadMatch;
- if ((pWin->drawable.class != InputOnly) &&
- (pParent->drawable.class == InputOnly))
- return BadMatch;
- result = ReparentWindow(pWin, pParent,
- (short)stuff->x, (short)stuff->y, client);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
- }
- else
- return (BadMatch);
+ if (!SAME_SCREENS(pWin->drawable, pParent->drawable))
+ return BadMatch;
+ if ((pWin->backgroundState == ParentRelative) &&
+ (pParent->drawable.depth != pWin->drawable.depth))
+ return BadMatch;
+ if ((pWin->drawable.class != InputOnly) &&
+ (pParent->drawable.class == InputOnly))
+ return BadMatch;
+ return ReparentWindow(pWin, pParent,
+ (short)stuff->x, (short)stuff->y, client);
}
int
@@ -864,7 +836,7 @@ ProcMapWindow(ClientPtr client)
return rc;
MapWindow(pWin, client);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -880,7 +852,7 @@ ProcMapSubwindows(ClientPtr client)
return rc;
MapSubwindows(pWin, client);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -896,7 +868,7 @@ ProcUnmapWindow(ClientPtr client)
return rc;
UnmapWindow(pWin, FALSE);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -911,7 +883,7 @@ ProcUnmapSubwindows(ClientPtr client)
if (rc != Success)
return rc;
UnmapSubwindows(pWin);
- return(client->noClientException);
+ return Success;
}
int
@@ -919,7 +891,6 @@ ProcConfigureWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xConfigureWindowReq);
- int result;
int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -930,12 +901,7 @@ ProcConfigureWindow(ClientPtr client)
len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
if (Ones((Mask)stuff->mask) != len)
return BadLength;
- result = ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1],
- client);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
+ return ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client);
}
int
@@ -956,7 +922,7 @@ ProcCirculateWindow(ClientPtr client)
if (rc != Success)
return rc;
CirculateWindow(pWin, (int)stuff->direction, client);
- return(client->noClientException);
+ return Success;
}
static int
@@ -1015,7 +981,7 @@ ProcGetGeometry(ClientPtr client)
return status;
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
- return(client->noClientException);
+ return Success;
}
#ifdef WIN32
@@ -1057,7 +1023,7 @@ ProcQueryTree(ClientPtr client)
{
int curChild = 0;
- childIDs = xalloc(numChildren * sizeof(Window));
+ childIDs = malloc(numChildren * sizeof(Window));
if (!childIDs)
return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
@@ -1075,10 +1041,10 @@ ProcQueryTree(ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
- xfree(childIDs);
+ free(childIDs);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1105,7 +1071,7 @@ ProcInternAtom(ClientPtr client)
reply.sequenceNumber = client->sequence;
reply.atom = atom;
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
- return(client->noClientException);
+ return Success;
}
else
return (BadAlloc);
@@ -1130,7 +1096,7 @@ ProcGetAtomName(ClientPtr client)
reply.nameLength = len;
WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
(void)WriteToClient(client, len, str);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1150,7 +1116,7 @@ ProcGrabServer(ClientPtr client)
client->sequence--;
BITSET(grabWaiters, client->index);
IgnoreClient(client);
- return(client->noClientException);
+ return Success;
}
rc = OnlyListenToOneClient(client);
if (rc != Success)
@@ -1166,7 +1132,7 @@ ProcGrabServer(ClientPtr client)
CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
}
- return(client->noClientException);
+ return Success;
}
static void
@@ -1201,7 +1167,7 @@ ProcUngrabServer(ClientPtr client)
{
REQUEST_SIZE_MATCH(xReq);
UngrabServer(client);
- return(client->noClientException);
+ return Success;
}
int
@@ -1275,7 +1241,7 @@ ProcTranslateCoords(ClientPtr client)
rep.dstY = y - pDst->drawable.y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
- return(client->noClientException);
+ return Success;
}
int
@@ -1291,7 +1257,7 @@ ProcOpenFont(ClientPtr client)
stuff->nbytes, (char *)&stuff[1]);
if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -1310,7 +1276,7 @@ ProcCloseFont(ClientPtr client)
if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1349,7 +1315,7 @@ ProcQueryFont(ClientPtr client)
rlength = sizeof(xQueryFontReply) +
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo);
- reply = xcalloc(1, rlength);
+ reply = calloc(1, rlength);
if(!reply)
{
return(BadAlloc);
@@ -1361,8 +1327,8 @@ ProcQueryFont(ClientPtr client)
QueryFont( pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply);
- xfree(reply);
- return(client->noClientException);
+ free(reply);
+ return Success;
}
}
@@ -1403,7 +1369,7 @@ ProcQueryTextExtents(ClientPtr client)
reply.overallLeft = info.overallLeft;
reply.overallRight = info.overallRight;
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
- return(client->noClientException);
+ return Success;
}
int
@@ -1504,7 +1470,7 @@ CreatePmap:
return rc;
}
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
- return(client->noClientException);
+ return Success;
(*pDraw->pScreen->DestroyPixmap)(pMap);
}
return (BadAlloc);
@@ -1523,7 +1489,7 @@ ProcFreePixmap(ClientPtr client)
if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1558,7 +1524,7 @@ ProcCreateGC(ClientPtr client)
return error;
if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
return (BadAlloc);
- return(client->noClientException);
+ return Success;
}
int
@@ -1578,14 +1544,7 @@ ProcChangeGC(ClientPtr client)
if (len != Ones(stuff->mask))
return BadLength;
- result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- {
- client->errorValue = clientErrorValue;
- return(result);
- }
+ return ChangeGCXIDs(client, pGC, stuff->mask, (CARD32 *) &stuff[1]);
}
int
@@ -1605,14 +1564,12 @@ ProcCopyGC(ClientPtr client)
return result;
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
return (BadMatch);
- result = CopyGC(pGC, dstGC, stuff->mask);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
+ if (stuff->mask & ~GCAllBits)
{
- client->errorValue = clientErrorValue;
- return(result);
+ client->errorValue = stuff->mask;
+ return BadValue;
}
+ return CopyGC(pGC, dstGC, stuff->mask);
}
int
@@ -1633,15 +1590,11 @@ ProcSetDashes(ClientPtr client)
if (result != Success)
return result;
- result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
+ /* If there's an error, either there's no sensible errorValue,
+ * or there was a dash segment of 0. */
+ client->errorValue = 0;
+ return SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
(unsigned char *)&stuff[1]);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- {
- client->errorValue = clientErrorValue;
- return(result);
- }
}
int
@@ -1666,12 +1619,8 @@ ProcSetClipRectangles(ClientPtr client)
if (nr & 4)
return(BadLength);
nr >>= 3;
- result = SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
+ return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
nr, (xRectangle *)&stuff[1], (int)stuff->ordering);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
}
int
@@ -1687,7 +1636,7 @@ ProcFreeGC(ClientPtr client)
return rc;
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
int
@@ -1714,7 +1663,7 @@ ProcClearToBackground(ClientPtr client)
(*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,
stuff->width, stuff->height,
(Bool)stuff->exposures);
- return(client->noClientException);
+ return Success;
}
int
@@ -1756,7 +1705,7 @@ ProcCopyArea(ClientPtr client)
REGION_DESTROY(pDst->pScreen, pRgn);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1805,7 +1754,7 @@ ProcCopyPlane(ClientPtr client)
if (pRgn)
REGION_DESTROY(pdstDraw->pScreen, pRgn);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1828,7 +1777,7 @@ ProcPolyPoint(ClientPtr client)
if (npoint)
(*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
(xPoint *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1851,7 +1800,7 @@ ProcPolyLine(ClientPtr client)
if (npoint > 1)
(*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
(DDXPointPtr) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1870,7 +1819,7 @@ ProcPolySegment(ClientPtr client)
nsegs >>= 3;
if (nsegs)
(*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1890,7 +1839,7 @@ ProcPolyRectangle (ClientPtr client)
if (nrects)
(*pGC->ops->PolyRectangle)(pDraw, pGC,
nrects, (xRectangle *) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1909,7 +1858,7 @@ ProcPolyArc(ClientPtr client)
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1940,7 +1889,7 @@ ProcFillPoly(ClientPtr client)
(*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
stuff->coordMode, things,
(DDXPointPtr) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1961,7 +1910,7 @@ ProcPolyFillRectangle(ClientPtr client)
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
(xRectangle *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1980,7 +1929,7 @@ ProcPolyFillArc(ClientPtr client)
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
#ifdef MATCH_CLIENT_ENDIAN
@@ -2091,7 +2040,7 @@ ProcPutImage(ClientPtr client)
stuff->width, stuff->height,
stuff->leftPad, stuff->format, tmpImage);
- return (client->noClientException);
+ return Success;
}
static int
@@ -2195,7 +2144,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
xgi.length = length;
if (im_return) {
- pBuf = xcalloc(1, sz_xGetImageReply + length);
+ pBuf = calloc(1, sz_xGetImageReply + length);
if (!pBuf)
return (BadAlloc);
if (widthBytesLine == 0)
@@ -2233,7 +2182,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
length += widthBytesLine;
}
}
- if(!(pBuf = xcalloc(1, length)))
+ if(!(pBuf = calloc(1, length)))
return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
}
@@ -2334,8 +2283,8 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
if (pVisibleRegion)
REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
if (!im_return)
- xfree(pBuf);
- return (client->noClientException);
+ free(pBuf);
+ return Success;
}
int
@@ -2374,7 +2323,7 @@ ProcPolyText(ClientPtr client)
if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2404,7 +2353,7 @@ ProcImageText8(ClientPtr client)
if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2434,7 +2383,7 @@ ProcImageText16(ClientPtr client)
if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2472,12 +2421,8 @@ ProcCreateColormap(ClientPtr client)
{
if (pVisual->vid != stuff->visual)
continue;
- result = CreateColormap(mid, pScreen, pVisual, &pmap,
+ return CreateColormap(mid, pScreen, pVisual, &pmap,
(int)stuff->alloc, client->index);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return(result);
}
client->errorValue = stuff->visual;
return(BadMatch);
@@ -2498,7 +2443,7 @@ ProcFreeColormap(ClientPtr client)
/* Freeing a default colormap is a no-op */
if (!(pmap->flags & IsDefault))
FreeResource(stuff->id, RT_NONE);
- return (client->noClientException);
+ return Success;
}
else
{
@@ -2522,18 +2467,9 @@ ProcCopyColormapAndFree(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
client, DixReadAccess|DixRemoveAccess);
if (rc == Success)
- {
- rc = CopyColormapAndFree(mid, pSrcMap, client->index);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
- }
- else
- {
- client->errorValue = stuff->srcCmap;
- return (rc == BadValue) ? BadColor : rc;
- }
+ return CopyColormapAndFree(mid, pSrcMap, client->index);
+ client->errorValue = stuff->srcCmap;
+ return (rc == BadValue) ? BadColor : rc;
}
int
@@ -2554,8 +2490,8 @@ ProcInstallColormap(ClientPtr client)
goto out;
(*(pcmp->pScreen->InstallColormap)) (pcmp);
+ return Success;
- rc = client->noClientException;
out:
client->errorValue = stuff->id;
return (rc == BadValue) ? BadColor : rc;
@@ -2580,8 +2516,8 @@ ProcUninstallColormap(ClientPtr client)
if(pcmp->mid != pcmp->pScreen->defColormap)
(*(pcmp->pScreen->UninstallColormap)) (pcmp);
+ return Success;
- rc = client->noClientException;
out:
client->errorValue = stuff->id;
return (rc == BadValue) ? BadColor : rc;
@@ -2598,14 +2534,14 @@ ProcListInstalledColormaps(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- goto out;
+ return rc;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
DixGetAttrAccess);
if (rc != Success)
- goto out;
+ return rc;
- preply = xalloc(sizeof(xListInstalledColormapsReply) +
+ preply = malloc(sizeof(xListInstalledColormapsReply) +
pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap));
if(!preply)
@@ -2620,10 +2556,8 @@ ProcListInstalledColormaps(ClientPtr client)
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
- xfree(preply);
- rc = client->noClientException;
-out:
- return rc;
+ free(preply);
+ return Success;
}
int
@@ -2648,17 +2582,12 @@ ProcAllocColor (ClientPtr client)
acr.pixel = 0;
if( (rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
&acr.pixel, client->index)) )
- {
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
- }
+ return rc;
#ifdef PANORAMIX
if (noPanoramiXExtension || !pmap->pScreen->myNum)
#endif
WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
- return (client->noClientException);
+ return Success;
}
else
@@ -2696,17 +2625,12 @@ ProcAllocNamedColor (ClientPtr client)
if( (rc = AllocColor(pcmp,
&ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue,
&ancr.pixel, client->index)) )
- {
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
- }
+ return rc;
#ifdef PANORAMIX
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
- return (client->noClientException);
+ return Success;
}
else
return(BadName);
@@ -2749,7 +2673,7 @@ ProcAllocColorCells (ClientPtr client)
}
nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
- ppixels = xalloc(length);
+ ppixels = malloc(length);
if(!ppixels)
return(BadAlloc);
pmasks = ppixels + npixels;
@@ -2757,11 +2681,8 @@ ProcAllocColorCells (ClientPtr client)
if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
(Bool)stuff->contiguous, ppixels, pmasks)) )
{
- xfree(ppixels);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
+ free(ppixels);
+ return rc;
}
#ifdef PANORAMIX
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
@@ -2776,8 +2697,8 @@ ProcAllocColorCells (ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- xfree(ppixels);
- return (client->noClientException);
+ free(ppixels);
+ return Success;
}
else
{
@@ -2818,7 +2739,7 @@ ProcAllocColorPlanes(ClientPtr client)
acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels;
length = (long)npixels * sizeof(Pixel);
- ppixels = xalloc(length);
+ ppixels = malloc(length);
if(!ppixels)
return(BadAlloc);
if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
@@ -2826,11 +2747,8 @@ ProcAllocColorPlanes(ClientPtr client)
(Bool)stuff->contiguous, ppixels,
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
{
- xfree(ppixels);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
+ free(ppixels);
+ return rc;
}
acpr.length = bytes_to_int32(length);
#ifdef PANORAMIX
@@ -2841,8 +2759,8 @@ ProcAllocColorPlanes(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- xfree(ppixels);
- return (client->noClientException);
+ free(ppixels);
+ return Success;
}
else
{
@@ -2868,16 +2786,8 @@ ProcFreeColors(ClientPtr client)
if(pcmp->flags & AllAllocated)
return(BadAccess);
count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
- rc = FreeColors(pcmp, client->index, count,
+ return FreeColors(pcmp, client->index, count,
(Pixel *)&stuff[1], (Pixel)stuff->planeMask);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- {
- client->errorValue = clientErrorValue;
- return rc;
- }
-
}
else
{
@@ -2904,14 +2814,7 @@ ProcStoreColors (ClientPtr client)
if (count % sizeof(xColorItem))
return(BadLength);
count /= sizeof(xColorItem);
- rc = StoreColors(pcmp, count, (xColorItem *)&stuff[1]);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- {
- client->errorValue = clientErrorValue;
- return rc;
- }
+ return StoreColors(pcmp, count, (xColorItem *)&stuff[1], client);
}
else
{
@@ -2939,11 +2842,7 @@ ProcStoreNamedColor (ClientPtr client)
{
def.flags = stuff->flags;
def.pixel = stuff->pixel;
- rc = StoreColors(pcmp, 1, &def);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
+ return StoreColors(pcmp, 1, &def, client);
}
return (BadName);
}
@@ -2971,19 +2870,13 @@ ProcQueryColors(ClientPtr client)
xQueryColorsReply qcr;
count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
- prgbs = xcalloc(1, count * sizeof(xrgb));
+ prgbs = calloc(1, count * sizeof(xrgb));
if(!prgbs && count)
return(BadAlloc);
- if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
+ if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
{
- if (prgbs) xfree(prgbs);
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- {
- client->errorValue = clientErrorValue;
- return rc;
- }
+ if (prgbs) free(prgbs);
+ return rc;
}
memset(&qcr, 0, sizeof(xQueryColorsReply));
qcr.type = X_Reply;
@@ -2996,8 +2889,8 @@ ProcQueryColors(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
- if (prgbs) xfree(prgbs);
- return(client->noClientException);
+ if (prgbs) free(prgbs);
+ return Success;
}
else
@@ -3035,7 +2928,7 @@ ProcLookupColor(ClientPtr client)
&lcr.screenBlue,
pcmp->pVisual);
WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
- return(client->noClientException);
+ return Success;
}
return (BadName);
}
@@ -3095,13 +2988,13 @@ ProcCreateCursor (ClientPtr client)
return (BadMatch);
n = BitmapBytePad(width)*height;
- srcbits = xcalloc(1, n);
+ srcbits = calloc(1, n);
if (!srcbits)
return (BadAlloc);
- mskbits = xalloc(n);
+ mskbits = malloc(n);
if (!mskbits)
{
- xfree(srcbits);
+ free(srcbits);
return (BadAlloc);
}
@@ -3134,7 +3027,7 @@ ProcCreateCursor (ClientPtr client)
if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
return BadAlloc;
- return client->noClientException;
+ return Success;
}
int
@@ -3156,7 +3049,7 @@ ProcCreateGlyphCursor (ClientPtr client)
if (res != Success)
return res;
if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
- return client->noClientException;
+ return Success;
return BadAlloc;
}
@@ -3174,7 +3067,7 @@ ProcFreeCursor (ClientPtr client)
if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return (client->noClientException);
+ return Success;
}
else
{
@@ -3220,7 +3113,7 @@ ProcQueryBestSize (ClientPtr client)
reply.width = stuff->width;
reply.height = stuff->height;
WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
- return (client->noClientException);
+ return Success;
}
@@ -3284,7 +3177,7 @@ ProcSetScreenSaver (ClientPtr client)
ScreenSaverInterval = defaultScreenSaverInterval;
SetScreenSaverTimer();
- return (client->noClientException);
+ return Success;
}
int
@@ -3309,31 +3202,24 @@ ProcGetScreenSaver(ClientPtr client)
rep.preferBlanking = ScreenSaverBlanking;
rep.allowExposures = ScreenSaverAllowExposures;
WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
- return (client->noClientException);
+ return Success;
}
int
ProcChangeHosts(ClientPtr client)
{
REQUEST(xChangeHostsReq);
- int result;
REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
if(stuff->mode == HostInsert)
- result = AddHost(client, (int)stuff->hostFamily,
+ return AddHost(client, (int)stuff->hostFamily,
stuff->hostLength, (pointer)&stuff[1]);
- else if (stuff->mode == HostDelete)
- result = RemoveHost(client, (int)stuff->hostFamily,
+ if (stuff->mode == HostDelete)
+ return RemoveHost(client, (int)stuff->hostFamily,
stuff->hostLength, (pointer)&stuff[1]);
- else
- {
- client->errorValue = stuff->mode;
- return BadValue;
- }
- if (!result)
- result = client->noClientException;
- return (result);
+ client->errorValue = stuff->mode;
+ return BadValue;
}
int
@@ -3364,14 +3250,13 @@ ProcListHosts(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
WriteSwappedDataToClient(client, len, pdata);
}
- xfree(pdata);
- return (client->noClientException);
+ free(pdata);
+ return Success;
}
int
ProcChangeAccessControl(ClientPtr client)
{
- int result;
REQUEST(xSetAccessControlReq);
REQUEST_SIZE_MATCH(xSetAccessControlReq);
@@ -3380,10 +3265,7 @@ ProcChangeAccessControl(ClientPtr client)
client->errorValue = stuff->mode;
return BadValue;
}
- result = ChangeAccessControl(client, stuff->mode == EnableAccess);
- if (!result)
- result = client->noClientException;
- return (result);
+ return ChangeAccessControl(client, stuff->mode == EnableAccess);
}
/*********************
@@ -3419,7 +3301,7 @@ ProcKillClient(ClientPtr client)
if (stuff->id == AllTemporary)
{
CloseDownRetainedResources();
- return (client->noClientException);
+ return Success;
}
rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
@@ -3434,7 +3316,7 @@ ProcKillClient(ClientPtr client)
isItTimeToYield = TRUE;
return (Success);
}
- return (client->noClientException);
+ return Success;
}
else
return rc;
@@ -3446,8 +3328,7 @@ ProcSetFontPath(ClientPtr client)
unsigned char *ptr;
unsigned long nbytes, total;
long nfonts;
- int n, result;
- int error;
+ int n;
REQUEST(xSetFontPathReq);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
@@ -3465,14 +3346,7 @@ ProcSetFontPath(ClientPtr client)
}
if (total >= 4)
return(BadLength);
- result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
- &error);
- if (!result)
- {
- result = client->noClientException;
- client->errorValue = error;
- }
- return (result);
+ return SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
}
int
@@ -3496,7 +3370,7 @@ ProcGetFontPath(ClientPtr client)
WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
if (stringLens || numpaths)
(void)WriteToClient(client, stringLens + numpaths, (char *)bufferStart);
- return(client->noClientException);
+ return Success;
}
int
@@ -3515,7 +3389,7 @@ ProcChangeCloseDownMode(ClientPtr client)
(stuff->mode == RetainTemporary))
{
client->closeDownMode = stuff->mode;
- return (client->noClientException);
+ return Success;
}
else
{
@@ -3540,7 +3414,7 @@ int ProcForceScreenSaver(ClientPtr client)
rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode);
if (rc != Success)
return rc;
- return client->noClientException;
+ return Success;
}
int ProcNoOperation(ClientPtr client)
@@ -3548,7 +3422,7 @@ int ProcNoOperation(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xReq);
/* noop -- don't do anything */
- return(client->noClientException);
+ return Success;
}
void
@@ -3660,7 +3534,7 @@ CloseDownClient(ClientPtr client)
clients[client->index] = NullClient;
SmartLastClient = NullClient;
dixFreePrivates(client->devPrivates);
- xfree(client);
+ free(client);
while (!clients[currentMaxClients-1])
currentMaxClients--;
@@ -3709,13 +3583,13 @@ ClientPtr NextAvailableClient(pointer ospriv)
i = nextFreeClientID;
if (i == MAXCLIENTS)
return (ClientPtr)NULL;
- clients[i] = client = xalloc(sizeof(ClientRec));
+ clients[i] = client = malloc(sizeof(ClientRec));
if (!client)
return (ClientPtr)NULL;
InitClient(client, i, ospriv);
if (!InitClientResources(client))
{
- xfree(client);
+ free(client);
return (ClientPtr)NULL;
}
data.reqType = 1;
@@ -3723,7 +3597,7 @@ ClientPtr NextAvailableClient(pointer ospriv)
if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
{
FreeClientResources(client);
- xfree(client);
+ free(client);
return (ClientPtr)NULL;
}
if (i == currentMaxClients)
@@ -3766,7 +3640,7 @@ ProcInitialConnection(ClientPtr client)
swaps(&stuff->length, whichbyte);
}
ResetCurrentRequest(client);
- return (client->noClientException);
+ return Success;
}
static int
@@ -3863,7 +3737,7 @@ SendConnSetup(ClientPtr client, char *reason)
clientinfo.setup = (xConnSetup *)lConnectionInfo;
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
- return (client->noClientException);
+ return Success;
}
int
@@ -3897,7 +3771,7 @@ ProcEstablishConnection(ClientPtr client)
client->clientState = ClientStateCheckedSecurity;
else if (client->clientState != ClientStateAuthenticating)
return(SendConnSetup(client, reason));
- return(client->noClientException);
+ return Success;
}
void
@@ -4026,7 +3900,7 @@ AddScreen(
if (i == MAXSCREENS)
return -1;
- pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec));
+ pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
return -1;
@@ -4085,7 +3959,7 @@ AddScreen(
if (!(*pfnInit)(i, pScreen, argc, argv))
{
dixFreePrivates(pScreen->devPrivates);
- xfree(pScreen);
+ free(pScreen);
screenInfo.numScreens--;
return -1;
}