diff options
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r-- | xorg-server/dix/dispatch.c | 448 |
1 files changed, 161 insertions, 287 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index ec95b7ae3..fa11155cc 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -176,13 +176,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))
@@ -359,7 +352,7 @@ Dispatch(void) nextFreeClientID = 1;
nClients = 0;
- clientReady = xalloc(sizeof(int) * MaxClients);
+ clientReady = malloc(sizeof(int) * MaxClients);
if (!clientReady)
return;
@@ -444,16 +437,18 @@ Dispatch(void) client->sequence, client->index, result);
#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]];
@@ -466,7 +461,7 @@ Dispatch(void) ddxBeforeReset ();
#endif
KillAllClients();
- xfree(clientReady);
+ free(clientReady);
dispatchException &= ~DE_RESET;
SmartScheduleLatencyLimited = 0;
}
@@ -530,7 +525,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;
@@ -592,10 +587,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;
@@ -675,10 +670,7 @@ ProcCreateWindow(ClientPtr client) return BadAlloc;
pWin->eventMask = mask;
}
- if (client->noClientException != Success)
- return(client->noClientException);
- else
- return rc;
+ return rc;
}
int
@@ -686,7 +678,7 @@ ProcChangeWindowAttributes(ClientPtr client) {
WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq);
- int result, len, rc;
+ int len, rc;
Mask access_mode = 0;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
@@ -698,14 +690,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
@@ -723,7 +711,7 @@ ProcGetWindowAttributes(ClientPtr client) memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
- return(client->noClientException);
+ return Success;
}
int
@@ -744,7 +732,7 @@ ProcDestroyWindow(ClientPtr client) return rc;
FreeResource(stuff->id, RT_NONE);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -759,7 +747,7 @@ ProcDestroySubwindows(ClientPtr client) if (rc != Success)
return rc;
DestroySubwindows(pWin, client);
- return(client->noClientException);
+ return Success;
}
int
@@ -767,7 +755,7 @@ ProcChangeSaveSet(ClientPtr client) {
WindowPtr pWin;
REQUEST(xChangeSaveSetReq);
- int result, rc;
+ int rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
@@ -776,18 +764,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
@@ -795,7 +774,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);
@@ -804,23 +783,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
@@ -836,7 +808,7 @@ ProcMapWindow(ClientPtr client) return rc;
MapWindow(pWin, client);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -852,7 +824,7 @@ ProcMapSubwindows(ClientPtr client) return rc;
MapSubwindows(pWin, client);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -868,7 +840,7 @@ ProcUnmapWindow(ClientPtr client) return rc;
UnmapWindow(pWin, FALSE);
/* update cache to say it is mapped */
- return(client->noClientException);
+ return Success;
}
int
@@ -883,7 +855,7 @@ ProcUnmapSubwindows(ClientPtr client) if (rc != Success)
return rc;
UnmapSubwindows(pWin);
- return(client->noClientException);
+ return Success;
}
int
@@ -891,7 +863,6 @@ ProcConfigureWindow(ClientPtr client) {
WindowPtr pWin;
REQUEST(xConfigureWindowReq);
- int result;
int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -902,12 +873,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
@@ -928,7 +894,7 @@ ProcCirculateWindow(ClientPtr client) if (rc != Success)
return rc;
CirculateWindow(pWin, (int)stuff->direction, client);
- return(client->noClientException);
+ return Success;
}
static int
@@ -987,7 +953,7 @@ ProcGetGeometry(ClientPtr client) return status;
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
- return(client->noClientException);
+ return Success;
}
@@ -1019,7 +985,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)
@@ -1034,10 +1000,10 @@ ProcQueryTree(ClientPtr client) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
- xfree(childIDs);
+ free(childIDs);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1064,7 +1030,7 @@ ProcInternAtom(ClientPtr client) reply.sequenceNumber = client->sequence;
reply.atom = atom;
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
- return(client->noClientException);
+ return Success;
}
else
return (BadAlloc);
@@ -1089,7 +1055,7 @@ ProcGetAtomName(ClientPtr client) reply.nameLength = len;
WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
(void)WriteToClient(client, len, str);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1109,7 +1075,7 @@ ProcGrabServer(ClientPtr client) client->sequence--;
BITSET(grabWaiters, client->index);
IgnoreClient(client);
- return(client->noClientException);
+ return Success;
}
rc = OnlyListenToOneClient(client);
if (rc != Success)
@@ -1125,7 +1091,7 @@ ProcGrabServer(ClientPtr client) CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
}
- return(client->noClientException);
+ return Success;
}
static void
@@ -1160,7 +1126,7 @@ ProcUngrabServer(ClientPtr client) {
REQUEST_SIZE_MATCH(xReq);
UngrabServer(client);
- return(client->noClientException);
+ return Success;
}
int
@@ -1234,7 +1200,7 @@ ProcTranslateCoords(ClientPtr client) rep.dstY = y - pDst->drawable.y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
- return(client->noClientException);
+ return Success;
}
int
@@ -1250,7 +1216,7 @@ ProcOpenFont(ClientPtr client) stuff->nbytes, (char *)&stuff[1]);
if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -1269,7 +1235,7 @@ ProcCloseFont(ClientPtr client) if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1308,7 +1274,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);
@@ -1320,8 +1286,8 @@ ProcQueryFont(ClientPtr client) QueryFont( pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply);
- xfree(reply);
- return(client->noClientException);
+ free(reply);
+ return Success;
}
}
@@ -1362,7 +1328,7 @@ ProcQueryTextExtents(ClientPtr client) reply.overallLeft = info.overallLeft;
reply.overallRight = info.overallRight;
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
- return(client->noClientException);
+ return Success;
}
int
@@ -1463,7 +1429,7 @@ CreatePmap: return rc;
}
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
- return(client->noClientException);
+ return Success;
(*pDraw->pScreen->DestroyPixmap)(pMap);
}
return (BadAlloc);
@@ -1482,7 +1448,7 @@ ProcFreePixmap(ClientPtr client) if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
else
{
@@ -1517,7 +1483,7 @@ ProcCreateGC(ClientPtr client) return error;
if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
return (BadAlloc);
- return(client->noClientException);
+ return Success;
}
int
@@ -1537,14 +1503,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
@@ -1564,14 +1523,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
@@ -1592,15 +1549,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
@@ -1625,12 +1578,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
@@ -1646,7 +1595,7 @@ ProcFreeGC(ClientPtr client) return rc;
FreeResource(stuff->id, RT_NONE);
- return(client->noClientException);
+ return Success;
}
int
@@ -1673,7 +1622,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
@@ -1715,7 +1664,7 @@ ProcCopyArea(ClientPtr client) REGION_DESTROY(pDst->pScreen, pRgn);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1764,7 +1713,7 @@ ProcCopyPlane(ClientPtr client) if (pRgn)
REGION_DESTROY(pdstDraw->pScreen, pRgn);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -1787,7 +1736,7 @@ ProcPolyPoint(ClientPtr client) if (npoint)
(*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
(xPoint *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1810,7 +1759,7 @@ ProcPolyLine(ClientPtr client) if (npoint > 1)
(*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
(DDXPointPtr) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1829,7 +1778,7 @@ ProcPolySegment(ClientPtr client) nsegs >>= 3;
if (nsegs)
(*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1849,7 +1798,7 @@ ProcPolyRectangle (ClientPtr client) if (nrects)
(*pGC->ops->PolyRectangle)(pDraw, pGC,
nrects, (xRectangle *) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1868,7 +1817,7 @@ ProcPolyArc(ClientPtr client) narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1899,7 +1848,7 @@ ProcFillPoly(ClientPtr client) (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
stuff->coordMode, things,
(DDXPointPtr) &stuff[1]);
- return(client->noClientException);
+ return Success;
}
int
@@ -1920,7 +1869,7 @@ ProcPolyFillRectangle(ClientPtr client) if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
(xRectangle *) &stuff[1]);
- return (client->noClientException);
+ return Success;
}
int
@@ -1939,7 +1888,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
@@ -2050,7 +1999,7 @@ ProcPutImage(ClientPtr client) stuff->width, stuff->height,
stuff->leftPad, stuff->format, tmpImage);
- return (client->noClientException);
+ return Success;
}
static int
@@ -2154,7 +2103,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)
@@ -2192,7 +2141,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);
}
@@ -2293,8 +2242,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
@@ -2333,7 +2282,7 @@ ProcPolyText(ClientPtr client) if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2363,7 +2312,7 @@ ProcImageText8(ClientPtr client) if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2393,7 +2342,7 @@ ProcImageText16(ClientPtr client) if (err == Success)
{
- return(client->noClientException);
+ return Success;
}
else
return err;
@@ -2431,12 +2380,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);
@@ -2457,7 +2402,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
{
@@ -2481,18 +2426,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
@@ -2513,8 +2449,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;
@@ -2539,8 +2475,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;
@@ -2557,14 +2493,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)
@@ -2579,10 +2515,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
@@ -2607,17 +2541,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
@@ -2655,17 +2584,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);
@@ -2708,7 +2632,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;
@@ -2716,11 +2640,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)
@@ -2735,8 +2656,8 @@ ProcAllocColorCells (ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- xfree(ppixels);
- return (client->noClientException);
+ free(ppixels);
+ return Success;
}
else
{
@@ -2777,7 +2698,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,
@@ -2785,11 +2706,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
@@ -2800,8 +2718,8 @@ ProcAllocColorPlanes(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- xfree(ppixels);
- return (client->noClientException);
+ free(ppixels);
+ return Success;
}
else
{
@@ -2827,16 +2745,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
{
@@ -2863,14 +2773,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
{
@@ -2898,11 +2801,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);
}
@@ -2930,19 +2829,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;
@@ -2955,8 +2848,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
@@ -2994,7 +2887,7 @@ ProcLookupColor(ClientPtr client) &lcr.screenBlue,
pcmp->pVisual);
WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
- return(client->noClientException);
+ return Success;
}
return (BadName);
}
@@ -3054,13 +2947,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);
}
@@ -3093,7 +2986,7 @@ ProcCreateCursor (ClientPtr client) if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
return BadAlloc;
- return client->noClientException;
+ return Success;
}
int
@@ -3115,7 +3008,7 @@ ProcCreateGlyphCursor (ClientPtr client) if (res != Success)
return res;
if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
- return client->noClientException;
+ return Success;
return BadAlloc;
}
@@ -3133,7 +3026,7 @@ ProcFreeCursor (ClientPtr client) if (rc == Success)
{
FreeResource(stuff->id, RT_NONE);
- return (client->noClientException);
+ return Success;
}
else
{
@@ -3179,7 +3072,7 @@ ProcQueryBestSize (ClientPtr client) reply.width = stuff->width;
reply.height = stuff->height;
WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
- return (client->noClientException);
+ return Success;
}
@@ -3243,7 +3136,7 @@ ProcSetScreenSaver (ClientPtr client) ScreenSaverInterval = defaultScreenSaverInterval;
SetScreenSaverTimer();
- return (client->noClientException);
+ return Success;
}
int
@@ -3268,31 +3161,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
@@ -3323,14 +3209,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);
@@ -3339,10 +3224,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);
}
/*********************
@@ -3378,7 +3260,7 @@ ProcKillClient(ClientPtr client) if (stuff->id == AllTemporary)
{
CloseDownRetainedResources();
- return (client->noClientException);
+ return Success;
}
rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
@@ -3393,7 +3275,7 @@ ProcKillClient(ClientPtr client) isItTimeToYield = TRUE;
return (Success);
}
- return (client->noClientException);
+ return Success;
}
else
return rc;
@@ -3405,8 +3287,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);
@@ -3424,14 +3305,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
@@ -3455,7 +3329,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
@@ -3474,7 +3348,7 @@ ProcChangeCloseDownMode(ClientPtr client) (stuff->mode == RetainTemporary))
{
client->closeDownMode = stuff->mode;
- return (client->noClientException);
+ return Success;
}
else
{
@@ -3499,7 +3373,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)
@@ -3507,7 +3381,7 @@ int ProcNoOperation(ClientPtr client) REQUEST_AT_LEAST_SIZE(xReq);
/* noop -- don't do anything */
- return(client->noClientException);
+ return Success;
}
void
@@ -3619,7 +3493,7 @@ CloseDownClient(ClientPtr client) clients[client->index] = NullClient;
SmartLastClient = NullClient;
dixFreePrivates(client->devPrivates);
- xfree(client);
+ free(client);
while (!clients[currentMaxClients-1])
currentMaxClients--;
@@ -3668,13 +3542,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;
@@ -3682,7 +3556,7 @@ ClientPtr NextAvailableClient(pointer ospriv) if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
{
FreeClientResources(client);
- xfree(client);
+ free(client);
return (ClientPtr)NULL;
}
if (i == currentMaxClients)
@@ -3725,7 +3599,7 @@ ProcInitialConnection(ClientPtr client) swaps(&stuff->length, whichbyte);
}
ResetCurrentRequest(client);
- return (client->noClientException);
+ return Success;
}
static int
@@ -3822,7 +3696,7 @@ SendConnSetup(ClientPtr client, char *reason) clientinfo.setup = (xConnSetup *)lConnectionInfo;
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
- return (client->noClientException);
+ return Success;
}
int
@@ -3856,7 +3730,7 @@ ProcEstablishConnection(ClientPtr client) client->clientState = ClientStateCheckedSecurity;
else if (client->clientState != ClientStateAuthenticating)
return(SendConnSetup(client, reason));
- return(client->noClientException);
+ return Success;
}
void
@@ -3985,7 +3859,7 @@ AddScreen( if (i == MAXSCREENS)
return -1;
- pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec));
+ pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
return -1;
@@ -4044,7 +3918,7 @@ AddScreen( if (!(*pfnInit)(i, pScreen, argc, argv))
{
dixFreePrivates(pScreen->devPrivates);
- xfree(pScreen);
+ free(pScreen);
screenInfo.numScreens--;
return -1;
}
|