diff --git a/dix/dispatch.c b/dix/dispatch.c index da2c0b814..df7fb91df 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2686,38 +2686,48 @@ ProcAllocNamedColor(ClientPtr client) REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP, client, DixAddAccess); - if (rc == Success) { - xAllocNamedColorReply ancr = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; - if (dixLookupBuiltinColor - (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes, - &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) { - ancr.screenRed = ancr.exactRed; - ancr.screenGreen = ancr.exactGreen; - ancr.screenBlue = ancr.exactBlue; - ancr.pixel = 0; - if ((rc = AllocColor(pcmp, - &ancr.screenRed, &ancr.screenGreen, - &ancr.screenBlue, &ancr.pixel, client->index))) - return rc; -#ifdef XINERAMA - if (noPanoramiXExtension || !pcmp->pScreen->myNum) -#endif /* XINERAMA */ - WriteReplyToClient(client, sizeof(xAllocNamedColorReply), - &ancr); - return Success; - } - else - return BadName; - - } - else { + if (rc != Success) { client->errorValue = stuff->cmap; return rc; } + + xAllocNamedColorReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; + + if (!dixLookupBuiltinColor + (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes, + &rep.exactRed, &rep.exactGreen, &rep.exactBlue)) + return BadName; + + rep.screenRed = rep.exactRed; + rep.screenGreen = rep.exactGreen; + rep.screenBlue = rep.exactBlue; + rep.pixel = 0; + + if ((rc = AllocColor(pcmp, + &rep.screenRed, &rep.screenGreen, + &rep.screenBlue, &rep.pixel, client->index))) + return rc; + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.pixel); + swaps(&rep.exactRed); + swaps(&rep.exactGreen); + swaps(&rep.exactBlue); + swaps(&rep.screenRed); + swaps(&rep.screenGreen); + swaps(&rep.screenBlue); + } + +#ifdef XINERAMA + if (noPanoramiXExtension || !pcmp->pScreen->myNum) +#endif /* XINERAMA */ + WriteToClient(client, sizeof(rep), &rep); + return Success; } int diff --git a/dix/swaprep.c b/dix/swaprep.c index 998ccb327..b5c9502f3 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -310,20 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep) WriteToClient(pClient, size, pRep); } -void _X_COLD -SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->pixel); - swaps(&pRep->exactRed); - swaps(&pRep->exactGreen); - swaps(&pRep->exactBlue); - swaps(&pRep->screenRed); - swaps(&pRep->screenGreen); - swaps(&pRep->screenBlue); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index d20553c25..fdc6e7475 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -797,7 +797,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SAllocNamedColorReply, /* 85 */ + ReplyNotSwappd, /* 85 */ (ReplySwapPtr) SAllocColorCellsReply, (ReplySwapPtr) SAllocColorPlanesReply, ReplyNotSwappd, diff --git a/include/swaprep.h b/include/swaprep.h index 212812fce..9f6e4b989 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -68,11 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ , int /* size */ , xGetFontPathReply * /* pRep */ ); -extern void SAllocNamedColorReply(ClientPtr /* pClient */ , - int /* size */ , - xAllocNamedColorReply * /* pRep */ - ); - extern void SAllocColorCellsReply(ClientPtr /* pClient */ , int /* size */ , xAllocColorCellsReply * /* pRep */