| File: | src/xkb/XKBGetMap.c |
| Location: | line 44, column 13 |
| Description: | Value stored to 'n' is never read |
| 1 | /************************************************************ |
| 2 | Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. |
| 3 | |
| 4 | Permission to use, copy, modify, and distribute this |
| 5 | software and its documentation for any purpose and without |
| 6 | fee is hereby granted, provided that the above copyright |
| 7 | notice appear in all copies and that both that copyright |
| 8 | notice and this permission notice appear in supporting |
| 9 | documentation, and that the name of Silicon Graphics not be |
| 10 | used in advertising or publicity pertaining to distribution |
| 11 | of the software without specific prior written permission. |
| 12 | Silicon Graphics makes no representation about the suitability |
| 13 | of this software for any purpose. It is provided "as is" |
| 14 | without any express or implied warranty. |
| 15 | |
| 16 | SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
| 17 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 18 | AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON |
| 19 | GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 20 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 21 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE |
| 22 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
| 23 | THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 24 | |
| 25 | ********************************************************/ |
| 26 | |
| 27 | #define NEED_MAP_READERS |
| 28 | #ifdef HAVE_CONFIG_H1 |
| 29 | #include <config.h> |
| 30 | #endif |
| 31 | #include "Xlibint.h" |
| 32 | #include <X11/extensions/XKBproto.h> |
| 33 | #include "XKBlibint.h" |
| 34 | |
| 35 | static Statusint |
| 36 | _XkbReadKeyTypes(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) |
| 37 | { |
| 38 | int i, n, lastMapCount; |
| 39 | XkbKeyTypePtr type; |
| 40 | |
| 41 | if (rep->nTypes > 0) { |
| 42 | n = rep->firstType + rep->nTypes; |
| 43 | if (xkb->map->num_types >= n) |
| 44 | n = xkb->map->num_types; |
Value stored to 'n' is never read | |
| 45 | else if (XkbAllocClientMap(xkb, XkbKeyTypesMask(1<<0), n) != Success0) |
| 46 | return BadAlloc11; |
| 47 | |
| 48 | type = &xkb->map->types[rep->firstType]; |
| 49 | for (i = 0; i < (int) rep->nTypes; i++, type++) { |
| 50 | xkbKeyTypeWireDesc *desc; |
| 51 | register int ndx; |
| 52 | |
| 53 | ndx = i + rep->firstType; |
| 54 | if (ndx >= xkb->map->num_types) |
| 55 | xkb->map->num_types = ndx + 1; |
| 56 | |
| 57 | desc = (xkbKeyTypeWireDesc *) |
| 58 | _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)8); |
| 59 | if (desc == NULL((void*)0)) |
| 60 | return BadLength16; |
| 61 | |
| 62 | lastMapCount = type->map_count; |
| 63 | if (desc->nMapEntries > 0) { |
| 64 | if ((type->map == NULL((void*)0)) || |
| 65 | (desc->nMapEntries > type->map_count)) { |
| 66 | XkbKTMapEntryRec *prev_map = type->map; |
| 67 | |
| 68 | type->map = _XkbTypedRealloc(type->map, desc->nMapEntries,((type->map) ? (XkbKTMapEntryRec *)realloc(((type->map) ), (((desc->nMapEntries)*sizeof(XkbKTMapEntryRec)) == 0 ? 1 : ((desc->nMapEntries)*sizeof(XkbKTMapEntryRec)))) : ((XkbKTMapEntryRec *)calloc((((desc->nMapEntries)) == 0 ? 1 : ((desc->nMapEntries ))), (sizeof(XkbKTMapEntryRec))))) |
| 69 | XkbKTMapEntryRec)((type->map) ? (XkbKTMapEntryRec *)realloc(((type->map) ), (((desc->nMapEntries)*sizeof(XkbKTMapEntryRec)) == 0 ? 1 : ((desc->nMapEntries)*sizeof(XkbKTMapEntryRec)))) : ((XkbKTMapEntryRec *)calloc((((desc->nMapEntries)) == 0 ? 1 : ((desc->nMapEntries ))), (sizeof(XkbKTMapEntryRec))))); |
| 70 | if (type->map == NULL((void*)0)) { |
| 71 | _XkbFree(prev_map)free((prev_map)); |
| 72 | return BadAlloc11; |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | else if (type->map != NULL((void*)0)) { |
| 77 | Xfree(type->map)free((type->map)); |
| 78 | type->map_count = 0; |
| 79 | type->map = NULL((void*)0); |
| 80 | } |
| 81 | |
| 82 | if (desc->preserve && (desc->nMapEntries > 0)) { |
| 83 | if ((!type->preserve) || (desc->nMapEntries > lastMapCount)) { |
| 84 | XkbModsRec *prev_preserve = type->preserve; |
| 85 | |
| 86 | type->preserve = _XkbTypedRealloc(type->preserve,((type->preserve) ? (XkbModsRec *)realloc(((type->preserve )), (((desc->nMapEntries)*sizeof(XkbModsRec)) == 0 ? 1 : ( (desc->nMapEntries)*sizeof(XkbModsRec)))) : ((XkbModsRec * )calloc((((desc->nMapEntries)) == 0 ? 1 : ((desc->nMapEntries ))), (sizeof(XkbModsRec))))) |
| 87 | desc->nMapEntries,((type->preserve) ? (XkbModsRec *)realloc(((type->preserve )), (((desc->nMapEntries)*sizeof(XkbModsRec)) == 0 ? 1 : ( (desc->nMapEntries)*sizeof(XkbModsRec)))) : ((XkbModsRec * )calloc((((desc->nMapEntries)) == 0 ? 1 : ((desc->nMapEntries ))), (sizeof(XkbModsRec))))) |
| 88 | XkbModsRec)((type->preserve) ? (XkbModsRec *)realloc(((type->preserve )), (((desc->nMapEntries)*sizeof(XkbModsRec)) == 0 ? 1 : ( (desc->nMapEntries)*sizeof(XkbModsRec)))) : ((XkbModsRec * )calloc((((desc->nMapEntries)) == 0 ? 1 : ((desc->nMapEntries ))), (sizeof(XkbModsRec))))); |
| 89 | if (type->preserve == NULL((void*)0)) { |
| 90 | _XkbFree(prev_preserve)free((prev_preserve)); |
| 91 | return BadAlloc11; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | else if (type->preserve != NULL((void*)0)) { |
| 96 | Xfree(type->preserve)free((type->preserve)); |
| 97 | type->preserve = NULL((void*)0); |
| 98 | } |
| 99 | |
| 100 | type->mods.mask = desc->mask; |
| 101 | type->mods.real_mods = desc->realMods; |
| 102 | type->mods.vmods = desc->virtualMods; |
| 103 | type->num_levels = desc->numLevels; |
| 104 | type->map_count = desc->nMapEntries; |
| 105 | if (desc->nMapEntries > 0) { |
| 106 | register xkbKTMapEntryWireDesc *wire; |
| 107 | register XkbKTMapEntryPtr entry; |
| 108 | register int size; |
| 109 | |
| 110 | size = type->map_count * SIZEOF(xkbKTMapEntryWireDesc)8; |
| 111 | wire = |
| 112 | (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); |
| 113 | if (wire == NULL((void*)0)) |
| 114 | return BadLength16; |
| 115 | entry = type->map; |
| 116 | for (n = 0; n < type->map_count; n++, wire++, entry++) { |
| 117 | entry->active = wire->active; |
| 118 | entry->level = wire->level; |
| 119 | entry->mods.mask = wire->mask; |
| 120 | entry->mods.real_mods = wire->realMods; |
| 121 | entry->mods.vmods = wire->virtualMods; |
| 122 | } |
| 123 | |
| 124 | if (desc->preserve) { |
| 125 | register xkbModsWireDesc *pwire; |
| 126 | register XkbModsPtr preserve; |
| 127 | register int sz; |
| 128 | |
| 129 | sz = desc->nMapEntries * SIZEOF(xkbModsWireDesc)4; |
| 130 | pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); |
| 131 | if (pwire == NULL((void*)0)) |
| 132 | return BadLength16; |
| 133 | preserve = type->preserve; |
| 134 | for (n = 0; n < desc->nMapEntries; n++, pwire++, preserve++) { |
| 135 | preserve->mask = pwire->mask; |
| 136 | preserve->vmods = pwire->virtualMods; |
| 137 | preserve->real_mods = pwire->realMods; |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | return Success0; |
| 144 | } |
| 145 | |
| 146 | static Statusint |
| 147 | _XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) |
| 148 | { |
| 149 | register int i; |
| 150 | XkbClientMapPtr map; |
| 151 | int size = xkb->max_key_code + 1; |
| 152 | |
| 153 | if (((unsigned short) rep->firstKeySym + rep->nKeySyms) > size) |
| 154 | return BadLength16; |
| 155 | |
| 156 | map = xkb->map; |
| 157 | if (map->key_sym_map == NULL((void*)0)) { |
| 158 | register int offset; |
| 159 | XkbSymMapPtr oldMap; |
| 160 | xkbSymMapWireDesc *newMap; |
| 161 | |
| 162 | map->key_sym_map = _XkbTypedCalloc(size, XkbSymMapRec)((XkbSymMapRec *)calloc((((size)) == 0 ? 1 : ((size))), (sizeof (XkbSymMapRec)))); |
| 163 | if (map->key_sym_map == NULL((void*)0)) |
| 164 | return BadAlloc11; |
| 165 | if (map->syms == NULL((void*)0)) { |
| 166 | int sz; |
| 167 | |
| 168 | sz = (rep->totalSyms * 12) / 10; |
| 169 | sz = ((sz + (unsigned) 128) / 128) * 128; |
| 170 | map->syms = _XkbTypedCalloc(sz, KeySym)((KeySym *)calloc((((sz)) == 0 ? 1 : ((sz))), (sizeof(KeySym) ))); |
| 171 | if (map->syms == NULL((void*)0)) |
| 172 | return BadAlloc11; |
| 173 | map->size_syms = sz; |
| 174 | } |
| 175 | offset = 1; |
| 176 | oldMap = &map->key_sym_map[rep->firstKeySym]; |
| 177 | for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { |
| 178 | newMap = (xkbSymMapWireDesc *) |
| 179 | _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)8); |
| 180 | if (newMap == NULL((void*)0)) |
| 181 | return BadLength16; |
| 182 | oldMap->kt_index[0] = newMap->ktIndex[0]; |
| 183 | oldMap->kt_index[1] = newMap->ktIndex[1]; |
| 184 | oldMap->kt_index[2] = newMap->ktIndex[2]; |
| 185 | oldMap->kt_index[3] = newMap->ktIndex[3]; |
| 186 | oldMap->group_info = newMap->groupInfo; |
| 187 | oldMap->width = newMap->width; |
| 188 | oldMap->offset = offset; |
| 189 | if (offset + newMap->nSyms >= map->size_syms) { |
| 190 | register int sz; |
| 191 | KeySym *prev_syms = map->syms; |
| 192 | |
| 193 | sz = map->size_syms + 128; |
| 194 | map->syms = _XkbTypedRealloc(map->syms, sz, KeySym)((map->syms) ? (KeySym *)realloc(((map->syms)), (((sz)* sizeof(KeySym)) == 0 ? 1 : ((sz)*sizeof(KeySym)))) : ((KeySym *)calloc((((sz)) == 0 ? 1 : ((sz))), (sizeof(KeySym))))); |
| 195 | if (map->syms == NULL((void*)0)) { |
| 196 | _XkbFree(prev_syms)free((prev_syms)); |
| 197 | map->size_syms = 0; |
| 198 | return BadAlloc11; |
| 199 | } |
| 200 | map->size_syms = sz; |
| 201 | } |
| 202 | if (newMap->nSyms > 0) { |
| 203 | _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], |
| 204 | newMap->nSyms); |
| 205 | offset += newMap->nSyms; |
| 206 | } |
| 207 | else { |
| 208 | map->syms[offset] = 0; |
| 209 | } |
| 210 | } |
| 211 | map->num_syms = offset; |
| 212 | } |
| 213 | else { |
| 214 | XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym]; |
| 215 | |
| 216 | for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { |
| 217 | xkbSymMapWireDesc *newMap; |
| 218 | KeySym *newSyms; |
| 219 | int tmp; |
| 220 | |
| 221 | newMap = (xkbSymMapWireDesc *) |
| 222 | _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)8); |
| 223 | if (newMap == NULL((void*)0)) |
| 224 | return BadLength16; |
| 225 | |
| 226 | if (newMap->nSyms > 0) |
| 227 | tmp = newMap->nSyms; |
| 228 | else |
| 229 | tmp = 0; |
| 230 | |
| 231 | newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); |
| 232 | if (newSyms == NULL((void*)0)) |
| 233 | return BadAlloc11; |
| 234 | if (newMap->nSyms > 0) |
| 235 | _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); |
| 236 | else |
| 237 | newSyms[0] = NoSymbol0L; |
| 238 | oldMap->kt_index[0] = newMap->ktIndex[0]; |
| 239 | oldMap->kt_index[1] = newMap->ktIndex[1]; |
| 240 | oldMap->kt_index[2] = newMap->ktIndex[2]; |
| 241 | oldMap->kt_index[3] = newMap->ktIndex[3]; |
| 242 | oldMap->group_info = newMap->groupInfo; |
| 243 | oldMap->width = newMap->width; |
| 244 | } |
| 245 | } |
| 246 | return Success0; |
| 247 | } |
| 248 | |
| 249 | static Statusint |
| 250 | _XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep) |
| 251 | { |
| 252 | int i; |
| 253 | CARD8 numDescBuf[248]; |
| 254 | CARD8 *numDesc = NULL((void*)0); |
| 255 | register int nKeyActs; |
| 256 | Statusint ret = Success0; |
| 257 | |
| 258 | if ((nKeyActs = rep->nKeyActs) > 0) { |
| 259 | XkbSymMapPtr symMap; |
| 260 | |
| 261 | if (nKeyActs < sizeof numDescBuf) |
| 262 | numDesc = numDescBuf; |
| 263 | else |
| 264 | numDesc = Xmalloc(nKeyActs * sizeof(CARD8))malloc(((nKeyActs * sizeof(CARD8)) == 0 ? 1 : (nKeyActs * sizeof (CARD8)))); |
| 265 | |
| 266 | if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { |
| 267 | ret = BadLength16; |
| 268 | goto done; |
| 269 | } |
| 270 | i = XkbPaddedSize(nKeyActs)((((unsigned int)(nKeyActs)+3) >> 2) << 2) - nKeyActs; |
| 271 | if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { |
| 272 | ret = BadLength16; |
| 273 | goto done; |
| 274 | } |
| 275 | symMap = &info->map->key_sym_map[rep->firstKeyAct]; |
| 276 | for (i = 0; i < (int) rep->nKeyActs; i++, symMap++) { |
| 277 | if (numDesc[i] == 0) { |
| 278 | if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { |
| 279 | ret = BadLength16; |
| 280 | goto done; |
| 281 | } |
| 282 | info->server->key_acts[i + rep->firstKeyAct] = 0; |
| 283 | } |
| 284 | else { |
| 285 | XkbAction *newActs; |
| 286 | |
| 287 | /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ |
| 288 | /* either zero or XkbKeyNumSyms(info,key) */ |
| 289 | newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, |
| 290 | numDesc[i]); |
| 291 | if (newActs == NULL((void*)0)) { |
| 292 | ret = BadAlloc11; |
| 293 | goto done; |
| 294 | } |
| 295 | if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, |
| 296 | (int) (numDesc[i] * sizeof(XkbAction)))) { |
| 297 | ret = BadLength16; |
| 298 | goto done; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | done: |
| 304 | if (numDesc != NULL((void*)0) && numDesc != numDescBuf) |
| 305 | Xfree(numDesc)free((numDesc)); |
| 306 | return ret; |
| 307 | } |
| 308 | |
| 309 | static Statusint |
| 310 | _XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) |
| 311 | { |
| 312 | register int i; |
| 313 | |
| 314 | if (rep->totalKeyBehaviors > 0) { |
| 315 | int size = xkb->max_key_code + 1; |
| 316 | |
| 317 | if (((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) |
| 318 | return BadLength16; |
| 319 | if (xkb->server->behaviors == NULL((void*)0)) { |
| 320 | xkb->server->behaviors = _XkbTypedCalloc(size, XkbBehavior)((XkbBehavior *)calloc((((size)) == 0 ? 1 : ((size))), (sizeof (XkbBehavior)))); |
| 321 | if (xkb->server->behaviors == NULL((void*)0)) |
| 322 | return BadAlloc11; |
| 323 | } |
| 324 | else { |
| 325 | bzero(&xkb->server->behaviors[rep->firstKeyBehavior],__builtin___memset_chk (&xkb->server->behaviors[rep ->firstKeyBehavior], 0, (rep->nKeyBehaviors * sizeof(XkbBehavior )), __builtin_object_size (&xkb->server->behaviors[ rep->firstKeyBehavior], 0)) |
| 326 | (rep->nKeyBehaviors * sizeof(XkbBehavior)))__builtin___memset_chk (&xkb->server->behaviors[rep ->firstKeyBehavior], 0, (rep->nKeyBehaviors * sizeof(XkbBehavior )), __builtin_object_size (&xkb->server->behaviors[ rep->firstKeyBehavior], 0)); |
| 327 | } |
| 328 | for (i = 0; i < rep->totalKeyBehaviors; i++) { |
| 329 | xkbBehaviorWireDesc *wire; |
| 330 | |
| 331 | wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, |
| 332 | SIZEOF(xkbBehaviorWireDesc)4); |
| 333 | if (wire == NULL((void*)0) || wire->key >= size) |
| 334 | return BadLength16; |
| 335 | xkb->server->behaviors[wire->key].type = wire->type; |
| 336 | xkb->server->behaviors[wire->key].data = wire->data; |
| 337 | } |
| 338 | } |
| 339 | return Success0; |
| 340 | } |
| 341 | |
| 342 | static Statusint |
| 343 | _XkbReadVirtualMods(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) |
| 344 | { |
| 345 | if (rep->virtualMods) { |
| 346 | register int i, bit, nVMods; |
| 347 | register char *data; |
| 348 | |
| 349 | for (i = nVMods = 0, bit = 1; i < XkbNumVirtualMods16; i++, bit <<= 1) { |
| 350 | if (rep->virtualMods & bit) |
| 351 | nVMods++; |
| 352 | } |
| 353 | data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)((((unsigned int)(nVMods)+3) >> 2) << 2)); |
| 354 | if (data == NULL((void*)0)) |
| 355 | return BadLength16; |
| 356 | for (i = 0, bit = 1; (i < XkbNumVirtualMods16) && (nVMods > 0); |
| 357 | i++, bit <<= 1) { |
| 358 | if (rep->virtualMods & bit) { |
| 359 | xkb->server->vmods[i] = *data++; |
| 360 | nVMods--; |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | return Success0; |
| 365 | } |
| 366 | |
| 367 | static Statusint |
| 368 | _XkbReadExplicitComponents(XkbReadBufferPtr buf, |
| 369 | XkbDescPtr xkb, |
| 370 | xkbGetMapReply *rep) |
| 371 | { |
| 372 | register int i; |
| 373 | unsigned char *wire; |
| 374 | |
| 375 | if (rep->totalKeyExplicit > 0) { |
| 376 | int size = xkb->max_key_code + 1; |
| 377 | |
| 378 | if (((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) |
| 379 | return BadLength16; |
| 380 | if (xkb->server->explicit == NULL((void*)0)) { |
| 381 | xkb->server->explicit = _XkbTypedCalloc(size, unsigned char)((unsigned char *)calloc((((size)) == 0 ? 1 : ((size))), (sizeof (unsigned char)))); |
| 382 | |
| 383 | if (xkb->server->explicit == NULL((void*)0)) |
| 384 | return BadAlloc11; |
| 385 | } |
| 386 | else { |
| 387 | bzero(&xkb->server->explicit[rep->firstKeyExplicit],__builtin___memset_chk (&xkb->server->explicit[rep-> firstKeyExplicit], 0, rep->nKeyExplicit, __builtin_object_size (&xkb->server->explicit[rep->firstKeyExplicit], 0)) |
| 388 | rep->nKeyExplicit)__builtin___memset_chk (&xkb->server->explicit[rep-> firstKeyExplicit], 0, rep->nKeyExplicit, __builtin_object_size (&xkb->server->explicit[rep->firstKeyExplicit], 0)); |
| 389 | } |
| 390 | i = XkbPaddedSize(2 * rep->totalKeyExplicit)((((unsigned int)(2 * rep->totalKeyExplicit)+3) >> 2 ) << 2); |
| 391 | wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); |
| 392 | if (!wire) |
| 393 | return BadLength16; |
| 394 | for (i = 0; i < rep->totalKeyExplicit; i++, wire += 2) { |
| 395 | if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) |
| 396 | return BadLength16; |
| 397 | xkb->server->explicit[wire[0]] = wire[1]; |
| 398 | } |
| 399 | } |
| 400 | return Success0; |
| 401 | } |
| 402 | |
| 403 | static Statusint |
| 404 | _XkbReadModifierMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) |
| 405 | { |
| 406 | register int i; |
| 407 | unsigned char *wire; |
| 408 | |
| 409 | if (rep->totalModMapKeys > 0) { |
| 410 | if (((int) rep->firstModMapKey + rep->nModMapKeys) > |
| 411 | (xkb->max_key_code + 1)) |
| 412 | return BadLength16; |
| 413 | if ((xkb->map->modmap == NULL((void*)0)) && |
| 414 | (XkbAllocClientMap(xkb, XkbModifierMapMask(1<<2), 0) != Success0)) { |
| 415 | return BadAlloc11; |
| 416 | } |
| 417 | else { |
| 418 | bzero(&xkb->map->modmap[rep->firstModMapKey], rep->nModMapKeys)__builtin___memset_chk (&xkb->map->modmap[rep->firstModMapKey ], 0, rep->nModMapKeys, __builtin_object_size (&xkb-> map->modmap[rep->firstModMapKey], 0)); |
| 419 | } |
| 420 | i = XkbPaddedSize(2 * rep->totalModMapKeys)((((unsigned int)(2 * rep->totalModMapKeys)+3) >> 2) << 2); |
| 421 | wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); |
| 422 | if (!wire) |
| 423 | return BadLength16; |
| 424 | for (i = 0; i < rep->totalModMapKeys; i++, wire += 2) { |
| 425 | if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) |
| 426 | return BadLength16; |
| 427 | xkb->map->modmap[wire[0]] = wire[1]; |
| 428 | } |
| 429 | } |
| 430 | return Success0; |
| 431 | } |
| 432 | |
| 433 | static Statusint |
| 434 | _XkbReadVirtualModMap(XkbReadBufferPtr buf, |
| 435 | XkbDescPtr xkb, |
| 436 | xkbGetMapReply *rep) |
| 437 | { |
| 438 | register int i; |
| 439 | xkbVModMapWireDesc *wire; |
| 440 | XkbServerMapPtr srv; |
| 441 | |
| 442 | if (rep->totalVModMapKeys > 0) { |
| 443 | if (((int) rep->firstVModMapKey + rep->nVModMapKeys) |
| 444 | > xkb->max_key_code + 1) |
| 445 | return BadLength16; |
| 446 | if (((xkb->server == NULL((void*)0)) || (xkb->server->vmodmap == NULL((void*)0))) && |
| 447 | (XkbAllocServerMap(xkb, XkbVirtualModMapMask(1<<7), 0) != Success0)) { |
| 448 | return BadAlloc11; |
| 449 | } |
| 450 | else { |
| 451 | srv = xkb->server; |
| 452 | if (rep->nVModMapKeys > rep->firstVModMapKey) |
| 453 | bzero((char *) &srv->vmodmap[rep->firstVModMapKey],__builtin___memset_chk ((char *) &srv->vmodmap[rep-> firstVModMapKey], 0, (rep->nVModMapKeys - rep->firstVModMapKey ) * sizeof(unsigned short), __builtin_object_size ((char *) & srv->vmodmap[rep->firstVModMapKey], 0)) |
| 454 | (rep->nVModMapKeys - rep->firstVModMapKey) *__builtin___memset_chk ((char *) &srv->vmodmap[rep-> firstVModMapKey], 0, (rep->nVModMapKeys - rep->firstVModMapKey ) * sizeof(unsigned short), __builtin_object_size ((char *) & srv->vmodmap[rep->firstVModMapKey], 0)) |
| 455 | sizeof(unsigned short))__builtin___memset_chk ((char *) &srv->vmodmap[rep-> firstVModMapKey], 0, (rep->nVModMapKeys - rep->firstVModMapKey ) * sizeof(unsigned short), __builtin_object_size ((char *) & srv->vmodmap[rep->firstVModMapKey], 0)); |
| 456 | } |
| 457 | srv = xkb->server; |
| 458 | i = rep->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc)4; |
| 459 | wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); |
| 460 | if (!wire) |
| 461 | return BadLength16; |
| 462 | for (i = 0; i < rep->totalVModMapKeys; i++, wire++) { |
| 463 | if ((wire->key >= xkb->min_key_code) && |
| 464 | (wire->key <= xkb->max_key_code)) |
| 465 | srv->vmodmap[wire->key] = wire->vmods; |
| 466 | } |
| 467 | } |
| 468 | return Success0; |
| 469 | } |
| 470 | |
| 471 | static xkbGetMapReq * |
| 472 | _XkbGetGetMapReq(Display *dpy, XkbDescPtr xkb) |
| 473 | { |
| 474 | xkbGetMapReq *req; |
| 475 | |
| 476 | GetReq(kbGetMap, req)req = (xkbGetMapReq *) _XGetRequest(dpy, 8, 28); |
| 477 | req->reqType = dpy->xkb_info->codes->major_opcode; |
| 478 | req->xkbReqType = X_kbGetMap8; |
| 479 | req->deviceSpec = xkb->device_spec; |
| 480 | req->full = req->partial = 0; |
| 481 | req->firstType = req->nTypes = 0; |
| 482 | req->firstKeySym = req->nKeySyms = 0; |
| 483 | req->firstKeyAct = req->nKeyActs = 0; |
| 484 | req->firstKeyBehavior = req->nKeyBehaviors = 0; |
| 485 | req->virtualMods = 0; |
| 486 | req->firstKeyExplicit = req->nKeyExplicit = 0; |
| 487 | req->firstModMapKey = req->nModMapKeys = 0; |
| 488 | req->firstVModMapKey = req->nVModMapKeys = 0; |
| 489 | return req; |
| 490 | } |
| 491 | |
| 492 | Statusint |
| 493 | _XkbReadGetMapReply(Display *dpy, |
| 494 | xkbGetMapReply *rep, |
| 495 | XkbDescPtr xkb, |
| 496 | int *nread_rtrn) |
| 497 | { |
| 498 | int extraData; |
| 499 | unsigned mask; |
| 500 | |
| 501 | if (xkb->device_spec == XkbUseCoreKbd0x0100) |
| 502 | xkb->device_spec = rep->deviceID; |
| 503 | if (rep->maxKeyCode < rep->minKeyCode) |
| 504 | return BadImplementation17; |
| 505 | xkb->min_key_code = rep->minKeyCode; |
| 506 | xkb->max_key_code = rep->maxKeyCode; |
| 507 | |
| 508 | if (!xkb->map) { |
| 509 | mask = rep->present & XkbAllClientInfoMask((1<<0)|(1<<1)|(1<<2)); |
| 510 | if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success0)) |
| 511 | return BadAlloc11; |
| 512 | } |
| 513 | if (!xkb->server) { |
| 514 | mask = rep->present & XkbAllServerInfoMask((1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<< 7)); |
| 515 | if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success0)) |
| 516 | return BadAlloc11; |
| 517 | } |
| 518 | extraData = (int) (rep->length * 4); |
| 519 | extraData -= (SIZEOF(xkbGetMapReply)40 - SIZEOF(xGenericReply)32); |
| 520 | if (rep->length) { |
| 521 | XkbReadBufferRec buf; |
| 522 | int left; |
| 523 | |
| 524 | if (_XkbInitReadBuffer(dpy, &buf, extraData)) { |
| 525 | Statusint status = Success0; |
| 526 | |
| 527 | if (nread_rtrn != NULL((void*)0)) |
| 528 | *nread_rtrn = extraData; |
| 529 | if (status == Success0) |
| 530 | status = _XkbReadKeyTypes(&buf, xkb, rep); |
| 531 | if (status == Success0) |
| 532 | status = _XkbReadKeySyms(&buf, xkb, rep); |
| 533 | if (status == Success0) |
| 534 | status = _XkbReadKeyActions(&buf, xkb, rep); |
| 535 | if (status == Success0) |
| 536 | status = _XkbReadKeyBehaviors(&buf, xkb, rep); |
| 537 | if (status == Success0) |
| 538 | status = _XkbReadVirtualMods(&buf, xkb, rep); |
| 539 | if (status == Success0) |
| 540 | status = _XkbReadExplicitComponents(&buf, xkb, rep); |
| 541 | if (status == Success0) |
| 542 | status = _XkbReadModifierMap(&buf, xkb, rep); |
| 543 | if (status == Success0) |
| 544 | status = _XkbReadVirtualModMap(&buf, xkb, rep); |
| 545 | left = _XkbFreeReadBuffer(&buf); |
| 546 | if (status != Success0) |
| 547 | return status; |
| 548 | else if (left || buf.error) |
| 549 | return BadLength16; |
| 550 | } |
| 551 | else |
| 552 | return BadAlloc11; |
| 553 | } |
| 554 | return Success0; |
| 555 | } |
| 556 | |
| 557 | static Statusint |
| 558 | _XkbHandleGetMapReply(Display *dpy, XkbDescPtr xkb) |
| 559 | { |
| 560 | xkbGetMapReply rep; |
| 561 | |
| 562 | if (!_XReply(dpy, (xReply *) &rep, |
| 563 | ((SIZEOF(xkbGetMapReply)40 - SIZEOF(xGenericReply)32) >> 2), |
| 564 | xFalse0)) { |
| 565 | return BadImplementation17; |
| 566 | } |
| 567 | return _XkbReadGetMapReply(dpy, &rep, xkb, NULL((void*)0)); |
| 568 | } |
| 569 | |
| 570 | Statusint |
| 571 | XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) |
| 572 | { |
| 573 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 574 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 575 | return BadAccess10; |
| 576 | if (which) { |
| 577 | register xkbGetMapReq *req; |
| 578 | Statusint status; |
| 579 | |
| 580 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 581 | |
| 582 | req = _XkbGetGetMapReq(dpy, xkb); |
| 583 | req->full = which; |
| 584 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 585 | |
| 586 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 587 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 588 | return status; |
| 589 | } |
| 590 | return Success0; |
| 591 | } |
| 592 | |
| 593 | XkbDescPtr |
| 594 | XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) |
| 595 | { |
| 596 | XkbDescPtr xkb; |
| 597 | |
| 598 | xkb = _XkbTypedCalloc(1, XkbDescRec)((XkbDescRec *)calloc((((1)) == 0 ? 1 : ((1))), (sizeof(XkbDescRec )))); |
| 599 | if (xkb) { |
| 600 | xkb->device_spec = deviceSpec; |
| 601 | xkb->map = _XkbTypedCalloc(1, XkbClientMapRec)((XkbClientMapRec *)calloc((((1)) == 0 ? 1 : ((1))), (sizeof( XkbClientMapRec)))); |
| 602 | if ((xkb->map == NULL((void*)0)) || |
| 603 | ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success0))) { |
| 604 | if (xkb->map) { |
| 605 | Xfree(xkb->map)free((xkb->map)); |
| 606 | xkb->map = NULL((void*)0); |
| 607 | } |
| 608 | Xfree(xkb)free((xkb)); |
| 609 | return NULL((void*)0); |
| 610 | } |
| 611 | xkb->dpy = dpy; |
| 612 | } |
| 613 | return xkb; |
| 614 | } |
| 615 | |
| 616 | Statusint |
| 617 | XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) |
| 618 | { |
| 619 | register xkbGetMapReq *req; |
| 620 | Statusint status; |
| 621 | |
| 622 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 623 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 624 | return BadAccess10; |
| 625 | if ((num < 1) || (num > XkbMaxKeyTypes255)) |
| 626 | return BadValue2; |
| 627 | |
| 628 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 629 | |
| 630 | req = _XkbGetGetMapReq(dpy, xkb); |
| 631 | req->firstType = first; |
| 632 | req->nTypes = num; |
| 633 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 634 | |
| 635 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 636 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 637 | return status; |
| 638 | } |
| 639 | |
| 640 | Statusint |
| 641 | XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) |
| 642 | { |
| 643 | register xkbGetMapReq *req; |
| 644 | Statusint status; |
| 645 | |
| 646 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 647 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 648 | return BadAccess10; |
| 649 | |
| 650 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 651 | return BadValue2; |
| 652 | |
| 653 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 654 | |
| 655 | req = _XkbGetGetMapReq(dpy, xkb); |
| 656 | req->firstKeyAct = first; |
| 657 | req->nKeyActs = num; |
| 658 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 659 | |
| 660 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 661 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 662 | return status; |
| 663 | } |
| 664 | |
| 665 | Statusint |
| 666 | XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) |
| 667 | { |
| 668 | register xkbGetMapReq *req; |
| 669 | Statusint status; |
| 670 | |
| 671 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 672 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 673 | return BadAccess10; |
| 674 | |
| 675 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 676 | return BadValue2; |
| 677 | |
| 678 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 679 | |
| 680 | req = _XkbGetGetMapReq(dpy, xkb); |
| 681 | req->firstKeySym = first; |
| 682 | req->nKeySyms = num; |
| 683 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 684 | |
| 685 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 686 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 687 | |
| 688 | return status; |
| 689 | } |
| 690 | |
| 691 | Statusint |
| 692 | XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) |
| 693 | { |
| 694 | register xkbGetMapReq *req; |
| 695 | Statusint status; |
| 696 | |
| 697 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 698 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 699 | return BadAccess10; |
| 700 | |
| 701 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 702 | return BadValue2; |
| 703 | |
| 704 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 705 | |
| 706 | req = _XkbGetGetMapReq(dpy, xkb); |
| 707 | req->firstKeyBehavior = first; |
| 708 | req->nKeyBehaviors = num; |
| 709 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 710 | |
| 711 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 712 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 713 | return status; |
| 714 | } |
| 715 | |
| 716 | Statusint |
| 717 | XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) |
| 718 | { |
| 719 | register xkbGetMapReq *req; |
| 720 | Statusint status; |
| 721 | |
| 722 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 723 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 724 | return BadAccess10; |
| 725 | |
| 726 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 727 | |
| 728 | req = _XkbGetGetMapReq(dpy, xkb); |
| 729 | req->virtualMods = which; |
| 730 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 731 | |
| 732 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 733 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 734 | return status; |
| 735 | } |
| 736 | |
| 737 | Statusint |
| 738 | XkbGetKeyExplicitComponents(Display *dpy, |
| 739 | unsigned first, |
| 740 | unsigned num, |
| 741 | XkbDescPtr xkb) |
| 742 | { |
| 743 | register xkbGetMapReq *req; |
| 744 | Statusint status; |
| 745 | |
| 746 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 747 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 748 | return BadAccess10; |
| 749 | |
| 750 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 751 | return BadValue2; |
| 752 | |
| 753 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 754 | |
| 755 | req = _XkbGetGetMapReq(dpy, xkb); |
| 756 | req->firstKeyExplicit = first; |
| 757 | req->nKeyExplicit = num; |
| 758 | if ((xkb != NULL((void*)0)) && (xkb->server != NULL((void*)0)) && |
| 759 | (xkb->server->explicit != NULL((void*)0))) { |
| 760 | if ((num > 0) && (first >= xkb->min_key_code) && |
| 761 | (first + num <= xkb->max_key_code)) |
| 762 | bzero(&xkb->server->explicit[first], num)__builtin___memset_chk (&xkb->server->explicit[first ], 0, num, __builtin_object_size (&xkb->server->explicit [first], 0)); |
| 763 | } |
| 764 | if (xkb) |
| 765 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 766 | else |
| 767 | status = BadMatch8; |
| 768 | |
| 769 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 770 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 771 | return status; |
| 772 | } |
| 773 | |
| 774 | Statusint |
| 775 | XkbGetKeyModifierMap(Display *dpy, |
| 776 | unsigned first, |
| 777 | unsigned num, |
| 778 | XkbDescPtr xkb) |
| 779 | { |
| 780 | register xkbGetMapReq *req; |
| 781 | Statusint status; |
| 782 | |
| 783 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 784 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 785 | return BadAccess10; |
| 786 | |
| 787 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 788 | return BadValue2; |
| 789 | |
| 790 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 791 | |
| 792 | req = _XkbGetGetMapReq(dpy, xkb); |
| 793 | req->firstModMapKey = first; |
| 794 | req->nModMapKeys = num; |
| 795 | if ((xkb != NULL((void*)0)) && (xkb->map != NULL((void*)0)) && (xkb->map->modmap != NULL((void*)0))) { |
| 796 | if ((num > 0) && (first >= xkb->min_key_code) && |
| 797 | (first + num <= xkb->max_key_code)) |
| 798 | bzero(&xkb->map->modmap[first], num)__builtin___memset_chk (&xkb->map->modmap[first], 0 , num, __builtin_object_size (&xkb->map->modmap[first ], 0)); |
| 799 | } |
| 800 | if (xkb) |
| 801 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 802 | else |
| 803 | status = BadMatch8; |
| 804 | |
| 805 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 806 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 807 | return status; |
| 808 | } |
| 809 | |
| 810 | Statusint |
| 811 | XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, |
| 812 | XkbDescPtr xkb) |
| 813 | { |
| 814 | register xkbGetMapReq *req; |
| 815 | Statusint status; |
| 816 | |
| 817 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 818 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 819 | return BadAccess10; |
| 820 | |
| 821 | if ((num < 1) || (num > XkbMaxKeyCount(255 -8 +1))) |
| 822 | return BadValue2; |
| 823 | |
| 824 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 825 | |
| 826 | req = _XkbGetGetMapReq(dpy, xkb); |
| 827 | req->firstVModMapKey = first; |
| 828 | req->nVModMapKeys = num; |
| 829 | if ((xkb != NULL((void*)0)) && (xkb->map != NULL((void*)0)) && (xkb->map->modmap != NULL((void*)0))) { |
| 830 | if ((num > 0) && (first >= xkb->min_key_code) && |
| 831 | (first + num <= xkb->max_key_code)) |
| 832 | bzero(&xkb->server->vmodmap[first], num * sizeof(unsigned short))__builtin___memset_chk (&xkb->server->vmodmap[first ], 0, num * sizeof(unsigned short), __builtin_object_size (& xkb->server->vmodmap[first], 0)); |
| 833 | } |
| 834 | |
| 835 | if (xkb) |
| 836 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 837 | else |
| 838 | status = BadMatch8; |
| 839 | |
| 840 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 841 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 842 | return status; |
| 843 | } |
| 844 | |
| 845 | Statusint |
| 846 | XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) |
| 847 | { |
| 848 | xkbGetMapReq *req; |
| 849 | |
| 850 | if ((dpy->flags & XlibDisplayNoXkb(1L << 2)) || |
| 851 | (!dpy->xkb_info && !XkbUseExtension(dpy, NULL((void*)0), NULL((void*)0)))) |
| 852 | return BadAccess10; |
| 853 | LockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->lock_display )(dpy); |
| 854 | if (changes->changed) { |
| 855 | Statusint status = Success0; |
| 856 | |
| 857 | req = _XkbGetGetMapReq(dpy, xkb); |
| 858 | req->full = 0; |
| 859 | req->partial = changes->changed; |
| 860 | req->firstType = changes->first_type; |
| 861 | req->nTypes = changes->num_types; |
| 862 | req->firstKeySym = changes->first_key_sym; |
| 863 | req->nKeySyms = changes->num_key_syms; |
| 864 | req->firstKeyAct = changes->first_key_act; |
| 865 | req->nKeyActs = changes->num_key_acts; |
| 866 | req->firstKeyBehavior = changes->first_key_behavior; |
| 867 | req->nKeyBehaviors = changes->num_key_behaviors; |
| 868 | req->virtualMods = changes->vmods; |
| 869 | req->firstKeyExplicit = changes->first_key_explicit; |
| 870 | req->nKeyExplicit = changes->num_key_explicit; |
| 871 | req->firstModMapKey = changes->first_modmap_key; |
| 872 | req->nModMapKeys = changes->num_modmap_keys; |
| 873 | req->firstVModMapKey = changes->first_vmodmap_key; |
| 874 | req->nVModMapKeys = changes->num_vmodmap_keys; |
| 875 | status = _XkbHandleGetMapReply(dpy, xkb); |
| 876 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 877 | SyncHandle()if (dpy->synchandler) (*dpy->synchandler)(dpy); |
| 878 | return status; |
| 879 | } |
| 880 | UnlockDisplay(dpy)if ((dpy)->lock_fns) (*(dpy)->lock_fns->unlock_display )(dpy); |
| 881 | return Success0; |
| 882 | } |