Commit fe1faa143e6a5d1dd423a33f7bc0aaf792b8fc40

Ran Benita 2012-10-03T20:08:13

Use our types instead of int/uint32_t in a few places Signed-off-by: Ran Benita <ran234@gmail.com>

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++)