Rename HeadlessArrayOf::len to lenP1

So it doesn't accidentally match our templates, etc.
This commit is contained in:
Behdad Esfahbod 2018-09-13 20:21:54 +02:00
parent 180a88a96c
commit effc7ced72
3 changed files with 17 additions and 17 deletions

View File

@ -570,16 +570,16 @@ struct HeadlessArrayOf
{ {
inline const Type& operator [] (unsigned int i) const inline const Type& operator [] (unsigned int i) const
{ {
if (unlikely (i >= len || !i)) return Null(Type); if (unlikely (i >= lenP1 || !i)) return Null(Type);
return arrayZ[i-1]; return arrayZ[i-1];
} }
inline Type& operator [] (unsigned int i) inline Type& operator [] (unsigned int i)
{ {
if (unlikely (i >= len || !i)) return Crap(Type); if (unlikely (i >= lenP1 || !i)) return Crap(Type);
return arrayZ[i-1]; return arrayZ[i-1];
} }
inline unsigned int get_size (void) const inline unsigned int get_size (void) const
{ return len.static_size + (len ? len - 1 : 0) * Type::static_size; } { return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; }
inline bool serialize (hb_serialize_context_t *c, inline bool serialize (hb_serialize_context_t *c,
Supplier<Type> &items, Supplier<Type> &items,
@ -587,7 +587,7 @@ struct HeadlessArrayOf
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
len.set (items_len); /* TODO(serialize) Overflow? */ lenP1.set (items_len); /* TODO(serialize) Overflow? */
if (unlikely (!items_len)) return_trace (true); if (unlikely (!items_len)) return_trace (true);
if (unlikely (!c->extend (*this))) return_trace (false); if (unlikely (!c->extend (*this))) return_trace (false);
for (unsigned int i = 0; i < items_len - 1; i++) for (unsigned int i = 0; i < items_len - 1; i++)
@ -617,12 +617,12 @@ struct HeadlessArrayOf
inline bool sanitize_shallow (hb_sanitize_context_t *c) const inline bool sanitize_shallow (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (len.sanitize (c) && return_trace (lenP1.sanitize (c) &&
(!len || c->check_array (arrayZ, len - 1))); (!lenP1 || c->check_array (arrayZ, lenP1 - 1)));
} }
public: public:
LenType len; LenType lenP1;
Type arrayZ[VAR]; Type arrayZ[VAR];
public: public:
DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ); DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ);

View File

@ -710,7 +710,7 @@ struct Ligature
{ {
inline bool intersects (const hb_set_t *glyphs) const inline bool intersects (const hb_set_t *glyphs) const
{ {
unsigned int count = component.len; unsigned int count = component.lenP1;
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
if (!glyphs->has (component[i])) if (!glyphs->has (component[i]))
return false; return false;
@ -720,7 +720,7 @@ struct Ligature
inline void closure (hb_closure_context_t *c) const inline void closure (hb_closure_context_t *c) const
{ {
TRACE_CLOSURE (this); TRACE_CLOSURE (this);
unsigned int count = component.len; unsigned int count = component.lenP1;
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
if (!c->glyphs->has (component[i])) if (!c->glyphs->has (component[i]))
return; return;
@ -730,14 +730,14 @@ struct Ligature
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
TRACE_COLLECT_GLYPHS (this); TRACE_COLLECT_GLYPHS (this);
c->input->add_array (component.arrayZ, component.len ? component.len - 1 : 0); c->input->add_array (component.arrayZ, component.lenP1 ? component.lenP1 - 1 : 0);
c->output->add (ligGlyph); c->output->add (ligGlyph);
} }
inline bool would_apply (hb_would_apply_context_t *c) const inline bool would_apply (hb_would_apply_context_t *c) const
{ {
TRACE_WOULD_APPLY (this); TRACE_WOULD_APPLY (this);
if (c->len != component.len) if (c->len != component.lenP1)
return_trace (false); return_trace (false);
for (unsigned int i = 1; i < c->len; i++) for (unsigned int i = 1; i < c->len; i++)
@ -750,7 +750,7 @@ struct Ligature
inline bool apply (hb_ot_apply_context_t *c) const inline bool apply (hb_ot_apply_context_t *c) const
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
unsigned int count = component.len; unsigned int count = component.lenP1;
if (unlikely (!count)) return_trace (false); if (unlikely (!count)) return_trace (false);

View File

@ -1879,7 +1879,7 @@ struct ChainRule
const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input); const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input);
return chain_context_intersects (glyphs, return chain_context_intersects (glyphs,
backtrack.len, backtrack.arrayZ, backtrack.len, backtrack.arrayZ,
input.len, input.arrayZ, input.lenP1, input.arrayZ,
lookahead.len, lookahead.arrayZ, lookahead.len, lookahead.arrayZ,
lookup_context); lookup_context);
} }
@ -1892,7 +1892,7 @@ struct ChainRule
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
chain_context_closure_lookup (c, chain_context_closure_lookup (c,
backtrack.len, backtrack.arrayZ, backtrack.len, backtrack.arrayZ,
input.len, input.arrayZ, input.lenP1, input.arrayZ,
lookahead.len, lookahead.arrayZ, lookahead.len, lookahead.arrayZ,
lookup.len, lookup.arrayZ, lookup.len, lookup.arrayZ,
lookup_context); lookup_context);
@ -1906,7 +1906,7 @@ struct ChainRule
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
chain_context_collect_glyphs_lookup (c, chain_context_collect_glyphs_lookup (c,
backtrack.len, backtrack.arrayZ, backtrack.len, backtrack.arrayZ,
input.len, input.arrayZ, input.lenP1, input.arrayZ,
lookahead.len, lookahead.arrayZ, lookahead.len, lookahead.arrayZ,
lookup.len, lookup.arrayZ, lookup.len, lookup.arrayZ,
lookup_context); lookup_context);
@ -1920,7 +1920,7 @@ struct ChainRule
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return_trace (chain_context_would_apply_lookup (c, return_trace (chain_context_would_apply_lookup (c,
backtrack.len, backtrack.arrayZ, backtrack.len, backtrack.arrayZ,
input.len, input.arrayZ, input.lenP1, input.arrayZ,
lookahead.len, lookahead.arrayZ, lookup.len, lookahead.len, lookahead.arrayZ, lookup.len,
lookup.arrayZ, lookup_context)); lookup.arrayZ, lookup_context));
} }
@ -1933,7 +1933,7 @@ struct ChainRule
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return_trace (chain_context_apply_lookup (c, return_trace (chain_context_apply_lookup (c,
backtrack.len, backtrack.arrayZ, backtrack.len, backtrack.arrayZ,
input.len, input.arrayZ, input.lenP1, input.arrayZ,
lookahead.len, lookahead.arrayZ, lookup.len, lookahead.len, lookahead.arrayZ, lookup.len,
lookup.arrayZ, lookup_context)); lookup.arrayZ, lookup_context));
} }