(1623) xkb: XkbWriteVirtualModMap(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it. Therefore only pass in what's really needed, so it gets easier to understand. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									200777d8e2
								
							
						
					
					
						commit
						eefa72875c
					
				
							
								
								
									
										12
									
								
								xkb/xkb.c
								
								
								
								
							
							
						
						
									
										12
									
								
								xkb/xkb.c
								
								
								
								
							| 
						 | 
					@ -1365,18 +1365,18 @@ XkbSizeVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char *
 | 
					static char *
 | 
				
			||||||
XkbWriteVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
 | 
					XkbWriteVirtualModMap(XkbDescPtr xkb, KeyCode firstVModMapKey,
 | 
				
			||||||
                      ClientPtr client)
 | 
					                      CARD8 nVModMapKeys, char *buf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    unsigned i;
 | 
					    unsigned i;
 | 
				
			||||||
    xkbVModMapWireDesc *wire;
 | 
					    xkbVModMapWireDesc *wire;
 | 
				
			||||||
    unsigned short *pMap;
 | 
					    unsigned short *pMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wire = (xkbVModMapWireDesc *) buf;
 | 
					    wire = (xkbVModMapWireDesc *) buf;
 | 
				
			||||||
    pMap = &xkb->server->vmodmap[rep->firstVModMapKey];
 | 
					    pMap = &xkb->server->vmodmap[firstVModMapKey];
 | 
				
			||||||
    for (i = 0; i < rep->nVModMapKeys; i++, pMap++) {
 | 
					    for (i = 0; i < nVModMapKeys; i++, pMap++) {
 | 
				
			||||||
        if (*pMap != 0) {
 | 
					        if (*pMap != 0) {
 | 
				
			||||||
            wire->key = i + rep->firstVModMapKey;
 | 
					            wire->key = i + firstVModMapKey;
 | 
				
			||||||
            wire->vmods = *pMap;
 | 
					            wire->vmods = *pMap;
 | 
				
			||||||
            wire++;
 | 
					            wire++;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1436,7 +1436,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
 | 
				
			||||||
    if (rep->totalModMapKeys > 0)
 | 
					    if (rep->totalModMapKeys > 0)
 | 
				
			||||||
        desc = XkbWriteModifierMap(xkb, rep->firstModMapKey, rep->nModMapKeys, desc);
 | 
					        desc = XkbWriteModifierMap(xkb, rep->firstModMapKey, rep->nModMapKeys, desc);
 | 
				
			||||||
    if (rep->totalVModMapKeys > 0)
 | 
					    if (rep->totalVModMapKeys > 0)
 | 
				
			||||||
        desc = XkbWriteVirtualModMap(xkb, rep, desc, client);
 | 
					        desc = XkbWriteVirtualModMap(xkb, rep->firstVModMapKey, rep->nVModMapKeys, desc);
 | 
				
			||||||
    if ((desc - start) != (len)) {
 | 
					    if ((desc - start) != (len)) {
 | 
				
			||||||
        ErrorF
 | 
					        ErrorF
 | 
				
			||||||
            ("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",
 | 
					            ("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue