dix: write out X_QueryTextExtents 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
							
								
									189f475093
								
							
						
					
					
						commit
						1f2cf6fe4b
					
				| 
						 | 
					@ -1375,7 +1375,6 @@ ProcQueryFont(ClientPtr client)
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
ProcQueryTextExtents(ClientPtr client)
 | 
					ProcQueryTextExtents(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xQueryTextExtentsReply reply;
 | 
					 | 
				
			||||||
    FontPtr pFont;
 | 
					    FontPtr pFont;
 | 
				
			||||||
    ExtentInfoRec info;
 | 
					    ExtentInfoRec info;
 | 
				
			||||||
    unsigned long length;
 | 
					    unsigned long length;
 | 
				
			||||||
| 
						 | 
					@ -1397,7 +1396,8 @@ ProcQueryTextExtents(ClientPtr client)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info))
 | 
					    if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info))
 | 
				
			||||||
        return BadAlloc;
 | 
					        return BadAlloc;
 | 
				
			||||||
    reply = (xQueryTextExtentsReply) {
 | 
					
 | 
				
			||||||
 | 
					    xQueryTextExtentsReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .drawDirection = info.drawDirection,
 | 
					        .drawDirection = info.drawDirection,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
| 
						 | 
					@ -1410,7 +1410,18 @@ ProcQueryTextExtents(ClientPtr client)
 | 
				
			||||||
        .overallLeft = info.overallLeft,
 | 
					        .overallLeft = info.overallLeft,
 | 
				
			||||||
        .overallRight = info.overallRight
 | 
					        .overallRight = info.overallRight
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
 | 
					
 | 
				
			||||||
 | 
					    if (client->swapped) {
 | 
				
			||||||
 | 
					        swaps(&rep.sequenceNumber);
 | 
				
			||||||
 | 
					        swaps(&rep.fontAscent);
 | 
				
			||||||
 | 
					        swaps(&rep.fontDescent);
 | 
				
			||||||
 | 
					        swaps(&rep.overallAscent);
 | 
				
			||||||
 | 
					        swaps(&rep.overallDescent);
 | 
				
			||||||
 | 
					        swapl(&rep.overallWidth);
 | 
				
			||||||
 | 
					        swapl(&rep.overallLeft);
 | 
				
			||||||
 | 
					        swapl(&rep.overallRight);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    WriteToClient(client, sizeof(rep), &rep);
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -301,21 +301,6 @@ SwapFont(xQueryFontReply * pr, Bool hasGlyphs)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void _X_COLD
 | 
					 | 
				
			||||||
SQueryTextExtentsReply(ClientPtr pClient, int size,
 | 
					 | 
				
			||||||
                       xQueryTextExtentsReply * pRep)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    swaps(&pRep->sequenceNumber);
 | 
					 | 
				
			||||||
    swaps(&pRep->fontAscent);
 | 
					 | 
				
			||||||
    swaps(&pRep->fontDescent);
 | 
					 | 
				
			||||||
    swaps(&pRep->overallAscent);
 | 
					 | 
				
			||||||
    swaps(&pRep->overallDescent);
 | 
					 | 
				
			||||||
    swapl(&pRep->overallWidth);
 | 
					 | 
				
			||||||
    swapl(&pRep->overallLeft);
 | 
					 | 
				
			||||||
    swapl(&pRep->overallRight);
 | 
					 | 
				
			||||||
    WriteToClient(pClient, size, pRep);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void _X_COLD
 | 
					void _X_COLD
 | 
				
			||||||
SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
 | 
					SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -763,7 +763,7 @@ ReplySwapPtr ReplySwapVector[256] = {
 | 
				
			||||||
    ReplyNotSwappd,                             /* 45 */
 | 
					    ReplyNotSwappd,                             /* 45 */
 | 
				
			||||||
    ReplyNotSwappd,
 | 
					    ReplyNotSwappd,
 | 
				
			||||||
    ReplyNotSwappd,
 | 
					    ReplyNotSwappd,
 | 
				
			||||||
    (ReplySwapPtr) SQueryTextExtentsReply,
 | 
					    ReplyNotSwappd,
 | 
				
			||||||
    ReplyNotSwappd,
 | 
					    ReplyNotSwappd,
 | 
				
			||||||
    ReplyNotSwappd,                             /* 50 */
 | 
					    ReplyNotSwappd,                             /* 50 */
 | 
				
			||||||
    ReplyNotSwappd,
 | 
					    ReplyNotSwappd,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,11 +64,6 @@ extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
 | 
				
			||||||
                                int /* size */ ,
 | 
					                                int /* size */ ,
 | 
				
			||||||
                                xGetInputFocusReply * /* pRep */ );
 | 
					                                xGetInputFocusReply * /* pRep */ );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void SQueryTextExtentsReply(ClientPtr /* pClient */ ,
 | 
					 | 
				
			||||||
                                   int /* size */ ,
 | 
					 | 
				
			||||||
                                   xQueryTextExtentsReply *     /* pRep */
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern void SGetFontPathReply(ClientPtr /* pClient */ ,
 | 
					extern void SGetFontPathReply(ClientPtr /* pClient */ ,
 | 
				
			||||||
                              int /* size */ ,
 | 
					                              int /* size */ ,
 | 
				
			||||||
                              xGetFontPathReply * /* pRep */ );
 | 
					                              xGetFontPathReply * /* pRep */ );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue