diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -53,7 +53,6 @@ ProcessIncludeFile(IncludeStmt * stmt, unsigned file_type, XkbFile ** file_rtrn, unsigned *merge_rtrn) { - FILE *file; XkbFile *rtrn, *mapToUse; char oldFile[1024] = {0}; int oldLine = lineNum; @@ -63,7 +62,7 @@ ProcessIncludeFile(IncludeStmt * stmt, { /* file not in cache, open it, parse it and store it in cache for next time. */ - file = XkbFindFileInPath(stmt->file, file_type, &stmt->path); + FILE *file = XkbFindFileInPath(stmt->file, file_type, &stmt->path); if (file == NULL) { ERROR("Can't find file \"%s\" for %s include\n", stmt->file, @@ -400,30 +399,29 @@ static KeyNameDesc dfltKeys[] = { Status ComputeKbdDefaults(XkbDescPtr xkb) { - Status rtrn; - int i, tmp, nUnknown; - KeyNameDesc *name; - KeySym *syms; - char tmpname[XkbKeyNameLength + 1]; + int nUnknown; if ((xkb->names == NULL) || (xkb->names->keys == NULL)) { + Status rtrn; if ((rtrn = XkbAllocNames(xkb, XkbKeyNamesMask, 0, 0)) != Success) return rtrn; } - for (name = dfltKeys; (name->name[0] != '\0'); name++) + for (KeyNameDesc *name = dfltKeys; (name->name[0] != '\0'); name++) { name->used = False; } nUnknown = 0; - for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) + for (int i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - tmp = XkbKeyNumSyms(xkb, i); + int tmp = XkbKeyNumSyms(xkb, i); if ((xkb->names->keys[i].name[0] == '\0') && (tmp > 0)) { + KeySym *syms; + tmp = XkbKeyGroupsWidth(xkb, i); syms = XkbKeySymsPtr(xkb, i); - for (name = dfltKeys; (name->name[0] != '\0'); name++) + for (KeyNameDesc *name = dfltKeys; (name->name[0] != '\0'); name++) { Bool match = True; if (((name->level1 != syms[0]) @@ -444,6 +442,8 @@ ComputeKbdDefaults(XkbDescPtr xkb) } else { + char tmpname[XkbKeyNameLength + 1]; + if (warningLevel > 2) { WARN @@ -464,6 +464,8 @@ ComputeKbdDefaults(XkbDescPtr xkb) { if (warningLevel > 2) { + char tmpname[XkbKeyNameLength + 1]; + WARN("Key %d does not match any defaults\n", i); ACTION("Using name <U%03d>\n", nUnknown); snprintf(tmpname, sizeof(tmpname), "U%03d", nUnknown++); @@ -494,8 +496,6 @@ FindNamedKey(XkbDescPtr xkb, unsigned int *kc_rtrn, Bool use_aliases, Bool create, int start_from) { - unsigned n; - if (start_from < xkb->min_key_code) { start_from = xkb->min_key_code; @@ -508,7 +508,7 @@ FindNamedKey(XkbDescPtr xkb, *kc_rtrn = 0; /* some callers rely on this */ if (xkb && xkb->names && xkb->names->keys) { - for (n = start_from; n <= xkb->max_key_code; n++) + for (unsigned n = start_from; n <= xkb->max_key_code; n++) { unsigned long tmp; tmp = KeyNameToLong(xkb->names->keys[n].name); @@ -546,7 +546,7 @@ FindNamedKey(XkbDescPtr xkb, } } /* Find first unused keycode and store our key here */ - for (n = xkb->min_key_code; n <= xkb->max_key_code; n++) + for (unsigned n = xkb->min_key_code; n <= xkb->max_key_code; n++) { if (xkb->names->keys[n].name[0] == '\0') { @@ -565,7 +565,6 @@ Bool FindKeyNameForAlias(XkbDescPtr xkb, unsigned long lname, unsigned long *real_name) { - int i; char name[XkbKeyNameLength + 1]; if (xkb && xkb->geom && xkb->geom->key_aliases) @@ -574,7 +573,7 @@ FindKeyNameForAlias(XkbDescPtr xkb, unsigned long lname, a = xkb->geom->key_aliases; LongToKeyName(lname, name); name[XkbKeyNameLength] = '\0'; - for (i = 0; i < xkb->geom->num_key_aliases; i++, a++) + for (int i = 0; i < xkb->geom->num_key_aliases; i++, a++) { if (strncmp(name, a->alias, XkbKeyNameLength) == 0) { @@ -589,7 +588,7 @@ FindKeyNameForAlias(XkbDescPtr xkb, unsigned long lname, a = xkb->names->key_aliases; LongToKeyName(lname, name); name[XkbKeyNameLength] = '\0'; - for (i = 0; i < xkb->names->num_key_aliases; i++, a++) + for (int i = 0; i < xkb->names->num_key_aliases; i++, a++) { if (strncmp(name, a->alias, XkbKeyNameLength) == 0) { |