提交 831ba743 编写于 作者: B Behdad Esfahbod

Fix Codacy "issues"

上级 c49e43c1
...@@ -48,7 +48,7 @@ main (int argc, char **argv) ...@@ -48,7 +48,7 @@ main (int argc, char **argv)
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
printf ("%d %s ", printf ("%u %s ",
entries[i].name_id, entries[i].name_id,
hb_language_to_string (entries[i].language)); hb_language_to_string (entries[i].language));
......
...@@ -54,7 +54,7 @@ svg_dump (hb_face_t *face, unsigned int face_index) ...@@ -54,7 +54,7 @@ svg_dump (hb_face_t *face, unsigned int face_index)
const char *data = hb_blob_get_data (blob, &length); const char *data = hb_blob_get_data (blob, &length);
char output_path[255]; char output_path[255];
sprintf (output_path, "out/svg-%d-%d.svg%s", sprintf (output_path, "out/svg-%u-%u.svg%s",
glyph_id, glyph_id,
face_index, face_index,
// append "z" if the content is gzipped, https://stackoverflow.com/a/6059405 // 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) ...@@ -108,7 +108,7 @@ png_dump (hb_face_t *face, unsigned int face_index)
const char *data = hb_blob_get_data (blob, &length); const char *data = hb_blob_get_data (blob, &length);
char output_path[255]; 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"); FILE *f = fopen (output_path, "wb");
fwrite (data, 1, length, f); fwrite (data, 1, length, f);
...@@ -167,9 +167,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int ...@@ -167,9 +167,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int
// Render // Render
unsigned int palette_count = hb_ot_color_palette_get_count (face); unsigned int palette_count = hb_ot_color_palette_get_count (face);
for (unsigned int palette = 0; palette < palette_count; palette++) { for (unsigned int palette = 0; palette < palette_count; palette++)
char output_path[255]; {
unsigned int num_colors = hb_ot_color_palette_get_colors (face, palette, 0, NULL, NULL); unsigned int num_colors = hb_ot_color_palette_get_colors (face, palette, 0, NULL, NULL);
if (!num_colors) if (!num_colors)
continue; continue;
...@@ -178,7 +177,8 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int ...@@ -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); hb_ot_color_palette_get_colors (face, palette, 0, &num_colors, colors);
if (num_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_surface_t *surface = cairo_svg_surface_create (output_path, extents.width, extents.height);
cairo_t *cr = cairo_create (surface); cairo_t *cr = cairo_create (surface);
...@@ -245,7 +245,7 @@ dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, ...@@ -245,7 +245,7 @@ dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem,
// Render // Render
{ {
char output_path[255]; 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_surface_t *surface = cairo_svg_surface_create (output_path, extents.width, extents.height);
cairo_t *cr = cairo_create (surface); cairo_t *cr = cairo_create (surface);
cairo_set_font_face (cr, cairo_face); cairo_set_font_face (cr, cairo_face);
......
...@@ -379,14 +379,15 @@ static void ...@@ -379,14 +379,15 @@ static void
test_buffer_utf8_conversion (void) test_buffer_utf8_conversion (void)
{ {
hb_buffer_t *b; hb_buffer_t *b;
hb_glyph_info_t *glyphs; unsigned int chars, i, j, len;
unsigned int bytes, chars, i, j, len;
b = hb_buffer_create (); b = hb_buffer_create ();
hb_buffer_set_replacement_codepoint (b, (hb_codepoint_t) -1); hb_buffer_set_replacement_codepoint (b, (hb_codepoint_t) -1);
for (i = 0; i < G_N_ELEMENTS (utf8_conversion_tests); i++) 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]; const utf8_conversion_test_t *test = &utf8_conversion_tests[i];
char *escaped; char *escaped;
......
...@@ -235,7 +235,7 @@ test_object (void) ...@@ -235,7 +235,7 @@ test_object (void)
{ {
unsigned int j; unsigned int j;
data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}}; data_t data[1000] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
deadlock_test_t deadlock_test; deadlock_test_t deadlock_test;
g_test_message ("Testing object %s", o->name); g_test_message ("Testing object %s", o->name);
......
...@@ -81,7 +81,7 @@ test_ot_name (void) ...@@ -81,7 +81,7 @@ test_ot_name (void)
hb_ot_name_id_t name_id = entries[3].name_id; hb_ot_name_id_t name_id = entries[3].name_id;
g_assert_cmpuint (3, ==, name_id); g_assert_cmpuint (3, ==, name_id);
hb_language_t lang = entries[3].language; 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]; char text[10];
unsigned int text_size = 10; unsigned int text_size = 10;
g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, &text_size, text)); g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, &text_size, text));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册