Fix alignment-requirement missmatch

Detected by clang and lots of cmdline options.
This commit is contained in:
Behdad Esfahbod 2012-06-07 17:31:46 -04:00
parent 6095de1635
commit 2a3d911fe0
4 changed files with 7 additions and 6 deletions

View File

@ -112,7 +112,7 @@ struct _hb_buffer_t {
HB_INTERNAL void clear_positions (void); HB_INTERNAL void clear_positions (void);
HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in, HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in,
unsigned int num_out, unsigned int num_out,
const uint16_t *glyph_data_be); const char *glyph_data_be);
HB_INTERNAL void replace_glyphs (unsigned int num_in, HB_INTERNAL void replace_glyphs (unsigned int num_in,
unsigned int num_out, unsigned int num_out,
const hb_codepoint_t *glyph_data); const hb_codepoint_t *glyph_data);

View File

@ -233,7 +233,7 @@ hb_buffer_t::swap_buffers (void)
void void
hb_buffer_t::replace_glyphs_be16 (unsigned int num_in, hb_buffer_t::replace_glyphs_be16 (unsigned int num_in,
unsigned int num_out, unsigned int num_out,
const uint16_t *glyph_data_be) const char *glyph_data_be)
{ {
if (!make_room_for (num_in, num_out)) return; if (!make_room_for (num_in, num_out)) return;
@ -245,10 +245,11 @@ hb_buffer_t::replace_glyphs_be16 (unsigned int num_in,
} }
hb_glyph_info_t *pinfo = &out_info[out_len]; hb_glyph_info_t *pinfo = &out_info[out_len];
const unsigned char *data = (const unsigned char *) glyph_data_be;
for (unsigned int i = 0; i < num_out; i++) for (unsigned int i = 0; i < num_out; i++)
{ {
*pinfo = orig_info; *pinfo = orig_info;
pinfo->codepoint = hb_be_uint16 (glyph_data_be[i]); pinfo->codepoint = (data[2*i] << 8) | data[2*i+1];
pinfo++; pinfo++;
} }

View File

@ -213,7 +213,7 @@ struct Sequence
if (unlikely (!substitute.len)) return TRACE_RETURN (false); if (unlikely (!substitute.len)) return TRACE_RETURN (false);
unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0; unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0;
c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array, klass); c->replace_glyphs_be16 (1, substitute.len, (const char *) substitute.array, klass);
return TRACE_RETURN (true); return TRACE_RETURN (true);
} }
@ -502,7 +502,7 @@ struct Ligature
if (skippy_iter.idx < c->buffer->idx + count) /* No input glyphs skipped */ if (skippy_iter.idx < c->buffer->idx + count) /* No input glyphs skipped */
{ {
c->replace_glyphs_be16 (count, 1, (const uint16_t *) &ligGlyph, klass); c->replace_glyphs_be16 (count, 1, (const char *) &ligGlyph, klass);
} }
else else
{ {

View File

@ -230,7 +230,7 @@ struct hb_apply_context_t
} }
inline void replace_glyphs_be16 (unsigned int num_in, inline void replace_glyphs_be16 (unsigned int num_in,
unsigned int num_out, unsigned int num_out,
const uint16_t *glyph_data_be, const char *glyph_data_be,
unsigned int klass = 0) const unsigned int klass = 0) const
{ {
buffer->cur().props_cache() = klass; /* XXX if has gdef? */ buffer->cur().props_cache() = klass; /* XXX if has gdef? */