[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:
Behdad Esfahbod 2011-08-07 00:51:50 -04:00
parent e9c71fab30
commit 144cd49a0e
1 changed files with 10 additions and 0 deletions

View File

@ -712,6 +712,16 @@ hb_buffer_guess_properties (hb_buffer_t *buffer)
#define ADD_UTF(T) \
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 *end = next + item_length; \
while (next < end) { \