aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-16 18:27:28 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:28 +0200
commit2824899d280f2b169b3e745b222f9a981c1ce5f7 (patch)
treeb36bb27f59fc802561e78aa344755808b71a0279 /nx-X11
parent3c5880e7254dcd04ea8e54d53ec99880e2dfdc27 (diff)
downloadnx-libs-2824899d280f2b169b3e745b222f9a981c1ce5f7.tar.gz
nx-libs-2824899d280f2b169b3e745b222f9a981c1ce5f7.tar.bz2
nx-libs-2824899d280f2b169b3e745b222f9a981c1ce5f7.zip
Rearrange some variable declarations & initializations in XKB
Little things noticed during XKB restyling that seemed to make the code easier to read. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/lib/X11/XKBAlloc.c3
-rw-r--r--nx-X11/lib/X11/XKBBind.c16
-rw-r--r--nx-X11/lib/X11/XKBCompat.c3
-rw-r--r--nx-X11/lib/X11/XKBExtDev.c18
-rw-r--r--nx-X11/lib/X11/XKBGeom.c21
-rw-r--r--nx-X11/lib/X11/XKBGetMap.c13
-rw-r--r--nx-X11/lib/X11/XKBList.c3
-rw-r--r--nx-X11/lib/X11/XKBMAlloc.c4
-rw-r--r--nx-X11/lib/X11/XKBNames.c8
-rw-r--r--nx-X11/lib/X11/XKBSetGeom.c24
-rw-r--r--nx-X11/lib/X11/XKBSetMap.c10
-rw-r--r--nx-X11/lib/X11/XKBUse.c37
12 files changed, 66 insertions, 94 deletions
diff --git a/nx-X11/lib/X11/XKBAlloc.c b/nx-X11/lib/X11/XKBAlloc.c
index 343c2fcdd..ed00f7ff2 100644
--- a/nx-X11/lib/X11/XKBAlloc.c
+++ b/nx-X11/lib/X11/XKBAlloc.c
@@ -132,9 +132,8 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) &&
(xkb->map->types != NULL)) {
register int i;
- XkbKeyTypePtr type;
+ XkbKeyTypePtr type = xkb->map->types;
- type = xkb->map->types;
for (i = 0; i < xkb->map->num_types; i++, type++) {
if (type->level_names == NULL) {
type->level_names = _XkbTypedCalloc(type->num_levels, Atom);
diff --git a/nx-X11/lib/X11/XKBBind.c b/nx-X11/lib/X11/XKBBind.c
index 1952422bd..37f1b8ad6 100644
--- a/nx-X11/lib/X11/XKBBind.c
+++ b/nx-X11/lib/X11/XKBBind.c
@@ -450,23 +450,24 @@ XRefreshKeyboardMapping(register XMappingEvent * event)
fprintf(stderr, " symbols: %d..%d\n", first, last);
}
if (changes.changed & XkbKeyActionsMask) {
- int last, first = changes.first_key_act;
+ int first = changes.first_key_act;
+ int last = changes.first_key_act + changes.num_key_acts - 1;
- last = changes.first_key_act + changes.num_key_acts - 1;
fprintf(stderr, " acts: %d..%d\n", first, last);
}
if (changes.changed & XkbKeyBehaviorsMask) {
- int last, first = changes.first_key_behavior;
- last = first + changes.num_key_behaviors - 1;
+ int first = changes.first_key_behavior;
+ int last = first + changes.num_key_behaviors - 1;
+
fprintf(stderr, " behaviors: %d..%d\n", first, last);
}
if (changes.changed & XkbVirtualModsMask) {
fprintf(stderr, "virtual mods: 0x%04x\n", changes.vmods);
}
if (changes.changed & XkbExplicitComponentsMask) {
- int last, first = changes.first_key_explicit;
+ int first = changes.first_key_explicit;
+ int last = first + changes.num_key_explicit - 1;
- last = first + changes.num_key_explicit - 1;
fprintf(stderr, " explicit: %d..%d\n", first, last);
}
#endif
@@ -643,10 +644,9 @@ XkbTranslateKeySym(register Display *dpy,
if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) {
register int i;
int change;
- char ch;
for (i = change = 0; i < n; i++) {
- ch = toupper(buffer[i]);
+ char ch = toupper(buffer[i]);
change = (change || (buffer[i] != ch));
buffer[i] = ch;
}
diff --git a/nx-X11/lib/X11/XKBCompat.c b/nx-X11/lib/X11/XKBCompat.c
index d5658ce09..a5222b56e 100644
--- a/nx-X11/lib/X11/XKBCompat.c
+++ b/nx-X11/lib/X11/XKBCompat.c
@@ -195,9 +195,8 @@ _XkbWriteSetCompatMap(Display *dpy, xkbSetCompatMapReq *req, XkbDescPtr xkb)
buf += nSI * SIZEOF(xkbSymInterpretWireDesc);
}
if (groups & XkbAllGroupsMask) {
- xkbModsWireDesc *out;
+ xkbModsWireDesc *out = (xkbModsWireDesc *) buf;
- out = (xkbModsWireDesc *) buf;
for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
if ((groups & bit) != 0) {
out->mask = xkb->compat->groups[i].mask;
diff --git a/nx-X11/lib/X11/XKBExtDev.c b/nx-X11/lib/X11/XKBExtDev.c
index 37847dcfd..25c76ab11 100644
--- a/nx-X11/lib/X11/XKBExtDev.c
+++ b/nx-X11/lib/X11/XKBExtDev.c
@@ -68,9 +68,8 @@ XkbNoteDeviceChanges(XkbDeviceChangesPtr old,
XkbDeviceLedChangesPtr this;
if (old->changed & XkbXI_IndicatorsMask) {
- XkbDeviceLedChangesPtr found;
+ XkbDeviceLedChangesPtr found = NULL;
- found = NULL;
for (this = &old->leds; this && (!found); this = this->next) {
if ((this->led_class == new->led_class) &&
(this->led_id == new->led_id)) {
@@ -607,9 +606,8 @@ _XkbWriteLedInfo(char *wire, unsigned changed, XkbDeviceLedInfoPtr devli)
lwire->state = devli->state;
wire = (char *) &lwire[1];
if (namesNeeded) {
- CARD32 *awire;
+ CARD32 *awire = (CARD32 *) wire;
- awire = (CARD32 *) wire;
for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
if (namesNeeded & bit) {
*awire = (CARD32) devli->names[i];
@@ -619,14 +617,12 @@ _XkbWriteLedInfo(char *wire, unsigned changed, XkbDeviceLedInfoPtr devli)
wire = (char *) awire;
}
if (mapsNeeded) {
- xkbIndicatorMapWireDesc *mwire;
+ xkbIndicatorMapWireDesc *mwire = (xkbIndicatorMapWireDesc *) wire;
- mwire = (xkbIndicatorMapWireDesc *) wire;
for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
if (mapsNeeded & bit) {
- XkbIndicatorMapPtr map;
+ XkbIndicatorMapPtr map = &devli->maps[i];
- map = &devli->maps[i];
mwire->flags = map->flags;
mwire->whichGroups = map->which_groups;
mwire->groups = map->groups;
@@ -650,13 +646,11 @@ _XkbWriteSetDeviceInfo(char *wire,
SetLedStuff *stuff,
XkbDeviceInfoPtr devi)
{
- char *start;
+ char *start = wire;
- start = wire;
if (changes->changed & XkbXI_ButtonActionsMask) {
- int size;
+ int size = changes->num_btns * SIZEOF(xkbActionWireDesc);
- size = changes->num_btns * SIZEOF(xkbActionWireDesc);
memcpy(wire, (char *) &devi->btn_acts[changes->first_btn], size);
wire += size;
}
diff --git a/nx-X11/lib/X11/XKBGeom.c b/nx-X11/lib/X11/XKBGeom.c
index 3666d16fa..1014c9adb 100644
--- a/nx-X11/lib/X11/XKBGeom.c
+++ b/nx-X11/lib/X11/XKBGeom.c
@@ -261,13 +261,11 @@ _XkbReadGeomProperties(XkbReadBufferPtr buf,
return Success;
if ((rtrn = XkbAllocGeomProps(geom, rep->nProperties)) == Success) {
register int i;
- register Bool ok;
- char *name, *value;
+ register Bool ok = True;
- ok = True;
for (i = 0; (i < rep->nProperties) && ok; i++) {
- name = NULL;
- value = NULL;
+ char *name = NULL;
+ char *value = NULL;
ok = _XkbGetReadBufferCountedString(buf, &name) && ok;
ok = _XkbGetReadBufferCountedString(buf, &value) && ok;
ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL);
@@ -317,10 +315,9 @@ _XkbReadGeomColors(XkbReadBufferPtr buf,
return Success;
if ((rtrn = XkbAllocGeomColors(geom, rep->nColors)) == Success) {
register int i;
- char *spec;
for (i = 0; i < rep->nColors; i++) {
- spec = NULL;
+ char *spec = NULL;
if (!_XkbGetReadBufferCountedString(buf, &spec))
rtrn = BadLength;
else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL)
@@ -531,10 +528,11 @@ _XkbReadGeomSections(XkbReadBufferPtr buf,
section->priority = sectionWire->priority;
if (sectionWire->nRows > 0) {
register int r;
- XkbRowPtr row;
- xkbRowWireDesc *rowWire;
for (r = 0; r < sectionWire->nRows; r++) {
+ XkbRowPtr row;
+ xkbRowWireDesc *rowWire;
+
rowWire = (xkbRowWireDesc *)
_XkbGetReadBufferPtr(buf, SIZEOF(xkbRowWireDesc));
if (!rowWire)
@@ -547,10 +545,11 @@ _XkbReadGeomSections(XkbReadBufferPtr buf,
row->vertical = rowWire->vertical;
if (rowWire->nKeys > 0) {
register int k;
- XkbKeyPtr key;
- xkbKeyWireDesc *keyWire;
for (k = 0; k < rowWire->nKeys; k++) {
+ XkbKeyPtr key;
+ xkbKeyWireDesc *keyWire;
+
keyWire = (xkbKeyWireDesc *)
_XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyWireDesc));
if (!keyWire)
diff --git a/nx-X11/lib/X11/XKBGetMap.c b/nx-X11/lib/X11/XKBGetMap.c
index db761611a..6e3c74343 100644
--- a/nx-X11/lib/X11/XKBGetMap.c
+++ b/nx-X11/lib/X11/XKBGetMap.c
@@ -211,13 +211,13 @@ _XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep)
map->num_syms = offset;
}
else {
- xkbSymMapWireDesc *newMap;
- XkbSymMapPtr oldMap;
- KeySym *newSyms;
- int tmp;
+ XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym];
- oldMap = &map->key_sym_map[rep->firstKeySym];
for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) {
+ xkbSymMapWireDesc *newMap;
+ KeySym *newSyms;
+ int tmp;
+
newMap = (xkbSymMapWireDesc *)
_XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc));
if (newMap == NULL)
@@ -310,7 +310,6 @@ static Status
_XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep)
{
register int i;
- xkbBehaviorWireDesc *wire;
if (rep->totalKeyBehaviors > 0) {
int size = xkb->max_key_code + 1;
@@ -327,6 +326,8 @@ _XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep)
(rep->nKeyBehaviors * sizeof(XkbBehavior)));
}
for (i = 0; i < rep->totalKeyBehaviors; i++) {
+ xkbBehaviorWireDesc *wire;
+
wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf,
SIZEOF(xkbBehaviorWireDesc));
if (wire == NULL || wire->key >= size)
diff --git a/nx-X11/lib/X11/XKBList.c b/nx-X11/lib/X11/XKBList.c
index d8086a305..d3d29e2a6 100644
--- a/nx-X11/lib/X11/XKBList.c
+++ b/nx-X11/lib/X11/XKBList.c
@@ -193,9 +193,8 @@ XkbListComponents(Display *dpy,
return list;
}
if (_XkbInitReadBuffer(dpy, &buf, extraLen)) {
- Status status;
+ Status status = Success;
- status = Success;
list = _XkbTypedCalloc(1, XkbComponentListRec);
if (!list) {
_XkbFreeReadBuffer(&buf);
diff --git a/nx-X11/lib/X11/XKBMAlloc.c b/nx-X11/lib/X11/XKBMAlloc.c
index 8586ae966..c7c138e4d 100644
--- a/nx-X11/lib/X11/XKBMAlloc.c
+++ b/nx-X11/lib/X11/XKBMAlloc.c
@@ -297,9 +297,7 @@ XkbAddKeyType(XkbDescPtr xkb,
if ((map) && (map->types)) {
for (i = 0; i < map->num_types; i++) {
if (map->types[i].name == name) {
- Status status;
-
- status =
+ Status status =
XkbResizeKeyType(xkb, i, map_count, want_preserve,
num_lvls);
return (status == Success ? &map->types[i] : NULL);
diff --git a/nx-X11/lib/X11/XKBNames.c b/nx-X11/lib/X11/XKBNames.c
index 7eaf92335..3cfd02f96 100644
--- a/nx-X11/lib/X11/XKBNames.c
+++ b/nx-X11/lib/X11/XKBNames.c
@@ -116,14 +116,14 @@ _XkbReadGetNamesReply(Display *dpy,
if (rep->which & XkbKTLevelNamesMask) {
CARD8 *nLevels;
XkbClientMapPtr map = xkb->map;
- XkbKeyTypePtr type;
nLevels =
(CARD8 *) _XkbGetReadBufferPtr(&buf, XkbPaddedSize(rep->nTypes));
if (nLevels == NULL)
goto BAILOUT;
if (map != NULL) {
- type = map->types;
+ XkbKeyTypePtr type = map->types;
+
for (i = 0; i < (int) rep->nTypes; i++, type++) {
if (i >= map->num_types) {
if (!_XkbSkipReadBufferData(&buf, nLevels[i] * 4))
@@ -577,14 +577,14 @@ XkbChangeNames(Display *dpy, XkbDescPtr xkb, XkbNameChangesPtr changes)
names = xkb->names;
if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) {
register int i;
- XkbKeyTypePtr type;
if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) ||
(firstType + nTypes > xkb->map->num_types) ||
(firstLvlType + nLvlTypes > xkb->map->num_types))
return False;
if (which & XkbKTLevelNamesMask) {
- type = &xkb->map->types[firstLvlType];
+ XkbKeyTypePtr type = &xkb->map->types[firstLvlType];
+
for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) {
if (type->level_names != NULL)
nLvlNames += type->num_levels;
diff --git a/nx-X11/lib/X11/XKBSetGeom.c b/nx-X11/lib/X11/XKBSetGeom.c
index e5e524fa4..ee254e0dc 100644
--- a/nx-X11/lib/X11/XKBSetGeom.c
+++ b/nx-X11/lib/X11/XKBSetGeom.c
@@ -245,10 +245,10 @@ static char *
_WriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad)
{
register int i;
- xkbDoodadWireDesc *doodadWire;
for (i = 0; i < num_doodads; i++, doodad++) {
- doodadWire = (xkbDoodadWireDesc *) wire;
+ xkbDoodadWireDesc *doodadWire = (xkbDoodadWireDesc *) wire;
+
wire = (char *) &doodadWire[1];
bzero(doodadWire, SIZEOF(xkbDoodadWireDesc));
doodadWire->any.name = doodad->any.name;
@@ -292,25 +292,22 @@ _WriteGeomOverlay(char *wire, XkbOverlayPtr ol)
{
register int r;
XkbOverlayRowPtr row;
- xkbOverlayWireDesc *olWire;
+ xkbOverlayWireDesc *olWire = (xkbOverlayWireDesc *) wire;
- olWire = (xkbOverlayWireDesc *) wire;
olWire->name = ol->name;
olWire->nRows = ol->num_rows;
wire = (char *) &olWire[1];
for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) {
unsigned int k;
XkbOverlayKeyPtr key;
- xkbOverlayRowWireDesc *rowWire;
+ xkbOverlayRowWireDesc *rowWire = (xkbOverlayRowWireDesc *) wire;
- rowWire = (xkbOverlayRowWireDesc *) wire;
rowWire->rowUnder = row->row_under;
rowWire->nKeys = row->num_keys;
wire = (char *) &rowWire[1];
for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
- xkbOverlayKeyWireDesc *keyWire;
+ xkbOverlayKeyWireDesc *keyWire = (xkbOverlayKeyWireDesc *) wire;
- keyWire = (xkbOverlayKeyWireDesc *) wire;
memcpy(keyWire->over, key->over.name, XkbKeyNameLength);
memcpy(keyWire->under, key->under.name, XkbKeyNameLength);
wire = (char *) &keyWire[1];
@@ -324,11 +321,11 @@ _WriteGeomSections(char *wire, XkbGeometryPtr geom)
{
register int i;
XkbSectionPtr section;
- xkbSectionWireDesc *sectionWire;
for (i = 0, section = geom->sections; i < geom->num_sections;
i++, section++) {
- sectionWire = (xkbSectionWireDesc *) wire;
+ xkbSectionWireDesc *sectionWire = (xkbSectionWireDesc *) wire;
+
sectionWire->name = section->name;
sectionWire->top = section->top;
sectionWire->left = section->left;
@@ -344,10 +341,10 @@ _WriteGeomSections(char *wire, XkbGeometryPtr geom)
if (section->rows) {
int r;
XkbRowPtr row;
- xkbRowWireDesc *rowWire;
for (r = 0, row = section->rows; r < section->num_rows; r++, row++) {
- rowWire = (xkbRowWireDesc *) wire;
+ xkbRowWireDesc *rowWire = (xkbRowWireDesc *) wire;
+
rowWire->top = row->top;
rowWire->left = row->left;
rowWire->nKeys = row->num_keys;
@@ -357,9 +354,8 @@ _WriteGeomSections(char *wire, XkbGeometryPtr geom)
if (row->keys) {
int k;
XkbKeyPtr key;
- xkbKeyWireDesc *keyWire;
+ xkbKeyWireDesc *keyWire = (xkbKeyWireDesc *) wire;
- keyWire = (xkbKeyWireDesc *) wire;
for (k = 0, key = row->keys; k < row->num_keys; k++, key++) {
memcpy(keyWire[k].name, key->name.name,
XkbKeyNameLength);
diff --git a/nx-X11/lib/X11/XKBSetMap.c b/nx-X11/lib/X11/XKBSetMap.c
index dbf1a8a96..cb696105c 100644
--- a/nx-X11/lib/X11/XKBSetMap.c
+++ b/nx-X11/lib/X11/XKBSetMap.c
@@ -59,14 +59,14 @@ _XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req)
{
char *buf;
XkbKeyTypePtr type;
- int i, n, sz;
+ int i, n;
xkbKeyTypeWireDesc *desc;
if ((req->present & XkbKeyTypesMask) == 0)
return;
type = &xkb->map->types[req->firstType];
for (i = 0; i < req->nTypes; i++, type++) {
- sz = SIZEOF(xkbKeyTypeWireDesc);
+ int sz = SIZEOF(xkbKeyTypeWireDesc);
sz += type->map_count * SIZEOF(xkbKTSetMapEntryWireDesc);
if (type->preserve)
sz += type->map_count * SIZEOF(xkbModsWireDesc);
@@ -79,9 +79,8 @@ _XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req)
desc->preserve = (type->preserve != NULL);
buf = (char *) &desc[1];
if (desc->nMapEntries > 0) {
- xkbKTSetMapEntryWireDesc *wire;
+ xkbKTSetMapEntryWireDesc *wire = (xkbKTSetMapEntryWireDesc *) buf;
- wire = (xkbKTSetMapEntryWireDesc *) buf;
for (n = 0; n < type->map_count; n++, wire++) {
wire->level = type->map[n].level;
wire->realMods = type->map[n].mods.real_mods;
@@ -89,9 +88,8 @@ _XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req)
}
buf = (char *) wire;
if (type->preserve) {
- xkbModsWireDesc *pwire;
+ xkbModsWireDesc *pwire = (xkbModsWireDesc *) buf;
- pwire = (xkbModsWireDesc *) buf;
for (n = 0; n < type->map_count; n++, pwire++) {
pwire->realMods = type->preserve[n].real_mods;
pwire->virtualMods = type->preserve[n].vmods;
diff --git a/nx-X11/lib/X11/XKBUse.c b/nx-X11/lib/X11/XKBUse.c
index 0af4679d3..cf6497551 100644
--- a/nx-X11/lib/X11/XKBUse.c
+++ b/nx-X11/lib/X11/XKBUse.c
@@ -263,9 +263,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
if ((xkbi->selected_events & XkbMapNotifyMask) &&
(xkbi->selected_map_details & mn->changed)) {
- XkbMapNotifyEvent *mev;
+ XkbMapNotifyEvent *mev = (XkbMapNotifyEvent *) re;
- mev = (XkbMapNotifyEvent *) re;
mev->type = XkbEventCode + xkbi->codes->first_event;
mev->xkb_type = XkbMapNotify;
mev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -318,9 +317,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbControlsNotifyMask) {
xkbControlsNotify *cn = (xkbControlsNotify *) event;
- XkbControlsNotifyEvent *cev;
+ XkbControlsNotifyEvent *cev = (XkbControlsNotifyEvent *) re;
- cev = (XkbControlsNotifyEvent *) re;
cev->type = XkbEventCode + xkbi->codes->first_event;
cev->xkb_type = XkbControlsNotify;
cev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -344,9 +342,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbIndicatorMapNotifyMask) {
xkbIndicatorNotify *in = (xkbIndicatorNotify *) event;
- XkbIndicatorNotifyEvent *iev;
+ XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re;
- iev = (XkbIndicatorNotifyEvent *) re;
iev->type = XkbEventCode + xkbi->codes->first_event;
iev->xkb_type = XkbIndicatorMapNotify;
iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -364,9 +361,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbIndicatorStateNotifyMask) {
xkbIndicatorNotify *in = (xkbIndicatorNotify *) event;
- XkbIndicatorNotifyEvent *iev;
+ XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re;
- iev = (XkbIndicatorNotifyEvent *) re;
iev->type = XkbEventCode + xkbi->codes->first_event;
iev->xkb_type = XkbIndicatorStateNotify;
iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -384,9 +380,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbBellNotifyMask) {
xkbBellNotify *bn = (xkbBellNotify *) event;
- XkbBellNotifyEvent *bev;
+ XkbBellNotifyEvent *bev = (XkbBellNotifyEvent *) re;
- bev = (XkbBellNotifyEvent *) re;
bev->type = XkbEventCode + xkbi->codes->first_event;
bev->xkb_type = XkbBellNotify;
bev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -410,9 +405,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbAccessXNotifyMask) {
xkbAccessXNotify *axn = (xkbAccessXNotify *) event;
- XkbAccessXNotifyEvent *axev;
+ XkbAccessXNotifyEvent *axev = (XkbAccessXNotifyEvent *) re;
- axev = (XkbAccessXNotifyEvent *) re;
axev->type = XkbEventCode + xkbi->codes->first_event;
axev->xkb_type = XkbAccessXNotify;
axev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -432,9 +426,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbNamesNotifyMask) {
xkbNamesNotify *nn = (xkbNamesNotify *) event;
- XkbNamesNotifyEvent *nev;
+ XkbNamesNotifyEvent *nev = (XkbNamesNotifyEvent *) re;
- nev = (XkbNamesNotifyEvent *) re;
nev->type = XkbEventCode + xkbi->codes->first_event;
nev->xkb_type = XkbNamesNotify;
nev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -462,9 +455,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbCompatMapNotifyMask) {
xkbCompatMapNotify *cmn = (xkbCompatMapNotify *) event;
- XkbCompatMapNotifyEvent *cmev;
+ XkbCompatMapNotifyEvent *cmev = (XkbCompatMapNotifyEvent *) re;
- cmev = (XkbCompatMapNotifyEvent *) re;
cmev->type = XkbEventCode + xkbi->codes->first_event;
cmev->xkb_type = XkbCompatMapNotify;
cmev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -484,9 +476,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbActionMessageMask) {
xkbActionMessage *am = (xkbActionMessage *) event;
- XkbActionMessageEvent *amev;
+ XkbActionMessageEvent *amev = (XkbActionMessageEvent *) re;
- amev = (XkbActionMessageEvent *) re;
amev->type = XkbEventCode + xkbi->codes->first_event;
amev->xkb_type = XkbActionMessage;
amev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -509,9 +500,9 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
{
if (xkbi->selected_events & XkbExtensionDeviceNotifyMask) {
xkbExtensionDeviceNotify *ed = (xkbExtensionDeviceNotify *) event;
- XkbExtensionDeviceNotifyEvent *edev;
+ XkbExtensionDeviceNotifyEvent *edev
+ = (XkbExtensionDeviceNotifyEvent *) re;
- edev = (XkbExtensionDeviceNotifyEvent *) re;
edev->type = XkbEventCode + xkbi->codes->first_event;
edev->xkb_type = XkbExtensionDeviceNotify;
edev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -538,9 +529,8 @@ wire_to_event(Display *dpy, XEvent *re, xEvent *event)
if ((xkbi->selected_events & XkbNewKeyboardNotifyMask) &&
(xkbi->selected_nkn_details & nkn->changed)) {
- XkbNewKeyboardNotifyEvent *nkev;
+ XkbNewKeyboardNotifyEvent *nkev = (XkbNewKeyboardNotifyEvent *) re;
- nkev = (XkbNewKeyboardNotifyEvent *) re;
nkev->type = XkbEventCode + xkbi->codes->first_event;
nkev->xkb_type = XkbNewKeyboardNotify;
nkev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
@@ -763,9 +753,8 @@ XkbUseExtension(Display *dpy, int *major_rtrn, int *minor_rtrn)
req->wantedMajor = XkbMajorVersion;
req->wantedMinor = XkbMinorVersion;
if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.supported) {
- Bool fail;
+ Bool fail = True;
- fail = True;
if (debugMsg)
fprintf(stderr,
"XKEYBOARD version mismatch (want %d.%02d, got %d.%02d)\n",