From 144cd49a0eb3ccc749325d0ee14b3ebf4367c971 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 7 Aug 2011 00:51:50 -0400 Subject: [PATCH] [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. --- src/hb-buffer.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index e19e7dd1a..53b320021 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -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) { \