[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon May 10 19:24:59 PDT 2010


 src/hb-open-file-private.hh        |    2 +-
 src/hb-open-type-private.hh        |   10 ++++++----
 src/hb-ot-layout-common-private.hh |   19 +++++--------------
 src/hb-ot-layout.cc                |    8 ++++----
 src/main.cc                        |    2 +-
 5 files changed, 17 insertions(+), 24 deletions(-)

New commits:
commit 3d44fb6f15177dc6518166e435597936b044acc1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon May 10 22:22:54 2010 -0400

    Fix warning

diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index e724d99..fb07161 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -151,7 +151,7 @@ struct LangSys
   { return featureIndex.get_indexes (start_offset, feature_count, feature_indexes); }
 
   inline bool has_required_feature (void) const { return reqFeatureIndex != 0xffff; }
-  inline int get_required_feature_index (void) const
+  inline unsigned int get_required_feature_index (void) const
   {
     if (reqFeatureIndex == 0xffff)
       return Index::NOT_FOUND_INDEX;
commit b5db4f1e4eefa266a71a28b5496f47ff9d1a81e8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon May 10 22:22:22 2010 -0400

    Clean up NO_INDEX

diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index 066c3b2..6d17db7 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -87,7 +87,7 @@ typedef struct OffsetTable
         return true;
       }
     }
-    if (table_index) *table_index = NO_INDEX;
+    if (table_index) *table_index = Index::NOT_FOUND_INDEX;
     return false;
   }
   inline const TableDirectory& get_table_by_tag (hb_tag_t tag) const
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index eabe1b8..71fb44e 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -32,10 +32,6 @@
 #include "hb-blob.h"
 
 
-/* Table/script/language-system/feature/... not found */
-#define NO_INDEX		((unsigned int) 0xFFFF)
-
-
 
 /*
  * Casts
@@ -418,6 +414,12 @@ DEFINE_NULL_DATA (Tag, "    ");
 /* Glyph index number, same as uint16 (length = 16 bits) */
 typedef USHORT GlyphID;
 
+/* Script/language-system/feature index */
+struct Index : USHORT {
+  static const unsigned int NOT_FOUND_INDEX = 0xFFFF;
+};
+DEFINE_NULL_DATA (Index, "\xff\xff");
+
 /* Offset to a table, same as uint16 (length = 16 bits), Null offset = 0x0000 */
 typedef USHORT Offset;
 
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index e5ecc8f..e724d99 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -99,7 +99,7 @@ struct RecordArrayOf : ArrayOf<Record<Type> > {
         return true;
       }
     }
-    if (index) *index = NO_INDEX;
+    if (index) *index = Index::NOT_FOUND_INDEX;
     return false;
   }
 };
@@ -117,17 +117,8 @@ struct RecordListOf : RecordArrayOf<Type>
 };
 
 
-struct IndexArray : ArrayOf<USHORT>
+struct IndexArray : ArrayOf<Index>
 {
-  inline USHORT operator [] (unsigned int i) const
-  {
-    if (unlikely (i >= this->len)) {
-      USHORT u;
-      u.set (NO_INDEX);
-      return u;
-    }
-    return this->array[i];
-  }
   inline unsigned int get_indexes (unsigned int start_offset,
 				   unsigned int *_count /* IN/OUT */,
 				   unsigned int *_indexes /* OUT */) const
@@ -163,7 +154,7 @@ struct LangSys
   inline int get_required_feature_index (void) const
   {
     if (reqFeatureIndex == 0xffff)
-      return NO_INDEX;
+      return Index::NOT_FOUND_INDEX;
    return reqFeatureIndex;;
   }
 
@@ -197,7 +188,7 @@ struct Script
   { return langSys.get_tags (start_offset, lang_sys_count, lang_sys_tags); }
   inline const LangSys& get_lang_sys (unsigned int i) const
   {
-    if (i == NO_INDEX) return get_default_lang_sys ();
+    if (i == Index::NOT_FOUND_INDEX) return get_default_lang_sys ();
     return this+langSys[i].offset;
   }
   inline bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 91f9fe9..5908cdd 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -360,7 +360,7 @@ hb_ot_layout_table_find_script (hb_face_t    *face,
 				hb_tag_t      script_tag,
 				unsigned int *script_index)
 {
-  ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
+  ASSERT_STATIC (Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
   const GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   if (g.find_script_index (script_tag, script_index))
@@ -384,7 +384,7 @@ hb_ot_layout_table_choose_script (hb_face_t      *face,
 				  const hb_tag_t *script_tags,
 				  unsigned int   *script_index)
 {
-  ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
+  ASSERT_STATIC (Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
   const GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
 
   while (*script_tags)
@@ -439,7 +439,7 @@ hb_ot_layout_script_find_language (hb_face_t    *face,
 				   hb_tag_t      language_tag,
 				   unsigned int *language_index)
 {
-  ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX);
+  ASSERT_STATIC (Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX);
   const Script &s = get_gsubgpos_table (face, table_tag).get_script (script_index);
 
   if (s.find_lang_sys_index (language_tag, language_index))
@@ -515,7 +515,7 @@ hb_ot_layout_language_find_feature (hb_face_t    *face,
 				    hb_tag_t      feature_tag,
 				    unsigned int *feature_index)
 {
-  ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
+  ASSERT_STATIC (Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
   const GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
 
diff --git a/src/main.cc b/src/main.cc
index b3b12d0..5d68862 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -126,7 +126,7 @@ main (int argc, char **argv)
 		   ? "      Default Language System\n"
 		   : "      Language System %2d of %2d: %.4s\n", n_langsys, num_langsys,
 	            (const char *)script.get_lang_sys_tag (n_langsys));
-	    if (langsys.get_required_feature_index () == NO_INDEX)
+	    if (langsys.get_required_feature_index () == Index::NOT_FOUND_INDEX)
 	      printf ("        No required feature\n");
 
 	    int num_features = langsys.get_feature_count ();



More information about the HarfBuzz mailing list