fixed CFF2VariationStore::serialize

also get_size
This commit is contained in:
Michiharu Ariza 2018-08-01 16:06:52 -07:00
parent b2ff582c8c
commit 16f4dc9b73
1 changed files with 4 additions and 3 deletions

View File

@ -49,13 +49,14 @@ struct CFF2VariationStore
inline bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore) inline bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore)
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
CFF2VariationStore *dest = c->allocate_size<CFF2VariationStore> (varStore->size); unsigned int size_ = varStore->get_size ();
CFF2VariationStore *dest = c->allocate_size<CFF2VariationStore> (size_);
if (unlikely (dest == nullptr)) return_trace (false); if (unlikely (dest == nullptr)) return_trace (false);
memcpy (dest, varStore, size); memcpy (dest, varStore, size_);
return_trace (true); return_trace (true);
} }
inline unsigned int get_size (void) const { return size; } inline unsigned int get_size (void) const { return HBUINT16::static_size + size; }
HBUINT16 size; HBUINT16 size;
VariationStore varStore; VariationStore varStore;