Use our types instead of int/uint32_t in a few places Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index c0268c4..f591847 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -127,8 +127,7 @@ err:
static bool
write_vmods(struct xkb_keymap *keymap, struct buf *buf)
{
- int num_vmods = 0;
- int i;
+ xkb_mod_index_t i, num_vmods = 0;
for (i = 0; i < XKB_NUM_VIRTUAL_MODS; i++) {
if (!keymap->vmod_names[i])
@@ -157,9 +156,9 @@ write_vmods(struct xkb_keymap *keymap, struct buf *buf)
} while (0)
static char *
-get_indicator_state_text(uint8_t which)
+get_indicator_state_text(enum xkb_state_component which)
{
- int i;
+ unsigned int i;
static char ret[GET_TEXT_BUF_SIZE];
memset(ret, 0, GET_TEXT_BUF_SIZE);
@@ -226,7 +225,7 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf)
{
struct xkb_key *key;
struct xkb_key_alias *alias;
- int i;
+ xkb_led_index_t i;
if (keymap->keycodes_section_name)
write_buf(buf, "\txkb_keycodes \"%s\" {\n",
@@ -728,7 +727,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
}
xkb_foreach_key(key, keymap) {
- int mod;
+ xkb_mod_index_t mod;
if (key->modmap == 0)
continue;
diff --git a/src/keymap.h b/src/keymap.h
index 2471d19..62a8940 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -278,7 +278,7 @@ struct xkb_sym_interpret {
struct xkb_indicator_map {
xkb_atom_t name;
enum xkb_state_component which_groups;
- uint32_t groups;
+ xkb_layout_mask_t groups;
enum xkb_state_component which_mods;
struct xkb_mods mods;
enum xkb_action_controls ctrls;
diff --git a/src/state.c b/src/state.c
index 458bc61..e186ece 100644
--- a/src/state.c
+++ b/src/state.c
@@ -98,7 +98,7 @@ struct xkb_state {
*/
int16_t mod_key_count[sizeof(xkb_mod_mask_t) * 8];
- uint32_t leds;
+ xkb_led_mask_t leds;
int refcnt;
darray(struct xkb_filter) filters;
@@ -596,7 +596,7 @@ xkb_state_led_update_all(struct xkb_state *state)
for (led = 0; led < XKB_NUM_INDICATORS; led++) {
struct xkb_indicator_map *map = &state->keymap->indicators[led];
xkb_mod_mask_t mod_mask = 0;
- uint32_t group_mask = 0;
+ xkb_layout_mask_t group_mask = 0;
if (map->which_mods & XKB_STATE_DEPRESSED)
mod_mask |= state->base_mods;
@@ -860,9 +860,10 @@ xkb_state_mod_index_is_active(struct xkb_state *state,
*/
static int
match_mod_masks(struct xkb_state *state, enum xkb_state_match match,
- uint32_t wanted)
+ xkb_mod_mask_t wanted)
{
- uint32_t active = xkb_state_serialize_mods(state, XKB_STATE_EFFECTIVE);
+ xkb_mod_mask_t active = xkb_state_serialize_mods(state,
+ XKB_STATE_EFFECTIVE);
if (!(match & XKB_STATE_MATCH_NON_EXCLUSIVE) && (active & ~wanted))
return 0;
@@ -887,7 +888,7 @@ xkb_state_mod_indices_are_active(struct xkb_state *state,
{
va_list ap;
xkb_mod_index_t idx = 0;
- uint32_t wanted = 0;
+ xkb_mod_mask_t wanted = 0;
int ret = 0;
xkb_mod_index_t num_mods = xkb_keymap_num_mods(state->keymap);
@@ -939,7 +940,7 @@ xkb_state_mod_names_are_active(struct xkb_state *state,
va_list ap;
xkb_mod_index_t idx = 0;
const char *str;
- uint32_t wanted = 0;
+ xkb_mod_mask_t wanted = 0;
int ret = 0;
va_start(ap, match);
diff --git a/src/text.h b/src/text.h
index e38ed20..3058aa9 100644
--- a/src/text.h
+++ b/src/text.h
@@ -63,7 +63,7 @@ const char *
ModMaskText(xkb_mod_mask_t mask);
const char *
-ActionTypeText(unsigned type);
+ActionTypeText(enum xkb_action_type type);
const char *
KeysymText(xkb_keysym_t sym);
@@ -72,6 +72,6 @@ const char *
KeyNameText(struct xkb_context *ctx, xkb_atom_t name);
const char *
-SIMatchText(unsigned type);
+SIMatchText(enum xkb_match_operation type);
#endif /* TEXT_H */
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 900ec2d..3c65750 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -748,7 +748,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
return false;
}
- act->type = (uint8_t) type;
+ act->type = (enum xkb_action_type) type;
return true;
}
else if (field == ACTION_FIELD_DATA) {
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 06cb0a6..c317267 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -783,7 +783,8 @@ HandleInterpBody(CompatInfo *info, VarDef *def, SymInterpInfo *si)
static bool
HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge)
{
- unsigned pred, mods;
+ enum xkb_match_operation pred;
+ xkb_mod_mask_t mods;
SymInterpInfo si;
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) {
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index 611d313..8c3cf26 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -96,7 +96,7 @@ FindInterpForKey(struct xkb_keymap *keymap, const struct xkb_key *key,
* such that when we find a match we return immediately.
*/
darray_foreach(interp, keymap->sym_interpret) {
- uint32_t mods;
+ xkb_mod_mask_t mods;
bool found;
if ((num_syms > 1 || interp->sym != syms[0]) &&
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 0a3955e..95fbd57 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -164,7 +164,7 @@ ClearKeyInfo(KeyInfo *keyi)
typedef struct _ModMapEntry {
enum merge_mode merge;
bool haveSymbol;
- int modifier;
+ xkb_mod_index_t modifier;
union {
xkb_atom_t keyName;
xkb_keysym_t keySym;
@@ -451,7 +451,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
darray_foreach(mm, info->modMaps) {
if (new->haveSymbol && mm->haveSymbol
&& (new->u.keySym == mm->u.keySym)) {
- unsigned use, ignore;
+ xkb_mod_index_t use, ignore;
if (mm->modifier != new->modifier) {
if (clobber) {
use = new->modifier;
@@ -472,7 +472,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
}
if ((!new->haveSymbol) && (!mm->haveSymbol) &&
(new->u.keyName == mm->u.keyName)) {
- unsigned use, ignore;
+ xkb_mod_index_t use, ignore;
if (mm->modifier != new->modifier) {
if (clobber) {
use = new->modifier;
diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c
index 17a16cf..3a517ff 100644
--- a/src/xkbcomp/vmod.c
+++ b/src/xkbcomp/vmod.c
@@ -32,7 +32,7 @@
void
InitVModInfo(VModInfo *info, struct xkb_keymap *keymap)
{
- xkb_layout_index_t i;
+ xkb_mod_index_t i;
memset(info, 0, sizeof(*info));
for (i = 0; i < XKB_NUM_VIRTUAL_MODS; i++)