[cff-common] Remove special-casing of count=0 in INDEX serialize

The generic code-path now can handle count=0.
This commit is contained in:
Behdad Esfahbod 2022-05-06 12:54:02 -06:00
parent fc7f51aece
commit 2884eb97bf
1 changed files with 3 additions and 12 deletions

View File

@ -172,18 +172,9 @@ struct CFFIndex
Iterator it) Iterator it)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (!it) serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; }));
{ for (const auto &_ : +it)
COUNT *dest = c->allocate_min<COUNT> (); _.copy (c);
if (unlikely (!dest)) return_trace (false);
*dest = 0;
}
else
{
serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; }));
for (const auto &_ : +it)
_.copy (c);
}
return_trace (true); return_trace (true);
} }