Fix misc warnings reported by cppcheck
https://bugs.freedesktop.org/show_bug.cgi?id=65544
This commit is contained in:
parent
570bcccd3f
commit
7235f33f9e
|
@ -243,8 +243,8 @@ hb_language_from_string (const char *str, int len)
|
|||
if (!str || !len || !*str)
|
||||
return HB_LANGUAGE_INVALID;
|
||||
|
||||
char strbuf[32];
|
||||
if (len >= 0) {
|
||||
char strbuf[64];
|
||||
len = MIN (len, (int) sizeof (strbuf) - 1);
|
||||
str = (char *) memcpy (strbuf, str, len);
|
||||
strbuf[len] = '\0';
|
||||
|
|
|
@ -178,7 +178,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
|||
unsigned int num_features)
|
||||
{
|
||||
hb_face_t *face = font->face;
|
||||
hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
|
||||
hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
|
||||
|
||||
#define FAIL(...) \
|
||||
|
@ -232,7 +231,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
|||
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
|
||||
unsigned int num_runs = CFArrayGetCount (glyph_runs);
|
||||
|
||||
bool success = true;
|
||||
buffer->len = 0;
|
||||
|
||||
const CFRange range_all = CFRangeMake (0, 0);
|
||||
|
@ -287,7 +285,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
|||
double advance = (j + 1 < num_glyphs ? positions[j + 1].x : positions[0].x + run_width) - positions[j].x;
|
||||
|
||||
hb_glyph_info_t *info = &buffer->info[buffer->len];
|
||||
hb_glyph_position_t *pos = &buffer->pos[buffer->len];
|
||||
|
||||
info->codepoint = glyphs[j];
|
||||
info->cluster = string_indices[j];
|
||||
|
|
|
@ -336,16 +336,21 @@ struct hb_font_t {
|
|||
hb_direction_t direction,
|
||||
hb_position_t *x, hb_position_t *y)
|
||||
{
|
||||
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
|
||||
hb_bool_t ret = get_glyph_h_origin (glyph, x, y);
|
||||
if (!ret && (ret = get_glyph_v_origin (glyph, x, y))) {
|
||||
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
|
||||
{
|
||||
if (!get_glyph_h_origin (glyph, x, y) &&
|
||||
get_glyph_v_origin (glyph, x, y))
|
||||
{
|
||||
hb_position_t dx, dy;
|
||||
guess_v_origin_minus_h_origin (glyph, &dx, &dy);
|
||||
*x -= dx; *y -= dy;
|
||||
}
|
||||
} else {
|
||||
hb_bool_t ret = get_glyph_v_origin (glyph, x, y);
|
||||
if (!ret && (ret = get_glyph_h_origin (glyph, x, y))) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!get_glyph_v_origin (glyph, x, y) &&
|
||||
get_glyph_h_origin (glyph, x, y))
|
||||
{
|
||||
hb_position_t dx, dy;
|
||||
guess_v_origin_minus_h_origin (glyph, &dx, &dy);
|
||||
*x += dx; *y += dy;
|
||||
|
|
|
@ -595,7 +595,7 @@ _hb_debug_msg_va (const char *what,
|
|||
#define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
|
||||
#define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
|
||||
static const char bars[] = VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
|
||||
fprintf (stderr, "%2d %s" VRBAR "%s",
|
||||
fprintf (stderr, "%2u %s" VRBAR "%s",
|
||||
level,
|
||||
bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), (unsigned int) (sizeof (VBAR) - 1) * level),
|
||||
level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
|
||||
|
|
|
@ -197,7 +197,7 @@ hb_feature_to_string (hb_feature_t *feature,
|
|||
assert (len < ARRAY_LENGTH (s));
|
||||
len = MIN (len, size - 1);
|
||||
memcpy (buf, s, len);
|
||||
s[len] = '\0';
|
||||
buf[len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -136,7 +136,6 @@ _test_font_nil_funcs (hb_font_t *font)
|
|||
g_assert (!hb_font_get_glyph (font, 17, 2, &glyph));
|
||||
g_assert_cmpint (glyph, ==, 0);
|
||||
|
||||
x = 13;
|
||||
x = hb_font_get_glyph_h_kerning (font, 17, 19);
|
||||
g_assert_cmpint (x, ==, 0);
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ struct biimage_t
|
|||
biimage_t (unsigned int width, unsigned int height) :
|
||||
width (width),
|
||||
height (height),
|
||||
bg (0), fg (0), unicolor (true),
|
||||
data ((uint8_t *) malloc (sizeof (data[0]) * width * height)) {}
|
||||
~biimage_t (void)
|
||||
{ free (data); }
|
||||
|
|
|
@ -79,8 +79,9 @@ struct shape_closure_consumer_t : option_group_t
|
|||
first = false;
|
||||
else
|
||||
printf (" ");
|
||||
char glyph_name[32];
|
||||
if (show_glyph_names) {
|
||||
if (show_glyph_names)
|
||||
{
|
||||
char glyph_name[64];
|
||||
hb_font_get_glyph_name (font, i, glyph_name, sizeof (glyph_name));
|
||||
printf ("%s", glyph_name);
|
||||
} else
|
||||
|
|
|
@ -33,7 +33,10 @@ struct output_buffer_t
|
|||
output_buffer_t (option_parser_t *parser)
|
||||
: options (parser,
|
||||
g_strjoinv ("/", (gchar**) hb_buffer_serialize_list_formats ())),
|
||||
format (parser) {}
|
||||
format (parser),
|
||||
gs (NULL),
|
||||
line_no (0),
|
||||
font (NULL) {}
|
||||
|
||||
void init (const font_options_t *font_opts)
|
||||
{
|
||||
|
|
|
@ -34,8 +34,10 @@ template <typename output_t>
|
|||
struct shape_consumer_t
|
||||
{
|
||||
shape_consumer_t (option_parser_t *parser)
|
||||
: shaper (parser),
|
||||
output (parser) {}
|
||||
: failed (false),
|
||||
shaper (parser),
|
||||
output (parser),
|
||||
font (NULL) {}
|
||||
|
||||
void init (const font_options_t *font_opts)
|
||||
{
|
||||
|
|
|
@ -31,10 +31,12 @@
|
|||
#define VIEW_CAIRO_HH
|
||||
|
||||
|
||||
struct view_cairo_t {
|
||||
struct view_cairo_t
|
||||
{
|
||||
view_cairo_t (option_parser_t *parser)
|
||||
: output_options (parser, helper_cairo_supported_formats),
|
||||
view_options (parser) {}
|
||||
view_options (parser),
|
||||
lines (0), scale (1.0) {}
|
||||
~view_cairo_t (void) {
|
||||
if (debug)
|
||||
cairo_debug_reset_static_data ();
|
||||
|
|
Loading…
Reference in New Issue