src/hb-buffer.cc | 16 +++++++++++----- src/hb-buffer.h | 14 ++++++++++---- test/test-buffer.c | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-)
New commits: commit f85faee9b3cb841ea977403945e2c877ab32b97a Author: Behdad Esfahbod <[email protected]> Date: Tue Apr 19 00:38:01 2011 -0400 [API] Rename hb_buffer_add_glyph() to hb_buffer_add() diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 68ef594..2f7a173 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -267,10 +267,10 @@ hb_buffer_allocation_successful (hb_buffer_t *buffer) } void -hb_buffer_add_glyph (hb_buffer_t *buffer, - hb_codepoint_t codepoint, - hb_mask_t mask, - unsigned int cluster) +hb_buffer_add (hb_buffer_t *buffer, + hb_codepoint_t codepoint, + hb_mask_t mask, + unsigned int cluster) { hb_glyph_info_t *glyph; @@ -572,7 +572,7 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer) hb_codepoint_t u; \ const T *old_next = next; \ next = UTF_NEXT (next, end, u); \ - hb_buffer_add_glyph (buffer, u, 1, old_next - (const T *) text); \ + hb_buffer_add (buffer, u, 1, old_next - (const T *) text); \ } \ } HB_STMT_END diff --git a/src/hb-buffer.h b/src/hb-buffer.h index c22e31d..d12faf8 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -126,10 +126,10 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer); /* Filling the buffer in */ void -hb_buffer_add_glyph (hb_buffer_t *buffer, - hb_codepoint_t codepoint, - hb_mask_t mask, - unsigned int cluster); +hb_buffer_add (hb_buffer_t *buffer, + hb_codepoint_t codepoint, + hb_mask_t mask, + unsigned int cluster); void hb_buffer_add_utf8 (hb_buffer_t *buffer, diff --git a/test/test-buffer.c b/test/test-buffer.c index 9522515..464ec89 100644 --- a/test/test-buffer.c +++ b/test/test-buffer.c @@ -68,7 +68,7 @@ fixture_init (Fixture *fixture, gconstpointer user_data) case BUFFER_ONE_BY_ONE: for (i = 1; i < G_N_ELEMENTS (utf32) - 1; i++) - hb_buffer_add_glyph (fixture->b, utf32[i], 1, i); + hb_buffer_add (fixture->b, utf32[i], 1, i); break; case BUFFER_UTF32: commit aab0de50e23727b69fa8c3d4e05c50c114c62835 Author: Behdad Esfahbod <[email protected]> Date: Tue Apr 19 00:32:19 2011 -0400 [API] Add hb_buffer_allocation_successful() Returns the error status of the buffer. diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 11639ef..68ef594 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -260,6 +260,12 @@ hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size) return _hb_buffer_ensure (buffer, size); } +hb_bool_t +hb_buffer_allocation_successful (hb_buffer_t *buffer) +{ + return !buffer->in_error; +} + void hb_buffer_add_glyph (hb_buffer_t *buffer, hb_codepoint_t codepoint, diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 0c3ef3a..c22e31d 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -106,10 +106,16 @@ hb_buffer_get_language (hb_buffer_t *buffer); void hb_buffer_reset (hb_buffer_t *buffer); +/* Returns FALSE if allocation failed */ hb_bool_t hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size); + +/* Returns FALSE if allocation has failed before */ +hb_bool_t +hb_buffer_allocation_successful (hb_buffer_t *buffer); + void hb_buffer_reverse (hb_buffer_t *buffer); diff --git a/test/test-buffer.c b/test/test-buffer.c index c2b199b..9522515 100644 --- a/test/test-buffer.c +++ b/test/test-buffer.c @@ -185,7 +185,7 @@ main (int argc, char **argv) /* XXX test invalid UTF-8 / UTF-16 text input (also overlong sequences) */ /* XXX test reverse() and reverse_clusters() */ - /* XXX test ensure() and memory management */ + /* XXX test pre_allocate(), allocation_successful(), and memory management */ /* XXX test buffer reset */ /* XXX test buffer set length */ _______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
