[PATCH:libX11 1/2] XSetModifierMapping: Use Data instead of GetReqExtra

Alan Coopersmith alan.coopersmith at oracle.com
Tue Jul 23 22:45:13 PDT 2013


Handle arbitrary length data in the same fashion as other calls,
avoiding need to ensure it fits all in the request buffer.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/ModMap.c |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/ModMap.c b/src/ModMap.c
index 836a676..2fabc56 100644
--- a/src/ModMap.c
+++ b/src/ModMap.c
@@ -79,17 +79,11 @@ XSetModifierMapping(
     int         mapSize = modifier_map->max_keypermod << 3;	/* 8 modifiers */
 
     LockDisplay(dpy);
-    GetReqExtra(SetModifierMapping, mapSize, req);
-    if (!req) {
-	UnlockDisplay(dpy);
-	return MappingFailed;
-    }
-
+    GetReq(SetModifierMapping, req);
+    req->length += mapSize >> 2;
     req->numKeyPerModifier = modifier_map->max_keypermod;
 
-    memcpy((char *) NEXTPTR(req,xSetModifierMappingReq),
-	   (char *) modifier_map->modifiermap,
-	   mapSize);
+    Data(dpy, modifier_map->modifiermap, mapSize);
 
     (void) _XReply(dpy, (xReply *) & rep,
 	(SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue);
-- 
1.7.9.2



More information about the xorg-devel mailing list