[HarfBuzz] harfbuzz-ng: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jun 7 12:44:24 PDT 2012


 src/hb-icu.cc          |    6 ++++--
 test/api/test-blob.c   |    2 +-
 test/api/test-buffer.c |    4 ++--
 util/helper-cairo.cc   |    2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit a18280a8ce9128fc9d75f8a367ae8ce0886a9599
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jun 7 15:44:12 2012 -0400

    Fix warnings produced by clang analyzer

diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index aead6dd..491c1c8 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -255,13 +255,15 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   } else {
     /* If decomposed to more than two characters, take the last one,
      * and recompose the rest to get the first component. */
-    U16_PREV_UNSAFE (normalized, len, *b);
-    UChar recomposed[20];
+    U16_PREV_UNSAFE (normalized, len, *b); /* Changes len in-place. */
+    UChar recomposed[18 * 2];
     icu_err = U_ZERO_ERROR;
     len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
     if (U_FAILURE (icu_err))
       return false;
     /* We expect that recomposed has exactly one character now. */
+    if (unlikely (u_countChar32 (recomposed, len) != 1))
+      return false;
     U16_GET_UNSAFE (recomposed, 0, *a);
     ret = true;
   }
diff --git a/test/api/test-blob.c b/test/api/test-blob.c
index 5fcb208..0e65e2f 100644
--- a/test/api/test-blob.c
+++ b/test/api/test-blob.c
@@ -68,7 +68,7 @@ test_blob_empty (void)
   g_assert_cmpint (len, ==, 0);
 
   data_writable = hb_blob_get_data_writable (blob, NULL);
-  g_assert (data == NULL);
+  g_assert (data_writable == NULL);
 
   data_writable = hb_blob_get_data_writable (blob, &len);
   g_assert (data_writable == NULL);
diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c
index ab818d0..1ddc3d8 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -152,7 +152,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data)
   }
 
   len = hb_buffer_get_length (b);
-  glyphs = hb_buffer_get_glyph_infos (b, NULL); /* test NULL */
+  hb_buffer_get_glyph_infos (b, NULL); /* test NULL */
   glyphs = hb_buffer_get_glyph_infos (b, &len2);
   g_assert_cmpint (len, ==, len2);
   g_assert_cmpint (len, ==, 5);
@@ -264,7 +264,7 @@ test_buffer_positions (fixture_t *fixture, gconstpointer user_data)
 
   /* Without shaping, positions should all be zero */
   len = hb_buffer_get_length (b);
-  positions = hb_buffer_get_glyph_positions (b, NULL); /* test NULL */
+  hb_buffer_get_glyph_positions (b, NULL); /* test NULL */
   positions = hb_buffer_get_glyph_positions (b, &len2);
   g_assert_cmpint (len, ==, len2);
   for (i = 0; i < len; i++) {
diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index 0cdfd63..35340d1 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -416,7 +416,7 @@ helper_cairo_line_from_buffer (helper_cairo_line_t *l,
     hb_bool_t backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer));
     l->cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : (cairo_text_cluster_flags_t) 0;
     unsigned int cluster = 0;
-    const char *start = l->utf8, *end = start;
+    const char *start = l->utf8, *end;
     l->clusters[cluster].num_glyphs++;
     if (backward) {
       for (i = l->num_glyphs - 2; i >= 0; i--) {



More information about the HarfBuzz mailing list