[open-type] Don't memset 0 in serialize for ArrayOf family
Not necessary.
This commit is contained in:
parent
70ac6dfb28
commit
5fd2f255fc
|
@ -493,10 +493,10 @@ struct UnsizedArrayOf
|
|||
void qsort (unsigned int len, unsigned int start = 0, unsigned int end = (unsigned int) -1)
|
||||
{ as_array (len).qsort (start, end); }
|
||||
|
||||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||
bool serialize (hb_serialize_context_t *c, unsigned int items_len, bool clear = true)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend (this, items_len))) return_trace (false);
|
||||
if (unlikely (!c->extend_size (this, get_size (items_len), clear))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
|
@ -505,7 +505,7 @@ struct UnsizedArrayOf
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
unsigned count = items.len ();
|
||||
if (unlikely (!serialize (c, count))) return_trace (false);
|
||||
if (unlikely (!serialize (c, count, false))) return_trace (false);
|
||||
/* TODO Umm. Just exhaust the iterator instead? Being extra
|
||||
* cautious right now.. */
|
||||
for (unsigned i = 0; i < count; i++, ++items)
|
||||
|
@ -665,12 +665,12 @@ struct ArrayOf
|
|||
void qsort ()
|
||||
{ as_array ().qsort (); }
|
||||
|
||||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, unsigned items_len)
|
||||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, unsigned items_len, bool clear = true)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
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_size (this, get_size (), clear))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
|
@ -679,7 +679,7 @@ struct ArrayOf
|
|||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
unsigned count = items.len ();
|
||||
if (unlikely (!serialize (c, count))) return_trace (false);
|
||||
if (unlikely (!serialize (c, count, false))) return_trace (false);
|
||||
/* TODO Umm. Just exhaust the iterator instead? Being extra
|
||||
* cautious right now.. */
|
||||
for (unsigned i = 0; i < count; i++, ++items)
|
||||
|
@ -827,21 +827,21 @@ struct HeadlessArrayOf
|
|||
const Type *begin () const { return arrayZ; }
|
||||
const Type *end () const { return arrayZ + get_length (); }
|
||||
|
||||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, unsigned int items_len, bool clear = true)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
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_size (this, get_size (), clear))) return_trace (false);
|
||||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
hb_requires (hb_is_source_of (Iterator, Type))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator items)
|
||||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, Iterator items)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
unsigned count = items.len ();
|
||||
if (unlikely (!serialize (c, count))) return_trace (false);
|
||||
if (unlikely (!serialize (c, count, false))) return_trace (false);
|
||||
/* TODO Umm. Just exhaust the iterator instead? Being extra
|
||||
* cautious right now.. */
|
||||
for (unsigned i = 0; i < count; i++, ++items)
|
||||
|
|
Loading…
Reference in New Issue