summaryrefslogtreecommitdiff
path: root/src/xkbcomp
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-02-08 15:30:05 +0200
committerRan Benita <ran234@gmail.com>2014-02-08 15:30:05 +0200
commit769b91c580832eea279770d8a14f8aa23bf16f34 (patch)
treece640c57d3baef2d4aa80631496cde8832ff0ec9 /src/xkbcomp
parent50b73ec0e7d8d592bd56fe0da7c012414acf2748 (diff)
downloadlibxkbcommon-769b91c580832eea279770d8a14f8aa23bf16f34.tar.gz
libxkbcommon-769b91c580832eea279770d8a14f8aa23bf16f34.tar.bz2
libxkbcommon-769b91c580832eea279770d8a14f8aa23bf16f34.zip
Use (1u << idx) instead of (1 << idx) where appropriate
It doesn't matter (I think), since the implicit conversion doesn't have any effect (e.g. sign-extension). But it's better to be aware of the type. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp')
-rw-r--r--src/xkbcomp/expr.c2
-rw-r--r--src/xkbcomp/keymap-dump.c2
-rw-r--r--src/xkbcomp/keymap.c6
-rw-r--r--src/xkbcomp/rules.c12
-rw-r--r--src/xkbcomp/symbols.c2
5 files changed, 12 insertions, 12 deletions
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index ba71208..7b6ecc9 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -116,7 +116,7 @@ LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
if (ndx == XKB_MOD_INVALID)
return false;
- *val_rtrn = (1 << ndx);
+ *val_rtrn = (1u << ndx);
return true;
}
diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c
index 0f5b958..fe41675 100644
--- a/src/xkbcomp/keymap-dump.c
+++ b/src/xkbcomp/keymap-dump.c
@@ -635,7 +635,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
continue;
darray_enumerate(i, mod, keymap->mods)
- if (key->modmap & (1 << i))
+ if (key->modmap & (1u << i))
write_buf(buf, "\tmodifier_map %s { %s };\n",
xkb_atom_text(keymap->ctx, mod->name),
KeyNameText(keymap->ctx, key->name));
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index aee631f..8a70577 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -39,7 +39,7 @@ ComputeEffectiveMask(struct xkb_keymap *keymap, struct xkb_mods *mods)
mods->mask = mods->mods & MOD_REAL_MASK_ALL;
darray_enumerate(i, mod, keymap->mods)
- if (mods->mods & (1 << i))
+ if (mods->mods & (1u << i))
mods->mask |= mod->mapping;
}
@@ -158,7 +158,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key)
if ((group == 0 && level == 0) || !interp->level_one_only)
if (interp->virtual_mod != XKB_MOD_INVALID)
- vmodmap |= (1 << interp->virtual_mod);
+ vmodmap |= (1u << interp->virtual_mod);
if (interp->action.type != ACTION_TYPE_NONE)
key->groups[group].levels[level].action = interp->action;
@@ -194,7 +194,7 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap)
/* Update keymap->mods, the virtual -> real mod mapping. */
xkb_foreach_key(key, keymap)
darray_enumerate(i, mod, keymap->mods)
- if (key->vmodmap & (1 << i))
+ if (key->vmodmap & (1u << i))
mod->mapping |= key->modmap;
/* Now update the level masks for all the types to reflect the vmods. */
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index d757a81..77766d2 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -482,7 +482,7 @@ matcher_mapping_set_mlvo(struct matcher *m, struct sval ident)
return;
}
- if (m->mapping.defined_mlvo_mask & (1 << mlvo)) {
+ if (m->mapping.defined_mlvo_mask & (1u << mlvo)) {
matcher_error(m,
"invalid mapping: %.*s appears twice on the same line; "
"ignoring rule set",
@@ -522,7 +522,7 @@ matcher_mapping_set_mlvo(struct matcher *m, struct sval ident)
}
m->mapping.mlvo_at_pos[m->mapping.num_mlvo] = mlvo;
- m->mapping.defined_mlvo_mask |= 1 << mlvo;
+ m->mapping.defined_mlvo_mask |= 1u << mlvo;
m->mapping.num_mlvo++;
}
@@ -549,7 +549,7 @@ matcher_mapping_set_kccgst(struct matcher *m, struct sval ident)
return;
}
- if (m->mapping.defined_kccgst_mask & (1 << kccgst)) {
+ if (m->mapping.defined_kccgst_mask & (1u << kccgst)) {
matcher_error(m,
"invalid mapping: %.*s appears twice on the same line; "
"ignoring rule set",
@@ -559,7 +559,7 @@ matcher_mapping_set_kccgst(struct matcher *m, struct sval ident)
}
m->mapping.kccgst_at_pos[m->mapping.num_kccgst] = kccgst;
- m->mapping.defined_kccgst_mask |= 1 << kccgst;
+ m->mapping.defined_kccgst_mask |= 1u << kccgst;
m->mapping.num_kccgst++;
}
@@ -585,7 +585,7 @@ matcher_mapping_verify(struct matcher *m)
* See the "Notes" section in the overview above.
*/
- if (m->mapping.defined_mlvo_mask & (1 << MLVO_LAYOUT)) {
+ if (m->mapping.defined_mlvo_mask & (1u << MLVO_LAYOUT)) {
if (m->mapping.layout_idx == XKB_LAYOUT_INVALID) {
if (darray_size(m->rmlvo.layouts) > 1)
goto skip;
@@ -597,7 +597,7 @@ matcher_mapping_verify(struct matcher *m)
}
}
- if (m->mapping.defined_mlvo_mask & (1 << MLVO_VARIANT)) {
+ if (m->mapping.defined_mlvo_mask & (1u << MLVO_VARIANT)) {
if (m->mapping.variant_idx == XKB_LAYOUT_INVALID) {
if (darray_size(m->rmlvo.variants) > 1)
goto skip;
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 1e044e5..b57d02c 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1511,7 +1511,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
}
}
- key->modmap |= (1 << entry->modifier);
+ key->modmap |= (1u << entry->modifier);
return true;
}