Rename const_array() to array() (overloaded)

This commit is contained in:
Behdad Esfahbod 2010-04-21 22:37:31 -04:00
parent 2e2f43edf2
commit 2cb08458f6
4 changed files with 19 additions and 19 deletions

View File

@ -513,7 +513,7 @@ struct LongOffsetTo : GenericOffsetTo<LongOffset, Type> {};
template <typename LenType, typename Type> template <typename LenType, typename Type>
struct GenericArrayOf struct GenericArrayOf
{ {
const Type *const_array(void) const { return &StructAfter<Type> (len); } const Type *array(void) const { return &StructAfter<Type> (len); }
Type *array(void) { return &StructAfter<Type> (len); } Type *array(void) { return &StructAfter<Type> (len); }
const Type *const_sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const const Type *const_sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const
@ -525,13 +525,13 @@ struct GenericArrayOf
count -= start_offset; count -= start_offset;
count = MIN (count, *pcount); count = MIN (count, *pcount);
*pcount = count; *pcount = count;
return const_array() + start_offset; return array() + start_offset;
} }
inline const Type& operator [] (unsigned int i) const inline const Type& operator [] (unsigned int i) const
{ {
if (HB_UNLIKELY (i >= len)) return Null(Type); if (HB_UNLIKELY (i >= len)) return Null(Type);
return const_array()[i]; return array()[i];
} }
inline unsigned int get_size () const inline unsigned int get_size () const
{ return len.get_size () + len * Type::get_size (); } { return len.get_size () + len * Type::get_size (); }
@ -612,7 +612,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
inline const Type& operator [] (unsigned int i) const inline const Type& operator [] (unsigned int i) const
{ {
if (HB_UNLIKELY (i >= this->len)) return Null(Type); if (HB_UNLIKELY (i >= this->len)) return Null(Type);
return this+this->const_array()[i]; return this+this->array()[i];
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
@ -631,13 +631,13 @@ struct OffsetListOf : OffsetArrayOf<Type>
template <typename Type> template <typename Type>
struct HeadlessArrayOf struct HeadlessArrayOf
{ {
const Type *const_array(void) const { return &StructAfter<Type> (len); } const Type *array(void) const { return &StructAfter<Type> (len); }
Type *array(void) { return &StructAfter<Type> (len); } Type *array(void) { return &StructAfter<Type> (len); }
inline const Type& operator [] (unsigned int i) const inline const Type& operator [] (unsigned int i) const
{ {
if (HB_UNLIKELY (i >= len || !i)) return Null(Type); if (HB_UNLIKELY (i >= len || !i)) return Null(Type);
return const_array()[i-1]; return array()[i-1];
} }
inline unsigned int get_size () const inline unsigned int get_size () const
{ return len.get_size () + (len ? len - 1 : 0) * Type::get_size (); } { return len.get_size () + (len ? len - 1 : 0) * Type::get_size (); }

View File

@ -88,7 +88,7 @@ struct RecordArrayOf : ArrayOf<Record<Type> > {
Tag t; Tag t;
t.set (tag); t.set (tag);
// TODO bsearch // TODO bsearch
const Record<Type> *a = this->const_array(); const Record<Type> *a = this->array();
unsigned int count = this->len; unsigned int count = this->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
@ -122,7 +122,7 @@ struct IndexArray : ArrayOf<USHORT>
{ {
if (HB_UNLIKELY (i >= this->len)) if (HB_UNLIKELY (i >= this->len))
return NO_INDEX; return NO_INDEX;
return this->const_array()[i]; return this->array()[i];
} }
inline unsigned int get_indexes (unsigned int start_offset, inline unsigned int get_indexes (unsigned int start_offset,
unsigned int *_count /* IN/OUT */, unsigned int *_count /* IN/OUT */,

View File

@ -159,7 +159,7 @@ struct Sequence
return false; return false;
_hb_buffer_add_output_glyphs_be16 (buffer, 1, _hb_buffer_add_output_glyphs_be16 (buffer, 1,
substitute.len, (const uint16_t *) substitute.const_array(), substitute.len, (const uint16_t *) substitute.array(),
0xFFFF, 0xFFFF); 0xFFFF, 0xFFFF);
/* This is a guess only ... */ /* This is a guess only ... */
@ -590,10 +590,10 @@ struct ReverseChainSingleSubstFormat1
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead); const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
if (match_backtrack (APPLY_ARG, if (match_backtrack (APPLY_ARG,
backtrack.len, (USHORT *) backtrack.const_array(), backtrack.len, (USHORT *) backtrack.array(),
match_coverage, ConstCharP(this)) && match_coverage, ConstCharP(this)) &&
match_lookahead (APPLY_ARG, match_lookahead (APPLY_ARG,
lookahead.len, (USHORT *) lookahead.const_array(), lookahead.len, (USHORT *) lookahead.array(),
match_coverage, ConstCharP(this), match_coverage, ConstCharP(this),
1)) 1))
{ {

View File

@ -573,10 +573,10 @@ struct ChainRule
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input); const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead); const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return chain_context_lookup (APPLY_ARG, return chain_context_lookup (APPLY_ARG,
backtrack.len, backtrack.const_array(), backtrack.len, backtrack.array(),
input.len, input.const_array(), input.len, input.array(),
lookahead.len, lookahead.const_array(), lookahead.len, lookahead.array(),
lookup.len, lookup.const_array(), lookup.len, lookup.array(),
lookup_context); lookup_context);
return false; return false;
} }
@ -755,10 +755,10 @@ struct ChainContextFormat3
{ConstCharP(this), ConstCharP(this), ConstCharP(this)} {ConstCharP(this), ConstCharP(this), ConstCharP(this)}
}; };
return chain_context_lookup (APPLY_ARG, return chain_context_lookup (APPLY_ARG,
backtrack.len, (const USHORT *) backtrack.const_array(), backtrack.len, (const USHORT *) backtrack.array(),
input.len, (const USHORT *) input.const_array() + 1, input.len, (const USHORT *) input.array() + 1,
lookahead.len, (const USHORT *) lookahead.const_array(), lookahead.len, (const USHORT *) lookahead.array(),
lookup.len, lookup.const_array(), lookup.len, lookup.array(),
lookup_context); lookup_context);
return false; return false;
} }