From 49161d411f30d06bc920f4153f5925944895cdbc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Dec 2018 22:50:33 -0500 Subject: [PATCH] [subset] Take iterator in ArrayOf serialize Still not satisfied with how I can enforce iterators only, but seems to work for now. --- src/hb-open-type.hh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 6dad1e4..8db1d90 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -556,13 +556,15 @@ struct ArrayOf if (unlikely (!c->extend (*this))) return_trace (false); return_trace (true); } - template - bool serialize (hb_serialize_context_t *c, hb_array_t items) + template + bool serialize (hb_serialize_context_t *c, const hb_iter_t& items) { TRACE_SERIALIZE (this); - if (unlikely (!serialize (c, items.length))) return_trace (false); - for (unsigned int i = 0; i < items.length; i++) - hb_assign (arrayZ[i], items[i]); + unsigned count = items.len (); + if (unlikely (!serialize (c, count))) return_trace (false); + auto iter = items.iter (); + for (unsigned i = 0; i < count; i++, iter++) + hb_assign (arrayZ[i], *iter); return_trace (true); } -- 2.7.4