[libdazzle] fuzzy: mask priorities when doing key lookups



commit 9321577dc583e71c6f263f29f4c2cb11330cc983
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jun 3 23:53:17 2017 -0700

    fuzzy: mask priorities when doing key lookups

 src/fuzzy/dzl-fuzzy-index.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/fuzzy/dzl-fuzzy-index.c b/src/fuzzy/dzl-fuzzy-index.c
index 61ffabc..ef26aae 100644
--- a/src/fuzzy/dzl-fuzzy-index.c
+++ b/src/fuzzy/dzl-fuzzy-index.c
@@ -478,10 +478,13 @@ _dzl_fuzzy_index_resolve (DzlFuzzyIndex  *self,
 
   if (key != NULL)
     {
-      if G_UNLIKELY (entry->key_id >= g_variant_n_children (self->keys))
+      /* The key_id has a mask with the priority as well */
+      guint key_id = entry->key_id & 0x00FFFFFF;
+
+      if G_UNLIKELY (key_id >= g_variant_n_children (self->keys))
         return FALSE;
 
-      g_variant_get_child (self->keys, entry->key_id, "&s", key);
+      g_variant_get_child (self->keys, key_id, "&s", key);
     }
 
   return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]