[buffer] Add assertions of buffer sync status to message_impl

This commit is contained in:
Behdad Esfahbod 2022-03-21 19:11:17 -06:00
parent da9edce84c
commit c55c019771
2 changed files with 9 additions and 5 deletions

View File

@ -2116,8 +2116,16 @@ hb_buffer_set_message_func (hb_buffer_t *buffer,
bool
hb_buffer_t::message_impl (hb_font_t *font, const char *fmt, va_list ap)
{
assert (!have_output || (out_info == info && out_len == idx));
message_depth++;
char buf[100];
vsnprintf (buf, sizeof (buf), fmt, ap);
return (bool) this->message_func (this, font, buf, this->message_data);
bool ret = (bool) this->message_func (this, font, buf, this->message_data);
message_depth--;
return ret;
}
#endif

View File

@ -556,15 +556,11 @@ struct hb_buffer_t
if (likely (!messaging ()))
return true;
message_depth++;
va_list ap;
va_start (ap, fmt);
bool ret = message_impl (font, fmt, ap);
va_end (ap);
message_depth--;
return ret;
#endif
}