[buffer] HB_NODISCARD move_to()

This commit is contained in:
Behdad Esfahbod 2021-03-15 13:46:54 -06:00
parent 05d2d37f9a
commit cac6c86d2f
3 changed files with 9 additions and 9 deletions

View File

@ -499,7 +499,7 @@ struct LigatureSubtable
}
DEBUG_MSG (APPLY, nullptr, "Moving to stack position %u", cursor - 1);
buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]);
if (unlikely (!buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]))) return;
if (unlikely (!actionData->sanitize (&c->sanitizer))) break;
action = *actionData;
@ -532,18 +532,18 @@ struct LigatureSubtable
while (match_length - 1u > cursor)
{
DEBUG_MSG (APPLY, nullptr, "Skipping ligature component");
buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]);
if (unlikely (!buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]))) return;
if (unlikely (!buffer->replace_glyph (DELETED_GLYPH))) return;
}
buffer->move_to (lig_end);
if (unlikely (!buffer->move_to (lig_end))) return;
buffer->merge_out_clusters (match_positions[cursor % ARRAY_LENGTH (match_positions)], buffer->out_len);
}
actionData++;
}
while (!(action & LigActionLast));
buffer->move_to (end);
if (unlikely (!buffer->move_to (end))) return;
}
}
@ -733,7 +733,7 @@ struct InsertionSubtable
bool before = flags & MarkedInsertBefore;
unsigned int end = buffer->out_len;
buffer->move_to (mark);
if (unlikely (!buffer->move_to (mark))) return;
if (buffer->idx < buffer->len && !before)
buffer->copy_glyph ();
@ -743,7 +743,7 @@ struct InsertionSubtable
if (buffer->idx < buffer->len && !before)
buffer->skip_glyph ();
buffer->move_to (end + count);
if (unlikely (!buffer->move_to (end + count))) return;
buffer->unsafe_to_break_from_outbuffer (mark, hb_min (buffer->idx + 1, buffer->len));
}
@ -786,7 +786,7 @@ struct InsertionSubtable
*
* https://github.com/harfbuzz/harfbuzz/issues/1224#issuecomment-427691417
*/
buffer->move_to ((flags & DontAdvance) ? end : end + count);
if (unlikely (!buffer->move_to ((flags & DontAdvance) ? end : end + count))) return;
}
}

View File

@ -333,7 +333,7 @@ struct hb_buffer_t
/* Internal methods */
HB_INTERNAL bool move_to (unsigned int i); /* i is output-buffer index. */
HB_INTERNAL HB_NODISCARD bool move_to (unsigned int i); /* i is output-buffer index. */
HB_INTERNAL HB_NODISCARD bool enlarge (unsigned int size);

View File

@ -1272,7 +1272,7 @@ static inline bool apply_lookup (hb_ot_apply_context_t *c,
match_positions[next] += delta;
}
buffer->move_to (end);
(void) buffer->move_to (end);
return_trace (true);
}