提交 19fc24f2 编写于 作者: B Behdad Esfahbod

[HB] Couple size checks

上级 ecf17e84
...@@ -346,10 +346,10 @@ struct Ligature { ...@@ -346,10 +346,10 @@ struct Ligature {
value it is later possible to check whether a specific value it is later possible to check whether a specific
component value really belongs to a given ligature. */ 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)) 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)++; (buffer->in_pos)++;
} }
...@@ -834,6 +834,9 @@ struct SubstLookup : Lookup { ...@@ -834,6 +834,9 @@ struct SubstLookup : Lookup {
bool ret = false; bool ret = false;
if (HB_UNLIKELY (!buffer->in_length))
return false;
if (HB_LIKELY (!is_reverse ())) { if (HB_LIKELY (!is_reverse ())) {
/* in/out forward substitution */ /* in/out forward substitution */
......
...@@ -113,7 +113,7 @@ static inline bool context_lookup (LOOKUP_ARGS_DEF, ...@@ -113,7 +113,7 @@ static inline bool context_lookup (LOOKUP_ARGS_DEF,
const LookupRecord *record = lookupRecord; const LookupRecord *record = lookupRecord;
for (i = 0; i < count;) for (i = 0; i < count;)
{ {
if ( record_count && i == record->sequenceIndex ) if (record_count && i == record->sequenceIndex)
{ {
unsigned int old_pos = buffer->in_pos; unsigned int old_pos = buffer->in_pos;
...@@ -146,7 +146,7 @@ struct Rule { ...@@ -146,7 +146,7 @@ struct Rule {
DEFINE_ARRAY_TYPE (USHORT, value, (glyphCount ? glyphCount - 1 : 0)); DEFINE_ARRAY_TYPE (USHORT, value, (glyphCount ? glyphCount - 1 : 0));
inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const { 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, return context_lookup (LOOKUP_ARGS,
glyphCount, glyphCount,
recordCount, recordCount,
......
...@@ -755,7 +755,7 @@ struct CoverageRangeRecord { ...@@ -755,7 +755,7 @@ struct CoverageRangeRecord {
USHORT startCoverageIndex; /* Coverage Index of first GlyphID in USHORT startCoverageIndex; /* Coverage Index of first GlyphID in
* range */ * range */
}; };
ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\001"); ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\000\001");
struct CoverageFormat2 { struct CoverageFormat2 {
...@@ -841,7 +841,7 @@ struct ClassRangeRecord { ...@@ -841,7 +841,7 @@ struct ClassRangeRecord {
GlyphID end; /* Last GlyphID in the range */ GlyphID end; /* Last GlyphID in the range */
USHORT classValue; /* Applied to all glyphs 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 { struct ClassDefFormat2 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册