Use C-style casts instead of compare to 0, to convert hb_bool_t to bool
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 27 Nov 2015 00:22:22 +0000 (19:22 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 27 Nov 2015 00:22:22 +0000 (19:22 -0500)
src/hb-common.cc
src/hb-fallback-shape.cc
src/hb-font-private.hh
src/hb-ot-layout.cc
src/hb-ot-map.cc
src/hb-ot-shape-complex-hangul.cc
src/hb-ot-shape-complex-hebrew.cc
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-normalize.cc
src/hb-ot-shape.cc

index 176da8d..710b36e 100644 (file)
@@ -521,7 +521,7 @@ hb_user_data_array_t::set (hb_user_data_key_t *key,
     }
   }
   hb_user_data_item_t item = {key, data, destroy};
-  bool ret = !!items.replace_or_insert (item, lock, replace != 0);
+  bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
 
   return ret;
 }
index 0cd623e..b5ebfc0 100644 (file)
@@ -106,7 +106,7 @@ _hb_fallback_shape (hb_shape_plan_t    *shape_plan HB_UNUSED,
    */
 
   hb_codepoint_t space;
-  bool has_space = font->get_glyph (' ', 0, &space) != 0;
+  bool has_space = (bool) font->get_glyph (' ', 0, &space);
 
   buffer->clear_positions ();
 
index c45258b..7255cb9 100644 (file)
@@ -160,7 +160,7 @@ struct hb_font_t {
   HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
 #undef HB_FONT_FUNC_IMPLEMENT
 
-  inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+  inline bool has_glyph (hb_codepoint_t unicode)
   {
     hb_codepoint_t glyph;
     return get_glyph (unicode, 0, &glyph);
index fbc5d51..3d4ee16 100644 (file)
@@ -742,7 +742,7 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t            *face,
                                           hb_bool_t             zero_context)
 {
   if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
-  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context != 0);
+  OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
 
   const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index);
 
index 1b8a3ac..7bdeddb 100644 (file)
@@ -89,7 +89,7 @@ hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
 
   for (unsigned int table_index = 0; table_index < 2; table_index++) {
     hb_tag_t table_tag = table_tags[table_index];
-    found_script[table_index] = hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]) != 0;
+    found_script[table_index] = (bool) hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
     hb_ot_layout_script_find_language (face, table_tag, script_index[table_index], language_tag, &language_index[table_index]);
   }
 }
index 52080a1..5f4d98b 100644 (file)
@@ -301,7 +301,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
     {
       /* Have <LV>, <LVT>, or <LV,T> */
       hb_codepoint_t s = u;
-      bool has_glyph = font->has_glyph (s) != 0;
+      bool has_glyph = font->has_glyph (s);
       unsigned int lindex = (s - SBase) / NCount;
       unsigned int nindex = (s - SBase) % NCount;
       unsigned int vindex = nindex / TCount;
index 2e29bdd..3215900 100644 (file)
@@ -68,7 +68,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
     0xFB4Au /* TAV */
   };
 
-  bool found = c->unicode->compose (a, b, ab) != 0;
+  bool found = (bool) c->unicode->compose (a, b, ab);
 
   if (!found && !c->plan->has_mark)
   {
index 72b621e..5354897 100644 (file)
@@ -1806,7 +1806,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
     }
   }
 
-  return c->unicode->decompose (ab, a, b) != 0;
+  return (bool) c->unicode->decompose (ab, a, b);
 }
 
 static bool
@@ -1822,7 +1822,7 @@ compose_indic (const hb_ot_shape_normalize_context_t *c,
   /* Composition-exclusion exceptions that we want to recompose. */
   if (a == 0x09AFu && b == 0x09BCu) { *ab = 0x09DFu; return true; }
 
-  return c->unicode->compose (a, b, ab) != 0;
+  return (bool) c->unicode->compose (a, b, ab);
 }
 
 
index f6a655d..3f00b8e 100644 (file)
@@ -76,7 +76,7 @@ decompose_unicode (const hb_ot_shape_normalize_context_t *c,
                   hb_codepoint_t *a,
                   hb_codepoint_t *b)
 {
-  return c->unicode->decompose (ab, a, b) != 0;
+  return (bool) c->unicode->decompose (ab, a, b);
 }
 
 static bool
@@ -85,7 +85,7 @@ compose_unicode (const hb_ot_shape_normalize_context_t *c,
                 hb_codepoint_t  b,
                 hb_codepoint_t *ab)
 {
-  return c->unicode->compose (a, b, ab) != 0;
+  return (bool) c->unicode->compose (a, b, ab);
 }
 
 static inline void
@@ -127,7 +127,7 @@ decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint
       (b && !font->get_glyph (b, 0, &b_glyph)))
     return 0;
 
-  bool has_a = font->get_glyph (a, 0, &a_glyph) != 0;
+  bool has_a = (bool) font->get_glyph (a, 0, &a_glyph);
   if (shortest && has_a) {
     /* Output a and b */
     output_char (buffer, a, a_glyph);
index bfbd533..7a93c62 100644 (file)
@@ -688,7 +688,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
 {
   bool ret = false;
   unsigned int count = c->buffer->len;
-  bool has_positioning = hb_ot_layout_has_positioning (c->face) != 0;
+  bool has_positioning = (bool) hb_ot_layout_has_positioning (c->face);
   /* If the font has no GPOS, AND, no fallback positioning will
    * happen, AND, direction is forward, then when zeroing mark
    * widths, we shift the mark with it, such that the mark