[buffer] Accept -1 for text_length and item_length
A -1 text_length means: zero-terminated string. A -1 item_length means: to the end of string.
This commit is contained in:
parent
e9c71fab30
commit
144cd49a0e
|
@ -712,6 +712,16 @@ hb_buffer_guess_properties (hb_buffer_t *buffer)
|
||||||
|
|
||||||
#define ADD_UTF(T) \
|
#define ADD_UTF(T) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
|
if (text_length == -1) { \
|
||||||
|
text_length = 0; \
|
||||||
|
const T *p = (const T *) text; \
|
||||||
|
while (*p) { \
|
||||||
|
text_length++; \
|
||||||
|
p++; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
if (item_length == -1) \
|
||||||
|
item_length = text_length - item_offset; \
|
||||||
const T *next = (const T *) text + item_offset; \
|
const T *next = (const T *) text + item_offset; \
|
||||||
const T *end = next + item_length; \
|
const T *end = next + item_length; \
|
||||||
while (next < end) { \
|
while (next < end) { \
|
||||||
|
|
Loading…
Reference in New Issue