(1623) xkb: XkbSendMap(): some little variable decl cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									3ddf939b58
								
							
						
					
					
						commit
						3e4df9becd
					
				
							
								
								
									
										16
									
								
								xkb/xkb.c
								
								
								
								
							
							
						
						
									
										16
									
								
								xkb/xkb.c
								
								
								
								
							|  | @ -1406,13 +1406,13 @@ XkbComputeGetMapReplySize(XkbDescPtr xkb, xkbGetMapReply * rep) | ||||||
| static int | static int | ||||||
| XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply rep) | XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply rep) | ||||||
| { | { | ||||||
|     unsigned i, len; |     int len = (rep.length * sizeof(CARD32)) - (sizeof(xkbGetMapReply) - sizeof(xGenericReply)); | ||||||
|     char *desc, *start; |     char *start = calloc(1, len); | ||||||
| 
 |  | ||||||
|     len = (rep.length * 4) - (sizeof(xkbGetMapReply) - sizeof(xGenericReply)); |  | ||||||
|     start = desc = calloc(1, len); |  | ||||||
|     if (!start) |     if (!start) | ||||||
|         return BadAlloc; |         return BadAlloc; | ||||||
|  | 
 | ||||||
|  |     char *desc = start; | ||||||
|  | 
 | ||||||
|     if (rep.nTypes > 0) |     if (rep.nTypes > 0) | ||||||
|         desc = XkbWriteKeyTypes(xkb, rep.firstType, rep.nTypes, desc, client); |         desc = XkbWriteKeyTypes(xkb, rep.firstType, rep.nTypes, desc, client); | ||||||
|     if (rep.nKeySyms > 0) |     if (rep.nKeySyms > 0) | ||||||
|  | @ -1422,9 +1422,9 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply rep) | ||||||
|     if (rep.totalKeyBehaviors > 0) |     if (rep.totalKeyBehaviors > 0) | ||||||
|         desc = XkbWriteKeyBehaviors(xkb, rep.firstKeyBehavior, rep.nKeyBehaviors, desc); |         desc = XkbWriteKeyBehaviors(xkb, rep.firstKeyBehavior, rep.nKeyBehaviors, desc); | ||||||
|     if (rep.virtualMods) { |     if (rep.virtualMods) { | ||||||
|         register int sz, bit; |         register int sz; | ||||||
| 
 | 
 | ||||||
|         for (i = sz = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { |         for (int i = sz = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { | ||||||
|             if (rep.virtualMods & bit) { |             if (rep.virtualMods & bit) { | ||||||
|                 desc[sz++] = xkb->server->vmods[i]; |                 desc[sz++] = xkb->server->vmods[i]; | ||||||
|             } |             } | ||||||
|  | @ -1451,7 +1451,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply rep) | ||||||
|     } |     } | ||||||
|     WriteToClient(client, sizeof(xkbGetMapReply), &rep); |     WriteToClient(client, sizeof(xkbGetMapReply), &rep); | ||||||
|     WriteToClient(client, len, start); |     WriteToClient(client, len, start); | ||||||
|     free((char *) start); |     free(start); | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue