Fix Codacy "issues"
diff --git a/src/test-name-table.cc b/src/test-name-table.cc
index 3330527..58c98f0 100644
--- a/src/test-name-table.cc
+++ b/src/test-name-table.cc
@@ -48,7 +48,7 @@
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 4b10e01..4050a66 100644
--- a/src/test-ot-color.cc
+++ b/src/test-ot-color.cc
@@ -54,7 +54,7 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 5fba3b2..64ab3db 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -379,14 +379,15 @@
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 02b9760..093615e 100644
--- a/test/api/test-object.c
+++ b/test/api/test-object.c
@@ -235,7 +235,7 @@
{
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 71a8727..9e88015 100644
--- a/test/api/test-ot-name.c
+++ b/test/api/test-ot-name.c
@@ -81,7 +81,7 @@
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));