[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Nov 20 06:16:36 UTC 2018


 src/test-name-table.cc  |    2 +-
 src/test-ot-color.cc    |   14 +++++++-------
 test/api/test-buffer.c  |    5 +++--
 test/api/test-object.c  |    2 +-
 test/api/test-ot-name.c |    2 +-
 5 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 831ba74382e35f110006539f22bebce4d57c8502
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Nov 20 01:16:08 2018 -0500

    Fix Codacy "issues"

diff --git a/src/test-name-table.cc b/src/test-name-table.cc
index 33305272..58c98f07 100644
--- a/src/test-name-table.cc
+++ b/src/test-name-table.cc
@@ -48,7 +48,7 @@ main (int argc, char **argv)
 
   for (unsigned int i = 0; i < count; i++)
   {
-    printf ("%d	%s	",
+    printf ("%u	%s	",
 	    entries[i].name_id,
 	    hb_language_to_string (entries[i].language));
 
diff --git a/src/test-ot-color.cc b/src/test-ot-color.cc
index 4b10e017..4050a664 100644
--- a/src/test-ot-color.cc
+++ b/src/test-ot-color.cc
@@ -54,7 +54,7 @@ svg_dump (hb_face_t *face, unsigned int face_index)
     const char *data = hb_blob_get_data (blob, &length);
 
     char output_path[255];
-    sprintf (output_path, "out/svg-%d-%d.svg%s",
+    sprintf (output_path, "out/svg-%u-%u.svg%s",
 	     glyph_id,
 	     face_index,
 	     // append "z" if the content is gzipped, https://stackoverflow.com/a/6059405
@@ -108,7 +108,7 @@ png_dump (hb_face_t *face, unsigned int face_index)
 	const char *data = hb_blob_get_data (blob, &length);
 
 	char output_path[255];
-	sprintf (output_path, "out/png-%d-%d-%d.png", glyph_id, strike, face_index);
+	sprintf (output_path, "out/png-%u-%u-%u.png", glyph_id, strike, face_index);
 
 	FILE *f = fopen (output_path, "wb");
 	fwrite (data, 1, length, f);
@@ -167,9 +167,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int
 
       // Render
       unsigned int palette_count = hb_ot_color_palette_get_count (face);
-      for (unsigned int palette = 0; palette < palette_count; palette++) {
-	char output_path[255];
-
+      for (unsigned int palette = 0; palette < palette_count; palette++)
+      {
 	unsigned int num_colors = hb_ot_color_palette_get_colors (face, palette, 0, NULL, NULL);
 	if (!num_colors)
 	  continue;
@@ -178,7 +177,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int
 	hb_ot_color_palette_get_colors (face, palette, 0, &num_colors, colors);
 	if (num_colors)
 	{
-	  sprintf (output_path, "out/colr-%d-%d-%d.svg", gid, palette, face_index);
+	  char output_path[255];
+	  sprintf (output_path, "out/colr-%u-%u-%u.svg", gid, palette, face_index);
 
 	  cairo_surface_t *surface = cairo_svg_surface_create (output_path, extents.width, extents.height);
 	  cairo_t *cr = cairo_create (surface);
@@ -245,7 +245,7 @@ dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem,
     // Render
     {
       char output_path[255];
-      sprintf (output_path, "out/%d-%d.svg", face_index, i);
+      sprintf (output_path, "out/%u-%u.svg", face_index, i);
       cairo_surface_t *surface = cairo_svg_surface_create (output_path, extents.width, extents.height);
       cairo_t *cr = cairo_create (surface);
       cairo_set_font_face (cr, cairo_face);
diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c
index 5fba3b22..64ab3db9 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -379,14 +379,15 @@ static void
 test_buffer_utf8_conversion (void)
 {
   hb_buffer_t *b;
-  hb_glyph_info_t *glyphs;
-  unsigned int bytes, chars, i, j, len;
+  unsigned int chars, i, j, len;
 
   b = hb_buffer_create ();
   hb_buffer_set_replacement_codepoint (b, (hb_codepoint_t) -1);
 
   for (i = 0; i < G_N_ELEMENTS (utf8_conversion_tests); i++)
   {
+    unsigned int bytes;
+    hb_glyph_info_t *glyphs;
     const utf8_conversion_test_t *test = &utf8_conversion_tests[i];
     char *escaped;
 
diff --git a/test/api/test-object.c b/test/api/test-object.c
index 02b9760d..093615e8 100644
--- a/test/api/test-object.c
+++ b/test/api/test-object.c
@@ -235,7 +235,7 @@ test_object (void)
 
     {
       unsigned int j;
-      data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
+      data_t data[1000] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
       deadlock_test_t deadlock_test;
 
       g_test_message ("Testing object %s", o->name);
diff --git a/test/api/test-ot-name.c b/test/api/test-ot-name.c
index 71a8727b..9e88015f 100644
--- a/test/api/test-ot-name.c
+++ b/test/api/test-ot-name.c
@@ -81,7 +81,7 @@ test_ot_name (void)
   hb_ot_name_id_t name_id = entries[3].name_id;
   g_assert_cmpuint (3, ==, name_id);
   hb_language_t lang = entries[3].language;
-  g_assert_cmpstr ("en", ==, hb_language_to_string (lang));
+  g_assert_cmpstr (hb_language_to_string (lang), ==, "en");
   char text[10];
   unsigned int text_size = 10;
   g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, &text_size, text));


More information about the HarfBuzz mailing list