From 273ed6127bd9471fd11b3c1c7f232638f1ff1dba Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 May 2019 14:04:51 -0700 Subject: [PATCH] [serializer] Add serialize_copy() --- src/hb-open-type.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index bde059602..17e8d2a97 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -305,6 +305,20 @@ struct OffsetTo : Offset return ret; } + template + bool serialize_copy (hb_serialize_context_t *c, const T &src, const void *base) + { + *this = 0; + if (has_null && &src == &Null (T)) + return false; + + c->push (); + + c->copy (src); + + c->add_link (*this, c->pop_pack (), base); + } + bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const { TRACE_SANITIZE (this);