dix: write out X_AllocColor reply directly
No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									725bb2d20d
								
							
						
					
					
						commit
						f062333422
					
				| 
						 | 
				
			
			@ -2627,8 +2627,12 @@ ProcAllocColor(ClientPtr client)
 | 
			
		|||
    REQUEST_SIZE_MATCH(xAllocColorReq);
 | 
			
		||||
    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
 | 
			
		||||
                                 client, DixAddAccess);
 | 
			
		||||
    if (rc == Success) {
 | 
			
		||||
        xAllocColorReply acr = {
 | 
			
		||||
    if (rc != Success) {
 | 
			
		||||
        client->errorValue = stuff->cmap;
 | 
			
		||||
        return rc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    xAllocColorReply rep = {
 | 
			
		||||
        .type = X_Reply,
 | 
			
		||||
        .sequenceNumber = client->sequence,
 | 
			
		||||
        .length = 0,
 | 
			
		||||
| 
						 | 
				
			
			@ -2637,20 +2641,24 @@ ProcAllocColor(ClientPtr client)
 | 
			
		|||
        .blue = stuff->blue,
 | 
			
		||||
        .pixel = 0
 | 
			
		||||
    };
 | 
			
		||||
        if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
 | 
			
		||||
                             &acr.pixel, client->index)))
 | 
			
		||||
 | 
			
		||||
    if ((rc = AllocColor(pmap, &rep.red, &rep.green, &rep.blue,
 | 
			
		||||
                         &rep.pixel, client->index)))
 | 
			
		||||
        return rc;
 | 
			
		||||
 | 
			
		||||
    if (client->swapped) {
 | 
			
		||||
        swaps(&rep.sequenceNumber);
 | 
			
		||||
        swaps(&rep.red);
 | 
			
		||||
        swaps(&rep.green);
 | 
			
		||||
        swaps(&rep.blue);
 | 
			
		||||
        swapl(&rep.pixel);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef XINERAMA
 | 
			
		||||
    if (noPanoramiXExtension || !pmap->pScreen->myNum)
 | 
			
		||||
#endif /* XINERAMA */
 | 
			
		||||
            WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
 | 
			
		||||
        WriteToClient(client, sizeof(rep), &rep);
 | 
			
		||||
    return Success;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        client->errorValue = stuff->cmap;
 | 
			
		||||
        return rc;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -310,17 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
 | 
			
		|||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
 | 
			
		||||
{
 | 
			
		||||
    swaps(&pRep->sequenceNumber);
 | 
			
		||||
    swaps(&pRep->red);
 | 
			
		||||
    swaps(&pRep->green);
 | 
			
		||||
    swaps(&pRep->blue);
 | 
			
		||||
    swapl(&pRep->pixel);
 | 
			
		||||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -799,7 +799,7 @@ ReplySwapPtr ReplySwapVector[256] = {
 | 
			
		|||
    ReplyNotSwappd,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    (ReplySwapPtr) SAllocColorReply,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    (ReplySwapPtr) SAllocNamedColorReply,       /* 85 */
 | 
			
		||||
    (ReplySwapPtr) SAllocColorCellsReply,
 | 
			
		||||
    (ReplySwapPtr) SAllocColorPlanesReply,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,10 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
 | 
			
		|||
                              int /* size */ ,
 | 
			
		||||
                              xGetFontPathReply * /* pRep */ );
 | 
			
		||||
 | 
			
		||||
extern void SAllocColorReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                             int /* size */ ,
 | 
			
		||||
                             xAllocColorReply * /* pRep */ );
 | 
			
		||||
 | 
			
		||||
extern void SAllocNamedColorReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                                  int /* size */ ,
 | 
			
		||||
                                  xAllocNamedColorReply *       /* pRep */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue