Minor compiler warning fixes

This commit is contained in:
Behdad Esfahbod 2011-06-15 09:49:58 -04:00
parent e3693b72f0
commit 31f18abecb
9 changed files with 48 additions and 46 deletions

View File

@ -128,13 +128,13 @@ struct _hb_buffer_t {
inline void reset_masks (hb_mask_t mask) inline void reset_masks (hb_mask_t mask)
{ {
for (unsigned int i = 0; i < len; i++) for (unsigned int j = 0; j < len; j++)
info[i].mask = mask; info[j].mask = mask;
} }
inline void add_masks (hb_mask_t mask) inline void add_masks (hb_mask_t mask)
{ {
for (unsigned int i = 0; i < len; i++) for (unsigned int j = 0; j < len; j++)
info[i].mask |= mask; info[j].mask |= mask;
} }
inline void set_masks (hb_mask_t value, inline void set_masks (hb_mask_t value,
hb_mask_t mask, hb_mask_t mask,

View File

@ -179,11 +179,11 @@ struct _hb_object_header_t {
inline bool set_user_data (hb_user_data_key_t *key, inline bool set_user_data (hb_user_data_key_t *key,
void * data, void * data,
hb_destroy_func_t destroy) { hb_destroy_func_t destroy_func) {
if (unlikely (!this || this->is_inert ())) if (unlikely (!this || this->is_inert ()))
return false; return false;
return user_data.set (key, data, destroy); return user_data.set (key, data, destroy_func);
} }
inline void *get_user_data (hb_user_data_key_t *key) { inline void *get_user_data (hb_user_data_key_t *key) {

View File

@ -151,7 +151,7 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
template <int max_depth> template <int max_depth>
struct hb_trace_t { struct hb_trace_t {
explicit hb_trace_t (unsigned int *pdepth, const char *what, const char *function, const void *obj) : pdepth(pdepth) { explicit hb_trace_t (unsigned int *pdepth_, const char *what, const char *function, const void *obj) : pdepth(pdepth_) {
(void) (*pdepth < max_depth && (void) (*pdepth < max_depth &&
fprintf (stderr, "%s(%p) %-*d-> %s\n", what, obj, *pdepth, *pdepth, function)); fprintf (stderr, "%s(%p) %-*d-> %s\n", what, obj, *pdepth, *pdepth, function));
if (max_depth) ++*pdepth; if (max_depth) ++*pdepth;
@ -183,9 +183,9 @@ struct hb_trace_t<0> {
struct hb_sanitize_context_t struct hb_sanitize_context_t
{ {
inline void init (hb_blob_t *blob) inline void init (hb_blob_t *b)
{ {
this->blob = hb_blob_reference (blob); this->blob = hb_blob_reference (b);
this->writable = false; this->writable = false;
} }

View File

@ -89,10 +89,10 @@ struct RecordArrayOf : SortedArrayOf<Record<Type> > {
hb_tag_t *record_tags /* OUT */) const hb_tag_t *record_tags /* OUT */) const
{ {
if (record_count) { if (record_count) {
const Record<Type> *array = this->sub_array (start_offset, record_count); const Record<Type> *arr = this->sub_array (start_offset, record_count);
unsigned int count = *record_count; unsigned int count = *record_count;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
record_tags[i] = array[i].tag; record_tags[i] = arr[i].tag;
} }
return this->len; return this->len;
} }
@ -150,10 +150,10 @@ struct IndexArray : ArrayOf<Index>
unsigned int *_indexes /* OUT */) const unsigned int *_indexes /* OUT */) const
{ {
if (_count) { if (_count) {
const USHORT *array = this->sub_array (start_offset, _count); const USHORT *arr = this->sub_array (start_offset, _count);
unsigned int count = *_count; unsigned int count = *_count;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
_indexes[i] = array[i]; _indexes[i] = arr[i];
} }
return this->len; return this->len;
} }

View File

@ -104,21 +104,23 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
/* Sort features and merge duplicates */ /* Sort features and merge duplicates */
feature_infos.sort (); {
unsigned int j = 0; feature_infos.sort ();
for (unsigned int i = 1; i < feature_infos.len; i++) unsigned int j = 0;
if (feature_infos[i].tag != feature_infos[j].tag) for (unsigned int i = 1; i < feature_infos.len; i++)
feature_infos[++j] = feature_infos[i]; if (feature_infos[i].tag != feature_infos[j].tag)
else { feature_infos[++j] = feature_infos[i];
if (feature_infos[i].global)
feature_infos[j] = feature_infos[i];
else { else {
feature_infos[j].global = false; if (feature_infos[i].global)
feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value); feature_infos[j] = feature_infos[i];
/* Inherit default_value from j */ else {
feature_infos[j].global = false;
feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
/* Inherit default_value from j */
}
} }
} feature_infos.shrink (j + 1);
feature_infos.shrink (j + 1); }
/* Allocate bits now */ /* Allocate bits now */

View File

@ -121,8 +121,7 @@ enum {
static const struct arabic_state_table_entry { static const struct arabic_state_table_entry {
uint8_t prev_action; uint8_t prev_action;
uint8_t curr_action; uint8_t curr_action;
uint8_t next_state; uint16_t next_state;
uint8_t padding;
} arabic_state_table[][NUM_STATE_MACHINE_COLS] = } arabic_state_table[][NUM_STATE_MACHINE_COLS] =
{ {
/* jt_U, jt_R, jt_D, jg_ALAPH, jg_DALATH_RISH */ /* jt_U, jt_R, jt_D, jg_ALAPH, jg_DALATH_RISH */

View File

@ -72,8 +72,6 @@ static int height = 0;
static cairo_surface_t *surface = NULL; static cairo_surface_t *surface = NULL;
static cairo_pattern_t *fore_pattern = NULL; static cairo_pattern_t *fore_pattern = NULL;
static cairo_pattern_t *back_pattern = NULL; static cairo_pattern_t *back_pattern = NULL;
static FT_Library ft_library;
static FT_Face ft_face;
static cairo_font_face_t *cairo_face; static cairo_font_face_t *cairo_face;
@ -141,6 +139,7 @@ parse_opts (int argc, char **argv)
break; break;
case 'm': case 'm':
switch (sscanf (optarg, "%d %d %d %d", &margin_t, &margin_r, &margin_b, &margin_l)) { switch (sscanf (optarg, "%d %d %d %d", &margin_t, &margin_r, &margin_b, &margin_l)) {
default: break;
case 1: margin_r = margin_t; case 1: margin_r = margin_t;
case 2: margin_b = margin_t; case 2: margin_b = margin_t;
case 3: margin_l = margin_r; case 3: margin_l = margin_r;
@ -346,7 +345,7 @@ static void parse_features (char *s)
static cairo_glyph_t * static cairo_glyph_t *
_hb_cr_text_glyphs (cairo_t *cr, _hb_cr_text_glyphs (cairo_t *cr,
const char *text, int len, const char *utf8, int len,
unsigned int *pnum_glyphs) unsigned int *pnum_glyphs)
{ {
cairo_scaled_font_t *scaled_font = cairo_get_scaled_font (cr); cairo_scaled_font_t *scaled_font = cairo_get_scaled_font (cr);
@ -369,8 +368,8 @@ _hb_cr_text_glyphs (cairo_t *cr,
hb_buffer_set_language (hb_buffer, hb_language_from_string (language)); hb_buffer_set_language (hb_buffer, hb_language_from_string (language));
if (len < 0) if (len < 0)
len = strlen (text); len = strlen (utf8);
hb_buffer_add_utf8 (hb_buffer, text, len, 0, len); hb_buffer_add_utf8 (hb_buffer, utf8, len, 0, len);
hb_shape (hb_font, hb_buffer, features, num_features); hb_shape (hb_font, hb_buffer, features, num_features);
@ -526,6 +525,8 @@ draw (void)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
static FT_Library ft_library;
static FT_Face ft_face;
cairo_status_t status; cairo_status_t status;
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");

View File

@ -231,7 +231,7 @@ test_object (void)
hb_user_data_key_t key[2]; hb_user_data_key_t key[2];
{ {
unsigned int i; unsigned int j;
data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}}; data_t data[2] = {{MAGIC0, FALSE}, {MAGIC1, FALSE}};
deadlock_test_t deadlock_test; deadlock_test_t deadlock_test;
@ -282,16 +282,16 @@ test_object (void)
g_assert_cmpuint (global_data, ==, 1); g_assert_cmpuint (global_data, ==, 1);
global_data = 0; global_data = 0;
for (i = 2; i < 1000; i++) for (j = 2; j < 1000; j++)
g_assert (o->set_user_data (obj, &key[i], &data[i], global_free_up)); g_assert (o->set_user_data (obj, &key[j], &data[j], global_free_up));
for (i = 2; i < 1000; i++) for (j = 2; j < 1000; j++)
g_assert (o->get_user_data (obj, &key[i]) == &data[i]); g_assert (o->get_user_data (obj, &key[j]) == &data[j]);
for (i = 100; i < 1000; i++) for (j = 100; j < 1000; j++)
g_assert (o->set_user_data (obj, &key[i], NULL, NULL)); g_assert (o->set_user_data (obj, &key[j], NULL, NULL));
for (i = 2; i < 100; i++) for (j = 2; j < 100; j++)
g_assert (o->get_user_data (obj, &key[i]) == &data[i]); g_assert (o->get_user_data (obj, &key[j]) == &data[j]);
for (i = 100; i < 1000; i++) for (j = 100; j < 1000; j++)
g_assert (!o->get_user_data (obj, &key[i])); g_assert (!o->get_user_data (obj, &key[j]));
g_assert_cmpuint (global_data, ==, 900); g_assert_cmpuint (global_data, ==, 900);
/* Test set_user_data where the destroy() func calls user_data functions. /* Test set_user_data where the destroy() func calls user_data functions.

View File

@ -511,9 +511,9 @@ test_unicode_properties (gconstpointer user_data)
} }
static hb_codepoint_t static hb_codepoint_t
default_value (hb_codepoint_t default_value, hb_codepoint_t unicode) default_value (hb_codepoint_t _default_value, hb_codepoint_t unicode)
{ {
return default_value == RETURNS_UNICODE_ITSELF ? unicode : default_value; return _default_value == RETURNS_UNICODE_ITSELF ? unicode : _default_value;
} }
static void static void