From 15b0db5492a2725d45011b8fef70006cc96fee0c Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 17 Jun 2010 05:56:08 +0100 Subject: [PATCH] Copy in XkbCompatMapRec and XkbSymInterpretRec These contain actions, so transition them ahead to XkbcAction and move them into XKBcommon.h. Signed-off-by: Daniel Stone --- include/X11/extensions/XKBcommon.h | 2 +- src/alloc.c | 14 ++++----- src/galloc.c | 4 ++- src/malloc.c | 2 +- src/xkbcomp/action.c | 46 +++++++++++++++--------------- src/xkbcomp/action.h | 2 +- src/xkbcomp/compat.c | 10 +++---- src/xkbcomp/symbols.c | 4 +-- 8 files changed, 43 insertions(+), 41 deletions(-) diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h index 3d451f8..6992cbd 100644 --- a/include/X11/extensions/XKBcommon.h +++ b/include/X11/extensions/XKBcommon.h @@ -185,7 +185,7 @@ typedef struct _XkbcDesc { XkbcClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; - XkbCompatMapPtr compat; + XkbcCompatMapPtr compat; XkbGeometryPtr geom; } XkbcDescRec, *XkbcDescPtr; diff --git a/src/alloc.c b/src/alloc.c index 173a4c2..1d1d069 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -35,8 +35,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. int XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI) { - XkbCompatMapPtr compat; - XkbSymInterpretRec *prev_interpret; + XkbcCompatMapPtr compat; + XkbcSymInterpretRec *prev_interpret; if (!xkb) return BadMatch; @@ -52,7 +52,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI) prev_interpret = compat->sym_interpret; compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret, - nSI, XkbSymInterpretRec); + nSI, XkbcSymInterpretRec); if (!compat->sym_interpret) { _XkbFree(prev_interpret); compat->size_si = compat->num_si = 0; @@ -61,17 +61,17 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI) if (compat->num_si != 0) _XkbClearElems(compat->sym_interpret, compat->num_si, - compat->size_si - 1, XkbSymInterpretRec); + compat->size_si - 1, XkbcSymInterpretRec); return Success; } - compat = _XkbTypedCalloc(1, XkbCompatMapRec); + compat = _XkbTypedCalloc(1, XkbcCompatMapRec); if (!compat) return BadAlloc; if (nSI > 0) { - compat->sym_interpret = _XkbTypedCalloc(nSI, XkbSymInterpretRec); + compat->sym_interpret = _XkbTypedCalloc(nSI, XkbcSymInterpretRec); if (!compat->sym_interpret) { _XkbFree(compat); return BadAlloc; @@ -89,7 +89,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI) void XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap) { - XkbCompatMapPtr compat; + XkbcCompatMapPtr compat; if (!xkb || !xkb->compat) return; diff --git a/src/galloc.c b/src/galloc.c index b45ce74..a81d9ba 100644 --- a/src/galloc.c +++ b/src/galloc.c @@ -556,7 +556,9 @@ XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts) int XkbcAllocGeomKeys(XkbRowPtr row, int nKeys) { - return _XkbAllocKeys(row, nKeys); + int ret = _XkbAllocKeys(row, nKeys); + fprintf(stderr, "!!! allocated %d keys at %p\n", nKeys, row->keys); + return ret; } int diff --git a/src/malloc.c b/src/malloc.c index 9b842a5..0211264 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -662,7 +662,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC, if (xkb->server->vmodmap) { bzero(&xkb->server->vmodmap[minKC], - tmp * sizeof(unsigned short)); + tmp * sizeof(uint32_t)); if (changes) changes->map.changed = _ExtendRange(changes->map.changed, XkbVirtualModMapMask, minKC, diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 1076030..63b2591 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -334,7 +334,7 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad) static Bool HandleNoAction(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { return ReportIllegal(action->type, field); @@ -392,7 +392,7 @@ CheckModifierField(XkbcDescPtr xkb, static Bool HandleSetLatchMods(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbcModAction *act; @@ -437,7 +437,7 @@ HandleSetLatchMods(XkbcDescPtr xkb, static Bool HandleLockMods(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbcModAction *act; @@ -512,7 +512,7 @@ CheckGroupField(unsigned action, static Bool HandleSetLatchGroup(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbGroupAction *act; @@ -557,7 +557,7 @@ HandleSetLatchGroup(XkbcDescPtr xkb, static Bool HandleLockGroup(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbGroupAction *act; @@ -583,7 +583,7 @@ HandleLockGroup(XkbcDescPtr xkb, static Bool HandleMovePtr(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -648,7 +648,7 @@ static LookupEntry lockWhich[] = { static Bool HandlePtrBtn(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -710,7 +710,7 @@ static LookupEntry ptrDflts[] = { static Bool HandleSetPtrDflt(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -783,7 +783,7 @@ static LookupEntry isoNames[] = { static Bool HandleISOLock(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -830,7 +830,7 @@ HandleISOLock(XkbcDescPtr xkb, static Bool HandleSwitchScreen(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -922,7 +922,7 @@ LookupEntry ctrlNames[] = { static Bool HandleSetLockControls(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -954,7 +954,7 @@ static LookupEntry evNames[] = { static Bool HandleActionMessage(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1032,7 +1032,7 @@ HandleActionMessage(XkbcDescPtr xkb, static Bool HandleRedirectKey(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1083,7 +1083,7 @@ HandleRedirectKey(XkbcDescPtr xkb, static Bool HandleDeviceBtn(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1153,7 +1153,7 @@ HandleDeviceBtn(XkbcDescPtr xkb, static Bool HandleDeviceValuator(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { #if 0 @@ -1168,7 +1168,7 @@ HandleDeviceValuator(XkbcDescPtr xkb, static Bool HandlePrivate(XkbcDescPtr xkb, - XkbAnyAction * action, + XkbcAnyAction * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1200,7 +1200,7 @@ HandlePrivate(XkbcDescPtr xkb, ACTION("Extra %d bytes ignored\n", len - 6); return False; } - strncpy((char *) action->data, rtrn.str, 7); + strncpy((char *) action->pad, rtrn.str, XkbcAnyActionDataSize); } free(rtrn.str); return True; @@ -1215,9 +1215,9 @@ HandlePrivate(XkbcDescPtr xkb, return False; } ndx = rtrn.uval; - if (ndx > 6) + if (ndx >= XkbcAnyActionDataSize) { - ERROR("The data for a private action is 7 bytes long\n"); + ERROR("The data for a private action is 18 bytes long\n"); ACTION("Attempt to use data[%d] ignored\n", ndx); return False; } @@ -1229,7 +1229,7 @@ HandlePrivate(XkbcDescPtr xkb, ACTION("Illegal datum %d ignored\n", rtrn.ival); return False; } - action->data[ndx] = rtrn.uval; + action->pad[ndx] = rtrn.uval; return True; } } @@ -1237,7 +1237,7 @@ HandlePrivate(XkbcDescPtr xkb, } typedef Bool(*actionHandler) (XkbcDescPtr /* xkb */ , - XkbAnyAction * /* action */ , + XkbcAnyAction * /* action */ , unsigned /* field */ , ExprDef * /* array_ndx */ , ExprDef * /* value */ @@ -1290,7 +1290,7 @@ ApplyActionFactoryDefaults(XkbcAction * action) int HandleActionDef(ExprDef * def, XkbcDescPtr xkb, - XkbAnyAction * action, unsigned mergeMode, ActionInfo * info) + XkbcAnyAction * action, unsigned mergeMode, ActionInfo * info) { ExprDef *arg; register char *str; @@ -1305,7 +1305,7 @@ HandleActionDef(ExprDef * def, exprOpText(def->op)); return False; } - str = XkbcAtomGetString(def->value.action.name); + str = XkbcAtomText(def->value.action.name); if (!str) { WSGO("Missing name in action definition!!\n"); diff --git a/src/xkbcomp/action.h b/src/xkbcomp/action.h index 9f1e10f..685dbcf 100644 --- a/src/xkbcomp/action.h +++ b/src/xkbcomp/action.h @@ -66,7 +66,7 @@ typedef struct _ActionInfo extern int HandleActionDef(ExprDef * /* def */ , XkbcDescPtr /* xkb */ , - XkbAnyAction * /* action */ , + XkbcAnyAction * /* action */ , unsigned /* mergeMode */ , ActionInfo * /* info */ ); diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 1f3a40e..3c6146a 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -39,7 +39,7 @@ typedef struct _SymInterpInfo { CommonInfo defs; - XkbSymInterpretRec interp; + XkbcSymInterpretRec interp; } SymInterpInfo; #define _SI_VirtualMod (1<<0) @@ -120,7 +120,7 @@ InitCompatInfo(CompatInfo * info, XkbcDescPtr xkb) info->dflt.interp.act.type = XkbSA_NoAction; for (i = 0; i < XkbcAnyActionDataSize; i++) { - info->dflt.interp.act.data[i] = 0; + info->dflt.interp.act.pad[i] = 0; } ClearIndicatorMapInfo(&info->ledDflt); info->ledDflt.defs.fileID = info->fileID; @@ -148,7 +148,7 @@ ClearCompatInfo(CompatInfo * info, XkbcDescPtr xkb) info->dflt.interp.act.type = XkbSA_NoAction; for (i = 0; i < XkbcAnyActionDataSize; i++) { - info->dflt.interp.act.data[i] = 0; + info->dflt.interp.act.pad[i] = 0; } ClearIndicatorMapInfo(&info->ledDflt); info->nInterps = 0; @@ -787,7 +787,7 @@ HandleCompatMapFile(XkbFile * file, static void CopyInterps(CompatInfo * info, - XkbCompatMapPtr compat, Bool needSymbol, unsigned pred) + XkbcCompatMapPtr compat, Bool needSymbol, unsigned pred) { SymInterpInfo *si; @@ -842,7 +842,7 @@ CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge, scanFile, info.name); } } - size = info.nInterps * sizeof(XkbSymInterpretRec); + size = info.nInterps * sizeof(XkbcSymInterpretRec); if (size > 0) { CopyInterps(&info, xkb->compat, True, XkbSI_Exactly); diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index db64977..69964ad 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -993,7 +993,7 @@ AddActionsToKey(KeyInfo * key, register int i; unsigned ndx, nActs; ExprDef *act; - XkbAnyAction *toAct; + XkbcAnyAction *toAct; if (!GetGroupIndex(key, arrayNdx, ACTIONS, &ndx)) return False; @@ -1035,7 +1035,7 @@ AddActionsToKey(KeyInfo * key, } key->actsDefined |= (1 << ndx); - toAct = (XkbAnyAction *) key->acts[ndx]; + toAct = (XkbcAnyAction *) key->acts[ndx]; act = value->value.child; for (i = 0; i < nActs; i++, toAct++) {