[HB] Couple size checks

This commit is contained in:
Behdad Esfahbod 2009-05-17 09:45:32 -04:00
parent ecf17e849d
commit 19fc24f268
3 changed files with 9 additions and 6 deletions

View File

@ -346,10 +346,10 @@ struct Ligature {
value it is later possible to check whether a specific
component value really belongs to a given ligature. */
for ( i = 0; i < count - 1; i++ )
for ( i = 1; i < count; i++ )
{
while (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM(), lookup_flag, &property))
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH(), i, lig_id);
_hb_buffer_add_output_glyph (buffer, IN_CURGLYPH(), i - 1, lig_id);
(buffer->in_pos)++;
}
@ -834,6 +834,9 @@ struct SubstLookup : Lookup {
bool ret = false;
if (HB_UNLIKELY (!buffer->in_length))
return false;
if (HB_LIKELY (!is_reverse ())) {
/* in/out forward substitution */

View File

@ -113,7 +113,7 @@ static inline bool context_lookup (LOOKUP_ARGS_DEF,
const LookupRecord *record = lookupRecord;
for (i = 0; i < count;)
{
if ( record_count && i == record->sequenceIndex )
if (record_count && i == record->sequenceIndex)
{
unsigned int old_pos = buffer->in_pos;
@ -146,7 +146,7 @@ struct Rule {
DEFINE_ARRAY_TYPE (USHORT, value, (glyphCount ? glyphCount - 1 : 0));
inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const {
const LookupRecord *record = (const LookupRecord *) ((const char *) value + sizeof (value[0]) * (glyphCount - 1));
const LookupRecord *record = (const LookupRecord *) ((const char *) value + sizeof (value[0]) * (glyphCount ? glyphCount - 1 : 0));
return context_lookup (LOOKUP_ARGS,
glyphCount,
recordCount,

View File

@ -755,7 +755,7 @@ struct CoverageRangeRecord {
USHORT startCoverageIndex; /* Coverage Index of first GlyphID in
* range */
};
ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\001");
ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\000\001");
struct CoverageFormat2 {
@ -841,7 +841,7 @@ struct ClassRangeRecord {
GlyphID end; /* Last GlyphID in the range */
USHORT classValue; /* Applied to all glyphs in the range */
};
ASSERT_SIZE_DATA (ClassRangeRecord, 6, "\001");
ASSERT_SIZE_DATA (ClassRangeRecord, 6, "\000\001");
struct ClassDefFormat2 {