From b05e5d9a7998529ffd0e34f3b8d3ae5bf4c200eb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 15 Mar 2021 14:08:08 -0600 Subject: [PATCH] [buffer] HB_NODISCARD next_glyphs() --- src/hb-buffer.cc | 2 +- src/hb-buffer.hh | 2 +- src/hb-ot-shape-normalize.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 8da090ad4..494bf395e 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -319,7 +319,7 @@ hb_buffer_t::swap_buffers () if (unlikely (!successful)) return; assert (idx <= len); - next_glyphs (len - idx); + if (unlikely (!next_glyphs (len - idx))) return; assert (have_output); have_output = false; diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 0582d3a21..2e43f2e69 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -280,7 +280,7 @@ struct hb_buffer_t } /* Copies n glyphs at idx to output and advance idx. * If there's no output, just advance idx. */ - bool next_glyphs (unsigned int n) + HB_NODISCARD bool next_glyphs (unsigned int n) { if (have_output) { diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 776e29902..bce9dcf5d 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -348,7 +348,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, sizeof (buffer->info[0]), &buffer->cur().glyph_index(), sizeof (buffer->info[0])); - buffer->next_glyphs (done); + if (unlikely (!buffer->next_glyphs (done))) break; } while (buffer->idx < end && buffer->successful) decompose_current_character (&c, might_short_circuit);