Use CARD32 instead of Atom, drag in XkbClientMapRec

On 64-bit architectures, XID varies in size between the server (always
32 bits), and non-server (always unsigned long) for some inexplicable
reason.  Use CARD32 instead to avoid this horrible trap.

This involves dragging in XkbClientMapRec so we don't get stuck in the
KeySym trap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2010-06-17 03:16:09 +01:00
parent d2d787df65
commit 60e7eeeba1
15 changed files with 109 additions and 71 deletions

View File

@ -34,6 +34,9 @@ authorization from the authors.
#include <X11/extensions/XKBstrcommon.h> #include <X11/extensions/XKBstrcommon.h>
#include <X11/extensions/XKBrulescommon.h> #include <X11/extensions/XKBrulescommon.h>
#define KeySym CARD32
#define Atom CARD32
/* Action structures used in the server */ /* Action structures used in the server */
#define XkbcAnyActionDataSize 18 #define XkbcAnyActionDataSize 18
@ -121,6 +124,35 @@ typedef union _XkbcAction {
unsigned char type; unsigned char type;
} XkbcAction; } XkbcAction;
typedef struct _XkbcSymInterpretRec {
CARD32 sym;
unsigned char flags;
unsigned char match;
unsigned char mods;
unsigned char virtual_mod;
XkbcAnyAction act;
} XkbcSymInterpretRec,*XkbcSymInterpretPtr;
typedef struct _XkbcCompatMapRec {
XkbcSymInterpretPtr sym_interpret;
XkbModsRec groups[XkbNumKbdGroups];
unsigned short num_si;
unsigned short size_si;
} XkbcCompatMapRec, *XkbcCompatMapPtr;
typedef struct _XkbcClientMapRec {
unsigned char size_types;
unsigned char num_types;
XkbKeyTypePtr types;
unsigned short size_syms;
unsigned short num_syms;
uint32_t *syms;
XkbSymMapPtr key_sym_map;
unsigned char *modmap;
} XkbcClientMapRec, *XkbcClientMapPtr;
typedef struct _XkbcServerMapRec { typedef struct _XkbcServerMapRec {
unsigned short num_acts; unsigned short num_acts;
unsigned short size_acts; unsigned short size_acts;
@ -150,7 +182,7 @@ typedef struct _XkbcDesc {
XkbControlsPtr ctrls; XkbControlsPtr ctrls;
XkbcServerMapPtr server; XkbcServerMapPtr server;
XkbClientMapPtr map; XkbcClientMapPtr map;
XkbIndicatorPtr indicators; XkbIndicatorPtr indicators;
XkbNamesPtr names; XkbNamesPtr names;
XkbCompatMapPtr compat; XkbCompatMapPtr compat;
@ -199,17 +231,23 @@ XkbcCanonicaliseComponents(XkbComponentNamesPtr names,
* The string returned may become invalidated after the next call to * The string returned may become invalidated after the next call to
* XkbcKeysymToString: if you need to preserve it, then you must * XkbcKeysymToString: if you need to preserve it, then you must
* duplicate it. * duplicate it.
*
* This is CARD32 rather than KeySym, as KeySym changes size between
* client and server (no, really).
*/ */
extern char * extern char *
XkbcKeysymToString(KeySym ks); XkbcKeysymToString(CARD32 ks);
/* /*
* See XkbcKeysymToString comments: this function will accept any string * See XkbcKeysymToString comments: this function will accept any string
* from that function. * from that function.
*/ */
extern KeySym extern CARD32
XkbcStringToKeysym(const char *s); XkbcStringToKeysym(const char *s);
_XFUNCPROTOEND _XFUNCPROTOEND
#undef KeySym
#undef Atom
#endif /* _XKBCOMMON_H_ */ #endif /* _XKBCOMMON_H_ */

View File

@ -136,7 +136,7 @@ XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
type = xkb->map->types; type = xkb->map->types;
for (i = 0; i < xkb->map->num_types; i++, type++) { for (i = 0; i < xkb->map->num_types; i++, type++) {
if (!type->level_names) { if (!type->level_names) {
type->level_names = _XkbTypedCalloc(type->num_levels, Atom); type->level_names = _XkbTypedCalloc(type->num_levels, CARD32);
if (!type->level_names) if (!type->level_names)
return BadAlloc; return BadAlloc;
} }
@ -181,15 +181,15 @@ XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
if ((which & XkbRGNamesMask) && (nTotalRG > 0)) { if ((which & XkbRGNamesMask) && (nTotalRG > 0)) {
if (!names->radio_groups) if (!names->radio_groups)
names->radio_groups = _XkbTypedCalloc(nTotalRG, Atom); names->radio_groups = _XkbTypedCalloc(nTotalRG, CARD32);
else if (nTotalRG > names->num_rg) { else if (nTotalRG > names->num_rg) {
Atom *prev_radio_groups = names->radio_groups; CARD32 *prev_radio_groups = names->radio_groups;
names->radio_groups = _XkbTypedRealloc(names->radio_groups, names->radio_groups = _XkbTypedRealloc(names->radio_groups,
nTotalRG, Atom); nTotalRG, CARD32);
if (names->radio_groups) if (names->radio_groups)
_XkbClearElems(names->radio_groups, names->num_rg, _XkbClearElems(names->radio_groups, names->num_rg,
nTotalRG - 1, Atom); nTotalRG - 1, CARD32);
else else
_XkbFree(prev_radio_groups); _XkbFree(prev_radio_groups);
} }
@ -216,7 +216,7 @@ XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap)
which = XkbAllNamesMask; which = XkbAllNamesMask;
if (which & XkbKTLevelNamesMask) { if (which & XkbKTLevelNamesMask) {
XkbClientMapPtr map = xkb->map; XkbcClientMapPtr map = xkb->map;
if (map && map->types) { if (map && map->types) {
int i; int i;

View File

@ -38,7 +38,7 @@ authorization from the authors.
#include "ks_tables.h" #include "ks_tables.h"
char * char *
XkbcKeysymToString(KeySym ks) XkbcKeysymToString(CARD32 ks)
{ {
int i, n, h, idx; int i, n, h, idx;
const unsigned char *entry; const unsigned char *entry;
@ -91,7 +91,7 @@ XkbcKeysymToString(KeySym ks)
return ret; return ret;
} }
KeySym CARD32
XkbcStringToKeysym(const char *s) XkbcStringToKeysym(const char *s)
{ {
int i, n, h, c, idx; int i, n, h, c, idx;
@ -99,7 +99,7 @@ XkbcStringToKeysym(const char *s)
const char *p = s; const char *p = s;
const unsigned char *entry; const unsigned char *entry;
unsigned char sig1, sig2; unsigned char sig1, sig2;
KeySym val; CARD32 val;
while ((c = *p++)) while ((c = *p++))
sig = (sig << 1) + c; sig = (sig << 1) + c;

View File

@ -32,7 +32,7 @@ int
XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes) XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes)
{ {
int i; int i;
XkbClientMapPtr map; XkbcClientMapPtr map;
if (!xkb || ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes))) if (!xkb || ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes)))
return BadValue; return BadValue;
@ -49,7 +49,7 @@ XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes)
} }
if (!xkb->map) { if (!xkb->map) {
map = _XkbTypedCalloc(1, XkbClientMapRec); map = _XkbTypedCalloc(1, XkbcClientMapRec);
if (!map) if (!map)
return BadAlloc; return BadAlloc;
xkb->map = map; xkb->map = map;
@ -88,7 +88,7 @@ XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes)
if (!map->syms) { if (!map->syms) {
map->size_syms = (nKeys * 15) / 10; map->size_syms = (nKeys * 15) / 10;
map->syms = _XkbTypedCalloc(map->size_syms, KeySym); map->syms = _XkbTypedCalloc(map->size_syms, uint32_t);
if (!map->syms) { if (!map->syms) {
map->size_syms = 0; map->size_syms = 0;
return BadAlloc; return BadAlloc;
@ -268,11 +268,11 @@ XkbcCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into)
} }
if (from->level_names && (into->num_levels > 0)) { if (from->level_names && (into->num_levels > 0)) {
into->level_names = _XkbTypedCalloc(into->num_levels, Atom); into->level_names = _XkbTypedCalloc(into->num_levels, CARD32);
if (!into->level_names) if (!into->level_names)
return BadAlloc; return BadAlloc;
memcpy(into->level_names, from->level_names, memcpy(into->level_names, from->level_names,
into->num_levels * sizeof(Atom)); into->num_levels * sizeof(CARD32));
} }
return Success; return Success;
@ -362,10 +362,10 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
} }
if ((new_num_lvls > type->num_levels) || !type->level_names) { if ((new_num_lvls > type->num_levels) || !type->level_names) {
Atom *prev_level_names = type->level_names; CARD32 *prev_level_names = type->level_names;
type->level_names = _XkbTypedRealloc(type->level_names, new_num_lvls, type->level_names = _XkbTypedRealloc(type->level_names, new_num_lvls,
Atom); CARD32);
if (!type->level_names) { if (!type->level_names) {
if (prev_level_names) if (prev_level_names)
_XkbFree(prev_level_names); _XkbFree(prev_level_names);
@ -398,7 +398,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
nMatchingKeys = 0; nMatchingKeys = 0;
if (new_num_lvls > type->num_levels) { if (new_num_lvls > type->num_levels) {
int nTotal; int nTotal;
KeySym *newSyms; CARD32 *newSyms;
int width, match, nResize = 0; int width, match, nResize = 0;
int i, g, nSyms; int i, g, nSyms;
@ -427,7 +427,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
int nextMatch; int nextMatch;
xkb->map->size_syms = (nTotal * 12) / 10; xkb->map->size_syms = (nTotal * 12) / 10;
newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); newSyms = _XkbTypedCalloc(xkb->map->size_syms, CARD32);
if (!newSyms) if (!newSyms)
return BadAlloc; return BadAlloc;
nextMatch = 0; nextMatch = 0;
@ -435,20 +435,20 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
if (matchingKeys[nextMatch] == i) { if (matchingKeys[nextMatch] == i) {
KeySym *pOld; CARD32 *pOld;
nextMatch++; nextMatch++;
width = XkbKeyGroupsWidth(xkb, i); width = XkbKeyGroupsWidth(xkb, i);
pOld = XkbKeySymsPtr(xkb, i); pOld = XkbKeySymsPtr(xkb, i);
for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--) for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--)
memcpy(&newSyms[nSyms+(new_num_lvls * g)], memcpy(&newSyms[nSyms+(new_num_lvls * g)],
&pOld[width * g], width * sizeof(KeySym)); &pOld[width * g], width * sizeof(CARD32));
xkb->map->key_sym_map[i].offset = nSyms; xkb->map->key_sym_map[i].offset = nSyms;
nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls; nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls;
} }
else { else {
memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
XkbKeyNumSyms(xkb, i) * sizeof(KeySym)); XkbKeyNumSyms(xkb, i) * sizeof(CARD32));
xkb->map->key_sym_map[i].offset = nSyms; xkb->map->key_sym_map[i].offset = nSyms;
nSyms += XkbKeyNumSyms(xkb,i); nSyms += XkbKeyNumSyms(xkb,i);
} }
@ -491,7 +491,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
firstClear = new_num_lvls; firstClear = new_num_lvls;
for (i = 0; i < nMatchingKeys; i++) { for (i = 0; i < nMatchingKeys; i++) {
KeySym *pSyms; CARD32 *pSyms;
int width, nClear; int width, nClear;
key = matchingKeys[i]; key = matchingKeys[i];
@ -502,7 +502,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) { if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) {
if (nClear>0) if (nClear>0)
bzero(&pSyms[g * width + firstClear], bzero(&pSyms[g * width + firstClear],
nClear * sizeof(KeySym)); nClear * sizeof(CARD32));
} }
} }
} }
@ -513,12 +513,12 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
return Success; return Success;
} }
KeySym * CARD32 *
XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed) XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed)
{ {
int i, nSyms, nKeySyms; int i, nSyms, nKeySyms;
unsigned nOldSyms; unsigned nOldSyms;
KeySym *newSyms; CARD32 *newSyms;
if (needed == 0) { if (needed == 0) {
xkb->map->key_sym_map[key].offset = 0; xkb->map->key_sym_map[key].offset = 0;
@ -532,11 +532,11 @@ XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed)
if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned)needed) { if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned)needed) {
if (nOldSyms > 0) if (nOldSyms > 0)
memcpy(&xkb->map->syms[xkb->map->num_syms], memcpy(&xkb->map->syms[xkb->map->num_syms],
XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(KeySym)); XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(CARD32));
if ((needed - nOldSyms) > 0) if ((needed - nOldSyms) > 0)
bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)],
(needed - nOldSyms) * sizeof(KeySym)); (needed - nOldSyms) * sizeof(CARD32));
xkb->map->key_sym_map[key].offset = xkb->map->num_syms; xkb->map->key_sym_map[key].offset = xkb->map->num_syms;
xkb->map->num_syms += needed; xkb->map->num_syms += needed;
@ -545,7 +545,7 @@ XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed)
} }
xkb->map->size_syms += (needed > 32 ? needed : 32); xkb->map->size_syms += (needed > 32 ? needed : 32);
newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); newSyms = _XkbTypedCalloc(xkb->map->size_syms, CARD32);
if (!newSyms) if (!newSyms)
return NULL; return NULL;
@ -562,9 +562,9 @@ XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed)
nKeySyms = needed; nKeySyms = needed;
if (nCopy != 0) if (nCopy != 0)
memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
nCopy * sizeof(KeySym)); nCopy * sizeof(CARD32));
if (nKeySyms > nCopy) if (nKeySyms > nCopy)
bzero(&newSyms[nSyms+nCopy], (nKeySyms - nCopy) * sizeof(KeySym)); bzero(&newSyms[nSyms+nCopy], (nKeySyms - nCopy) * sizeof(CARD32));
xkb->map->key_sym_map[i].offset = nSyms; xkb->map->key_sym_map[i].offset = nSyms;
nSyms += nKeySyms; nSyms += nKeySyms;
@ -878,7 +878,7 @@ XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed)
void void
XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap) XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap)
{ {
XkbClientMapPtr map; XkbcClientMapPtr map;
if (!xkb || !xkb->map) if (!xkb || !xkb->map)
return; return;

View File

@ -86,7 +86,7 @@ static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
int int
XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod) XkbcInitCanonicalKeyTypes(XkbcDescPtr xkb, unsigned which, int keypadVMod)
{ {
XkbClientMapPtr map; XkbcClientMapPtr map;
XkbKeyTypePtr from,to; XkbKeyTypePtr from,to;
int rtrn; int rtrn;
@ -190,7 +190,7 @@ XkbcEnsureSafeMapName(char *name)
} }
unsigned unsigned
_XkbcKSCheckCase(KeySym ks) _XkbcKSCheckCase(CARD32 ks)
{ {
unsigned set = (ks & (~0xff)) >> 8; unsigned set = (ks & (~0xff)) >> 8;
unsigned rtrn = 0; unsigned rtrn = 0;

View File

@ -60,7 +60,7 @@ char *
XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx) XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx)
{ {
int len; int len;
Atom *vmodNames; CARD32 *vmodNames;
char *rtrn, *tmp = NULL; char *rtrn, *tmp = NULL;
if (xkb && xkb->names) if (xkb && xkb->names)
@ -280,7 +280,7 @@ XkbcActionTypeText(unsigned type)
} }
char * char *
XkbcKeysymText(KeySym sym) XkbcKeysymText(CARD32 sym)
{ {
return XkbcKeysymToString(sym); return XkbcKeysymToString(sym);
} }

View File

@ -82,7 +82,7 @@ extern int
XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count, XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
Bool want_preserve, int new_num_lvls); Bool want_preserve, int new_num_lvls);
extern KeySym * extern CARD32 *
XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed); XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed);
extern int extern int

View File

@ -1049,7 +1049,7 @@ ExprResolveKeySym(ExprDef * expr,
IdentLookupFunc lookup, char * lookupPriv) IdentLookupFunc lookup, char * lookupPriv)
{ {
int ok = 0; int ok = 0;
KeySym sym; CARD32 sym;
if (expr->op == ExprIdent) if (expr->op == ExprIdent)
{ {

View File

@ -1180,12 +1180,12 @@ CopyDefToKeyType(XkbcDescPtr xkb, XkbKeyTypePtr type, KeyTypeInfo * def)
type->name = (Atom) def->name; type->name = (Atom) def->name;
if (def->szNames > 0) if (def->szNames > 0)
{ {
type->level_names = uTypedCalloc(def->numLevels, Atom); type->level_names = uTypedCalloc(def->numLevels, CARD32);
/* assert def->szNames<=def->numLevels */ /* assert def->szNames<=def->numLevels */
for (i = 0; i < def->szNames; i++) for (i = 0; i < def->szNames; i++)
{ {
type->level_names[i] = (Atom) def->lvlNames[i]; type->level_names[i] = (CARD32) def->lvlNames[i];
} }
} }
else else

View File

@ -258,8 +258,8 @@ AddCommonInfo(CommonInfo * old, CommonInfo * new)
typedef struct _KeyNameDesc typedef struct _KeyNameDesc
{ {
KeySym level1; CARD32 level1;
KeySym level2; CARD32 level2;
char name[5]; char name[5];
Bool used; Bool used;
} KeyNameDesc; } KeyNameDesc;
@ -379,7 +379,7 @@ ComputeKbdDefaults(XkbcDescPtr xkb)
int rtrn; int rtrn;
register int i, tmp, nUnknown; register int i, tmp, nUnknown;
KeyNameDesc *name; KeyNameDesc *name;
KeySym *syms; uint32_t *syms;
if ((xkb->names == NULL) || (xkb->names->keys == NULL)) if ((xkb->names == NULL) || (xkb->names->keys == NULL))
{ {

View File

@ -219,7 +219,7 @@ BoolVarCreate(Atom nameToken, unsigned set)
} }
InterpDef * InterpDef *
InterpCreate(KeySym sym, ExprDef * match) InterpCreate(CARD32 sym, ExprDef * match)
{ {
InterpDef *def; InterpDef *def;
@ -621,9 +621,9 @@ AppendKeysymList(ExprDef * list, char *sym)
} }
int int
LookupKeysym(char *str, KeySym * sym_rtrn) LookupKeysym(char *str, CARD32 * sym_rtrn)
{ {
KeySym sym; CARD32 sym;
if ((!str) || (uStrCaseCmp(str, "any") == 0) if ((!str) || (uStrCaseCmp(str, "any") == 0)
|| (uStrCaseCmp(str, "nosymbol") == 0)) || (uStrCaseCmp(str, "nosymbol") == 0))

View File

@ -88,7 +88,7 @@ extern VarDef *BoolVarCreate(Atom /* nameToken */ ,
unsigned /* set */ unsigned /* set */
); );
extern InterpDef *InterpCreate(KeySym /* sym */ , extern InterpDef *InterpCreate(CARD32 /* sym */ ,
ExprDef * /* match */ ExprDef * /* match */
); );
@ -165,7 +165,7 @@ extern ExprDef *AppendKeysymList(ExprDef * /* list */ ,
); );
extern int LookupKeysym(char * /* str */ , extern int LookupKeysym(char * /* str */ ,
KeySym * /* sym_rtrn */ CARD32 * /* sym_rtrn */
); );
extern IncludeStmt *IncludeCreate(char * /* str */ , extern IncludeStmt *IncludeCreate(char * /* str */ ,

View File

@ -70,7 +70,7 @@ typedef struct _KeyInfo
unsigned char symsDefined; unsigned char symsDefined;
unsigned char actsDefined; unsigned char actsDefined;
short numLevels[XkbNumKbdGroups]; short numLevels[XkbNumKbdGroups];
KeySym *syms[XkbNumKbdGroups]; CARD32 *syms[XkbNumKbdGroups];
XkbcAction *acts[XkbNumKbdGroups]; XkbcAction *acts[XkbNumKbdGroups];
Atom types[XkbNumKbdGroups]; Atom types[XkbNumKbdGroups];
unsigned repeat; unsigned repeat;
@ -178,7 +178,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
width = new->numLevels[i]; width = new->numLevels[i];
if (old->syms[i] != NULL) if (old->syms[i] != NULL)
{ {
new->syms[i] = uTypedCalloc(width, KeySym); new->syms[i] = uTypedCalloc(width, CARD32);
if (!new->syms[i]) if (!new->syms[i])
{ {
new->syms[i] = NULL; new->syms[i] = NULL;
@ -186,7 +186,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
return False; return False;
} }
memcpy((char *) new->syms[i], (char *) old->syms[i], memcpy((char *) new->syms[i], (char *) old->syms[i],
width * sizeof(KeySym)); width * sizeof(CARD32));
} }
if (old->acts[i] != NULL) if (old->acts[i] != NULL)
{ {
@ -214,7 +214,7 @@ typedef struct _ModMapEntry
union union
{ {
unsigned long keyName; unsigned long keyName;
KeySym keySym; CARD32 keySym;
} u; } u;
} ModMapEntry; } ModMapEntry;
@ -315,7 +315,7 @@ ResizeKeyGroup(KeyInfo * key,
{ {
key->syms[group] = uTypedRecalloc(key->syms[group], key->syms[group] = uTypedRecalloc(key->syms[group],
key->numLevels[group], newWidth, key->numLevels[group], newWidth,
KeySym); CARD32);
if (!key->syms[group]) if (!key->syms[group])
return False; return False;
} }
@ -336,7 +336,7 @@ static Bool
MergeKeyGroups(SymbolsInfo * info, MergeKeyGroups(SymbolsInfo * info,
KeyInfo * into, KeyInfo * from, unsigned group) KeyInfo * into, KeyInfo * from, unsigned group)
{ {
KeySym *resultSyms; CARD32 *resultSyms;
XkbcAction *resultActs; XkbcAction *resultActs;
int resultWidth; int resultWidth;
register int i; register int i;
@ -359,7 +359,7 @@ MergeKeyGroups(SymbolsInfo * info,
} }
if (resultSyms == NULL) if (resultSyms == NULL)
{ {
resultSyms = uTypedCalloc(resultWidth, KeySym); resultSyms = uTypedCalloc(resultWidth, CARD32);
if (!resultSyms) if (!resultSyms)
{ {
WSGO("Could not allocate symbols for group merge\n"); WSGO("Could not allocate symbols for group merge\n");
@ -381,7 +381,7 @@ MergeKeyGroups(SymbolsInfo * info,
} }
for (i = 0; i < resultWidth; i++) for (i = 0; i < resultWidth; i++)
{ {
KeySym fromSym, toSym; CARD32 fromSym, toSym;
if (from->syms[group] && (i < from->numLevels[group])) if (from->syms[group] && (i < from->numLevels[group]))
fromSym = from->syms[group][i]; fromSym = from->syms[group][i];
else else
@ -396,7 +396,7 @@ MergeKeyGroups(SymbolsInfo * info,
resultSyms[i] = fromSym; resultSyms[i] = fromSym;
else else
{ {
KeySym use, ignore; CARD32 use, ignore;
if (clobber) if (clobber)
{ {
use = fromSym; use = fromSym;
@ -1565,7 +1565,7 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key)
key->numLevels[i] = 0; key->numLevels[i] = 0;
if (key->syms[i] != NULL) if (key->syms[i] != NULL)
uFree(key->syms[i]); uFree(key->syms[i]);
key->syms[i] = (KeySym *) NULL; key->syms[i] = (CARD32 *) NULL;
if (key->acts[i] != NULL) if (key->acts[i] != NULL)
uFree(key->acts[i]); uFree(key->acts[i]);
key->acts[i] = (XkbcAction *) NULL; key->acts[i] = (XkbcAction *) NULL;
@ -1577,7 +1577,7 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key)
key->numLevels[group] = key->numLevels[0]; key->numLevels[group] = key->numLevels[0];
key->numLevels[0] = 0; key->numLevels[0] = 0;
key->syms[group] = key->syms[0]; key->syms[group] = key->syms[0];
key->syms[0] = (KeySym *) NULL; key->syms[0] = (CARD32 *) NULL;
key->acts[group] = key->acts[0]; key->acts[group] = key->acts[0];
key->acts[0] = (XkbcAction *) NULL; key->acts[0] = (XkbcAction *) NULL;
key->types[group] = key->types[0]; key->types[group] = key->types[0];
@ -1720,7 +1720,7 @@ HandleSymbolsFile(XkbFile * file,
} }
static Bool static Bool
FindKeyForSymbol(XkbcDescPtr xkb, KeySym sym, unsigned int *kc_rtrn) FindKeyForSymbol(XkbcDescPtr xkb, CARD32 sym, unsigned int *kc_rtrn)
{ {
register int i, j; register int i, j;
register Bool gotOne; register Bool gotOne;
@ -1791,7 +1791,7 @@ FindNamedType(XkbcDescPtr xkb, Atom name, unsigned *type_rtrn)
* @returns True if a type could be found, False otherwise. * @returns True if a type could be found, False otherwise.
*/ */
static Bool static Bool
FindAutomaticType(int width, KeySym * syms, Atom * typeNameRtrn, FindAutomaticType(int width, CARD32 * syms, Atom * typeNameRtrn,
Bool * autoType) Bool * autoType)
{ {
*autoType = False; *autoType = False;
@ -1885,11 +1885,11 @@ PrepareKeyDef(KeyInfo * key)
} }
if ((key->symsDefined & 1) && key->syms[0]) if ((key->symsDefined & 1) && key->syms[0])
{ {
key->syms[i] = uTypedCalloc(width, KeySym); key->syms[i] = uTypedCalloc(width, CARD32);
if (key->syms[i] == NULL) if (key->syms[i] == NULL)
continue; continue;
memcpy((void *) key->syms[i], (void *) key->syms[0], memcpy((void *) key->syms[i], (void *) key->syms[0],
width * sizeof(KeySym)); width * sizeof(CARD32));
key->symsDefined |= 1 << i; key->symsDefined |= 1 << i;
} }
if (defined & 1) if (defined & 1)
@ -1911,7 +1911,7 @@ PrepareKeyDef(KeyInfo * key)
if ((key->syms[i] != key->syms[0]) && if ((key->syms[i] != key->syms[0]) &&
(key->syms[i] == NULL || key->syms[0] == NULL || (key->syms[i] == NULL || key->syms[0] == NULL ||
memcmp((void *) key->syms[i], (void *) key->syms[0], memcmp((void *) key->syms[i], (void *) key->syms[0],
sizeof(KeySym) * key->numLevels[0]))) sizeof(CARD32) * key->numLevels[0])))
{ {
identical = False; identical = False;
break; break;
@ -1932,7 +1932,7 @@ PrepareKeyDef(KeyInfo * key)
key->numLevels[i] = 0; key->numLevels[i] = 0;
if (key->syms[i] != NULL) if (key->syms[i] != NULL)
uFree(key->syms[i]); uFree(key->syms[i]);
key->syms[i] = (KeySym *) NULL; key->syms[i] = (CARD32 *) NULL;
if (key->acts[i] != NULL) if (key->acts[i] != NULL)
uFree(key->acts[i]); uFree(key->acts[i]);
key->acts[i] = (XkbcAction *) NULL; key->acts[i] = (XkbcAction *) NULL;
@ -1957,7 +1957,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from)
unsigned okc, kc, width, tmp, nGroups; unsigned okc, kc, width, tmp, nGroups;
XkbKeyTypePtr type; XkbKeyTypePtr type;
Bool haveActions, autoType, useAlias; Bool haveActions, autoType, useAlias;
KeySym *outSyms; CARD32 *outSyms;
XkbcAction *outActs; XkbcAction *outActs;
unsigned types[XkbNumKbdGroups]; unsigned types[XkbNumKbdGroups];

View File

@ -242,7 +242,7 @@ typedef struct _InterpDef
{ {
ParseCommon common; ParseCommon common;
unsigned merge; unsigned merge;
KeySym sym; CARD32 sym;
ExprDef *match; ExprDef *match;
VarDef *def; VarDef *def;
} InterpDef; } InterpDef;

View File

@ -52,7 +52,7 @@ extern void
XkbcEnsureSafeMapName(char *name); XkbcEnsureSafeMapName(char *name);
extern unsigned extern unsigned
_XkbcKSCheckCase(KeySym sym); _XkbcKSCheckCase(CARD32 sym);
#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower) #define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper) #define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
@ -95,7 +95,7 @@ extern char *
XkbcActionTypeText(unsigned type); XkbcActionTypeText(unsigned type);
extern char * extern char *
XkbcKeysymText(KeySym sym); XkbcKeysymText(CARD32 sym);
extern char * extern char *
XkbcKeyNameText(char *name); XkbcKeyNameText(char *name);