Fix warnings produced by clang analyzer
This commit is contained in:
parent
7ec83051c0
commit
a18280a8ce
|
@ -255,13 +255,15 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||||
} else {
|
} else {
|
||||||
/* If decomposed to more than two characters, take the last one,
|
/* If decomposed to more than two characters, take the last one,
|
||||||
* and recompose the rest to get the first component. */
|
* and recompose the rest to get the first component. */
|
||||||
U16_PREV_UNSAFE (normalized, len, *b);
|
U16_PREV_UNSAFE (normalized, len, *b); /* Changes len in-place. */
|
||||||
UChar recomposed[20];
|
UChar recomposed[18 * 2];
|
||||||
icu_err = U_ZERO_ERROR;
|
icu_err = U_ZERO_ERROR;
|
||||||
len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
|
len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err);
|
||||||
if (U_FAILURE (icu_err))
|
if (U_FAILURE (icu_err))
|
||||||
return false;
|
return false;
|
||||||
/* We expect that recomposed has exactly one character now. */
|
/* We expect that recomposed has exactly one character now. */
|
||||||
|
if (unlikely (u_countChar32 (recomposed, len) != 1))
|
||||||
|
return false;
|
||||||
U16_GET_UNSAFE (recomposed, 0, *a);
|
U16_GET_UNSAFE (recomposed, 0, *a);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ test_blob_empty (void)
|
||||||
g_assert_cmpint (len, ==, 0);
|
g_assert_cmpint (len, ==, 0);
|
||||||
|
|
||||||
data_writable = hb_blob_get_data_writable (blob, NULL);
|
data_writable = hb_blob_get_data_writable (blob, NULL);
|
||||||
g_assert (data == NULL);
|
g_assert (data_writable == NULL);
|
||||||
|
|
||||||
data_writable = hb_blob_get_data_writable (blob, &len);
|
data_writable = hb_blob_get_data_writable (blob, &len);
|
||||||
g_assert (data_writable == NULL);
|
g_assert (data_writable == NULL);
|
||||||
|
|
|
@ -152,7 +152,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
len = hb_buffer_get_length (b);
|
len = hb_buffer_get_length (b);
|
||||||
glyphs = hb_buffer_get_glyph_infos (b, NULL); /* test NULL */
|
hb_buffer_get_glyph_infos (b, NULL); /* test NULL */
|
||||||
glyphs = hb_buffer_get_glyph_infos (b, &len2);
|
glyphs = hb_buffer_get_glyph_infos (b, &len2);
|
||||||
g_assert_cmpint (len, ==, len2);
|
g_assert_cmpint (len, ==, len2);
|
||||||
g_assert_cmpint (len, ==, 5);
|
g_assert_cmpint (len, ==, 5);
|
||||||
|
@ -264,7 +264,7 @@ test_buffer_positions (fixture_t *fixture, gconstpointer user_data)
|
||||||
|
|
||||||
/* Without shaping, positions should all be zero */
|
/* Without shaping, positions should all be zero */
|
||||||
len = hb_buffer_get_length (b);
|
len = hb_buffer_get_length (b);
|
||||||
positions = hb_buffer_get_glyph_positions (b, NULL); /* test NULL */
|
hb_buffer_get_glyph_positions (b, NULL); /* test NULL */
|
||||||
positions = hb_buffer_get_glyph_positions (b, &len2);
|
positions = hb_buffer_get_glyph_positions (b, &len2);
|
||||||
g_assert_cmpint (len, ==, len2);
|
g_assert_cmpint (len, ==, len2);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
|
|
|
@ -416,7 +416,7 @@ helper_cairo_line_from_buffer (helper_cairo_line_t *l,
|
||||||
hb_bool_t backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer));
|
hb_bool_t backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer));
|
||||||
l->cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : (cairo_text_cluster_flags_t) 0;
|
l->cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : (cairo_text_cluster_flags_t) 0;
|
||||||
unsigned int cluster = 0;
|
unsigned int cluster = 0;
|
||||||
const char *start = l->utf8, *end = start;
|
const char *start = l->utf8, *end;
|
||||||
l->clusters[cluster].num_glyphs++;
|
l->clusters[cluster].num_glyphs++;
|
||||||
if (backward) {
|
if (backward) {
|
||||||
for (i = l->num_glyphs - 2; i >= 0; i--) {
|
for (i = l->num_glyphs - 2; i >= 0; i--) {
|
||||||
|
|
Loading…
Reference in New Issue