Fix Codacy "issues"

This commit is contained in:
Behdad Esfahbod 2018-11-20 01:16:08 -05:00
parent c49e43c1ff
commit 831ba74382
5 changed files with 13 additions and 12 deletions

View File

@ -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));

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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));