提交 02c6c8cd 编写于 作者: B Behdad Esfahbod

Set buffer content type to INVALID in hb_buffer_set_length(0)

Previously we were only setting this in hb_buffer_clear_contents(),
but set_length(0) is a valid way to reinitialize buffer to use with
new text.
上级 6300694f
...@@ -181,7 +181,7 @@ struct hb_buffer_t { ...@@ -181,7 +181,7 @@ struct hb_buffer_t {
HB_INTERNAL bool enlarge (unsigned int size); HB_INTERNAL bool enlarge (unsigned int size);
inline bool ensure (unsigned int size) inline bool ensure (unsigned int size)
{ return likely (size < allocated) ? true : enlarge (size); } { return likely (!size || size < allocated) ? true : enlarge (size); }
HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out);
HB_INTERNAL bool shift_forward (unsigned int count); HB_INTERNAL bool shift_forward (unsigned int count);
......
...@@ -1150,7 +1150,10 @@ hb_buffer_set_length (hb_buffer_t *buffer, ...@@ -1150,7 +1150,10 @@ hb_buffer_set_length (hb_buffer_t *buffer,
buffer->len = length; buffer->len = length;
if (!length) if (!length)
{
buffer->content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
buffer->clear_context (0); buffer->clear_context (0);
}
buffer->clear_context (1); buffer->clear_context (1);
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册