[serialize] Remove unnecessary pointer indirection
This commit is contained in:
parent
1c511ed6f6
commit
f0a1892ff9
|
@ -126,7 +126,7 @@ typedef struct OpenTypeOffsetTable
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
/* Alloc 12 for the OTHeader. */
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
/* Write sfntVersion (bytes 0..3). */
|
||||
sfnt_version = sfnt_tag;
|
||||
/* Take space for numTables, searchRange, entrySelector, RangeShift
|
||||
|
@ -496,7 +496,7 @@ struct OpenTypeFontFile
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
assert (sfnt_tag != TTCTag);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
return_trace (u.fontFace.serialize (c, sfnt_tag, items));
|
||||
}
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ struct UnsizedArrayOf
|
|||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend (*this, items_len))) return_trace (false);
|
||||
if (unlikely (!c->extend (this, items_len))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
|
@ -652,9 +652,9 @@ struct ArrayOf
|
|||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, unsigned items_len)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
c->check_assign (len, items_len, HB_SERIALIZE_ERROR_ARRAY_OVERFLOW);
|
||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend (this))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
|
@ -675,7 +675,7 @@ struct ArrayOf
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
len++;
|
||||
if (unlikely (!len || !c->extend (*this)))
|
||||
if (unlikely (!len || !c->extend (this)))
|
||||
{
|
||||
len--;
|
||||
return_trace (nullptr);
|
||||
|
@ -802,9 +802,9 @@ struct HeadlessArrayOf
|
|||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
c->check_assign (lenP1, items_len + 1, HB_SERIALIZE_ERROR_ARRAY_OVERFLOW);
|
||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend (this))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
|
|
|
@ -126,7 +126,7 @@ struct CFFIndex
|
|||
else
|
||||
{
|
||||
/* serialize CFFIndex header */
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
this->count = byteArray.length;
|
||||
this->offSize = offSize_;
|
||||
if (unlikely (!c->allocate_size<HBUINT8> (offSize_ * (byteArray.length + 1))))
|
||||
|
@ -214,7 +214,7 @@ struct CFFIndex
|
|||
unsigned off_size = calcOffSize (total);
|
||||
|
||||
/* serialize CFFIndex header */
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
this->count = it.len ();
|
||||
this->offSize = off_size;
|
||||
if (unlikely (!c->allocate_size<HBUINT8> (off_size * (it.len () + 1))))
|
||||
|
@ -335,7 +335,7 @@ struct CFFIndexOf : CFFIndex<COUNT>
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
/* serialize CFFIndex header */
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
this->count = dataArrayLen;
|
||||
this->offSize = offSize_;
|
||||
if (unlikely (!c->allocate_size<HBUINT8> (offSize_ * (dataArrayLen + 1))))
|
||||
|
|
|
@ -187,7 +187,7 @@ struct Encoding
|
|||
const hb_vector_t<code_pair_t>& supp_codes)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
Encoding *dest = c->extend_min (*this);
|
||||
Encoding *dest = c->extend_min (this);
|
||||
if (unlikely (!dest)) return_trace (false);
|
||||
dest->format = format | ((supp_codes.length > 0) ? 0x80 : 0);
|
||||
switch (format) {
|
||||
|
@ -457,7 +457,7 @@ struct Charset
|
|||
const hb_vector_t<code_pair_t>& sid_ranges)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
Charset *dest = c->extend_min (*this);
|
||||
Charset *dest = c->extend_min (this);
|
||||
if (unlikely (!dest)) return_trace (false);
|
||||
dest->format = format;
|
||||
switch (format)
|
||||
|
|
|
@ -253,7 +253,7 @@ struct CmapSubtableFormat4
|
|||
if (format4_iter.len () == 0) return;
|
||||
|
||||
unsigned table_initpos = c->length ();
|
||||
if (unlikely (!c->extend_min (*this))) return;
|
||||
if (unlikely (!c->extend_min (this))) return;
|
||||
this->format = 4;
|
||||
|
||||
//serialize endCode[]
|
||||
|
@ -693,7 +693,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
|
|||
{
|
||||
if (it.len () == 0) return;
|
||||
unsigned table_initpos = c->length ();
|
||||
if (unlikely (!c->extend_min (*this))) return;
|
||||
if (unlikely (!c->extend_min (this))) return;
|
||||
|
||||
hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF;
|
||||
hb_codepoint_t glyphID = 0;
|
||||
|
@ -1077,7 +1077,7 @@ struct CmapSubtableFormat14
|
|||
unsigned table_initpos = c->length ();
|
||||
const char* init_tail = c->tail;
|
||||
|
||||
if (unlikely (!c->extend_min (*this))) return;
|
||||
if (unlikely (!c->extend_min (this))) return;
|
||||
this->format = 14;
|
||||
|
||||
auto src_tbl = reinterpret_cast<const CmapSubtableFormat14*> (base);
|
||||
|
|
|
@ -145,7 +145,7 @@ struct SBIXStrike
|
|||
auto* out = c->serializer->start_embed<SBIXStrike> ();
|
||||
if (unlikely (!out)) return_trace (false);
|
||||
auto snap = c->serializer->snapshot ();
|
||||
if (unlikely (!c->serializer->extend (*out, num_output_glyphs + 1))) return_trace (false);
|
||||
if (unlikely (!c->serializer->extend (out, num_output_glyphs + 1))) return_trace (false);
|
||||
out->ppem = ppem;
|
||||
out->resolution = resolution;
|
||||
HBUINT32 head;
|
||||
|
|
|
@ -52,7 +52,7 @@ struct DeviceRecord
|
|||
|
||||
unsigned length = it.len ();
|
||||
|
||||
if (unlikely (!c->extend (*this, length))) return_trace (false);
|
||||
if (unlikely (!c->extend (this, length))) return_trace (false);
|
||||
|
||||
this->pixelSize = pixelSize;
|
||||
this->maxWidth =
|
||||
|
|
|
@ -1262,13 +1262,13 @@ struct Lookup
|
|||
unsigned int num_subtables)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
lookupType = lookup_type;
|
||||
lookupFlag = lookup_props & 0xFFFFu;
|
||||
if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
|
||||
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
||||
{
|
||||
if (unlikely (!c->extend (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend (this))) return_trace (false);
|
||||
HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
|
||||
markFilteringSet = lookup_props >> 16;
|
||||
}
|
||||
|
@ -1478,7 +1478,7 @@ struct CoverageFormat2
|
|||
bool serialize (hb_serialize_context_t *c, Iterator glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
if (unlikely (!glyphs))
|
||||
{
|
||||
|
@ -1657,7 +1657,7 @@ struct Coverage
|
|||
bool serialize (hb_serialize_context_t *c, Iterator glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
unsigned count = 0;
|
||||
unsigned num_ranges = 0;
|
||||
|
@ -1890,7 +1890,7 @@ struct ClassDefFormat1
|
|||
Iterator it)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
if (unlikely (!it))
|
||||
{
|
||||
|
@ -2069,7 +2069,7 @@ struct ClassDefFormat2
|
|||
Iterator it)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
if (unlikely (!it))
|
||||
{
|
||||
|
@ -2311,7 +2311,7 @@ struct ClassDef
|
|||
bool serialize (hb_serialize_context_t *c, Iterator it_with_class_zero)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
auto it = + it_with_class_zero | hb_filter (hb_second);
|
||||
|
||||
|
@ -2522,7 +2522,7 @@ struct VarRegionList
|
|||
bool serialize (hb_serialize_context_t *c, const VarRegionList *src, const hb_bimap_t ®ion_map)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
axisCount = src->axisCount;
|
||||
regionCount = region_map.get_population ();
|
||||
if (unlikely (hb_unsigned_mul_overflows (axisCount * regionCount,
|
||||
|
@ -2626,7 +2626,7 @@ struct VarData
|
|||
const hb_bimap_t ®ion_map)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
itemCount = inner_map.get_next_value ();
|
||||
|
||||
/* Optimize short count */
|
||||
|
@ -2778,7 +2778,7 @@ struct VariationStore
|
|||
const hb_array_t <hb_inc_bimap_t> &inner_maps)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
unsigned int set_count = 0;
|
||||
for (unsigned int i = 0; i < inner_maps.length; i++)
|
||||
|
|
|
@ -805,7 +805,7 @@ struct SinglePosFormat1
|
|||
ValueFormat newFormat,
|
||||
const hb_map_t *layout_variation_idx_map)
|
||||
{
|
||||
if (unlikely (!c->extend_min (*this))) return;
|
||||
if (unlikely (!c->extend_min (this))) return;
|
||||
if (unlikely (!c->check_assign (valueFormat,
|
||||
newFormat,
|
||||
HB_SERIALIZE_ERROR_INT_OVERFLOW))) return;
|
||||
|
@ -925,7 +925,7 @@ struct SinglePosFormat2
|
|||
ValueFormat newFormat,
|
||||
const hb_map_t *layout_variation_idx_map)
|
||||
{
|
||||
auto out = c->extend_min (*this);
|
||||
auto out = c->extend_min (this);
|
||||
if (unlikely (!out)) return;
|
||||
if (unlikely (!c->check_assign (valueFormat, newFormat, HB_SERIALIZE_ERROR_INT_OVERFLOW))) return;
|
||||
if (unlikely (!c->check_assign (valueCount, it.len (), HB_SERIALIZE_ERROR_ARRAY_OVERFLOW))) return;
|
||||
|
|
|
@ -100,7 +100,7 @@ struct SingleSubstFormat1
|
|||
unsigned delta)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!coverage.serialize_serialize (c, glyphs))) return_trace (false);
|
||||
c->check_assign (deltaGlyphID, delta, HB_SERIALIZE_ERROR_INT_OVERFLOW);
|
||||
return_trace (true);
|
||||
|
@ -209,7 +209,7 @@ struct SingleSubstFormat2
|
|||
+ it
|
||||
| hb_map_retains_sorting (hb_first)
|
||||
;
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!substitute.serialize (c, substitutes))) return_trace (false);
|
||||
if (unlikely (!coverage.serialize_serialize (c, glyphs))) return_trace (false);
|
||||
return_trace (true);
|
||||
|
@ -448,7 +448,7 @@ struct MultipleSubstFormat1
|
|||
hb_array_t<const HBGlyphID> substitute_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!sequence.serialize (c, glyphs.length))) return_trace (false);
|
||||
for (unsigned int i = 0; i < glyphs.length; i++)
|
||||
{
|
||||
|
@ -691,7 +691,7 @@ struct AlternateSubstFormat1
|
|||
hb_array_t<const HBGlyphID> alternate_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!alternateSet.serialize (c, glyphs.length))) return_trace (false);
|
||||
for (unsigned int i = 0; i < glyphs.length; i++)
|
||||
{
|
||||
|
@ -855,7 +855,7 @@ struct Ligature
|
|||
Iterator components /* Starting from second */)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
ligGlyph = ligature;
|
||||
if (unlikely (!component.serialize (c, components))) return_trace (false);
|
||||
return_trace (true);
|
||||
|
@ -954,7 +954,7 @@ struct LigatureSet
|
|||
hb_array_t<const HBGlyphID> &component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false);
|
||||
for (unsigned int i = 0; i < ligatures.length; i++)
|
||||
{
|
||||
|
@ -1066,7 +1066,7 @@ struct LigatureSubstFormat1
|
|||
hb_array_t<const HBGlyphID> component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
if (unlikely (!ligatureSet.serialize (c, first_glyphs.length))) return_trace (false);
|
||||
for (unsigned int i = 0; i < first_glyphs.length; i++)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ struct DeltaSetIndexMap
|
|||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0))))
|
||||
return_trace (false);
|
||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||
if (unlikely (!c->extend_min (this))) return_trace (false);
|
||||
|
||||
format = ((width-1)<<4)|(inner_bit_count-1);
|
||||
mapCount = output_map.length;
|
||||
|
|
Loading…
Reference in New Issue