[VARC] Add consume_all to unpack_deltas()

Untested.
pull/4578/head
Behdad Esfahbod 1 year ago
parent ae35e30bd2
commit 0dcdbb4f42
  1. 9
      src/hb-ot-var-common.hh

@ -1861,15 +1861,18 @@ struct TupleVariationData
static bool unpack_deltas (const HBUINT8 *&p /* IN/OUT */,
hb_vector_t<int> &deltas /* IN/OUT */,
const HBUINT8 *end)
const HBUINT8 *end,
bool consume_all = false)
{
unsigned i = 0;
unsigned count = deltas.length;
unsigned count = consume_all ? UINT_MAX : deltas.length;
while (i < count)
{
if (unlikely (p + 1 > end)) return false;
if (unlikely (p + 1 > end)) return consume_all;
unsigned control = *p++;
unsigned run_count = (control & DELTA_RUN_COUNT_MASK) + 1;
if (consume_all)
deltas.resize (deltas.length + run_count, false);
unsigned stop = i + run_count;
if (unlikely (stop > count)) return false;
if ((control & DELTAS_SIZE_MASK) == DELTAS_ARE_ZERO)

Loading…
Cancel
Save