diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-07-15 13:59:20 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-07-15 14:00:31 -0400 |
commit | 67052645e6afcd7f72ef852c99ee88897d2022da (patch) | |
tree | 90ae6efbad01f32febc2fea57c8b1dd1005a6fdc /pango/ellipsize.c | |
parent | 4d6f980b9f67e7e969e6f5afeb6f216c0a99e6f4 (diff) | |
download | pango-67052645e6afcd7f72ef852c99ee88897d2022da.tar.gz |
Handle NUL in text in places that g_utf8_strlen () was used
While pango-layout doesn't allow NUL in text, the lower level API should
handle it correctly. We were using g_utf8_strlen() in a number of
places. This is problematic since that function stops processing at
NUL even if length>1. We now use an internal pango_utf8_strlen() instead.
Inspired by:
Bug 588678 – pango crash: install a new theme from gnome-appearance-properties
Diffstat (limited to 'pango/ellipsize.c')
-rw-r--r-- | pango/ellipsize.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c index 3a39a789..1c8aa241 100644 --- a/pango/ellipsize.c +++ b/pango/ellipsize.c @@ -25,6 +25,7 @@ #include "pango-glyph-item.h" #include "pango-layout-private.h" #include "pango-engine-private.h" +#include "pango-impl-utils.h" typedef struct _EllipsizeState EllipsizeState; typedef struct _RunInfo RunInfo; @@ -123,7 +124,7 @@ init_state (EllipsizeState *state, state->n_runs = g_slist_length (line->runs); state->run_info = g_new (RunInfo, state->n_runs); - start_offset = g_utf8_strlen (line->layout->text, + start_offset = pango_utf8_strlen (line->layout->text, line->start_index); state->total_width = 0; @@ -636,7 +637,7 @@ fixup_ellipsis_run (EllipsizeState *state) /* Fix up the item to point to the entire elided text */ item->offset = state->gap_start_iter.run_iter.start_index; item->length = state->gap_end_iter.run_iter.end_index - item->offset; - item->num_chars = g_utf8_strlen (state->layout->text + item->offset, item->length); + item->num_chars = pango_utf8_strlen (state->layout->text + item->offset, item->length); /* The level for the item is the minimum level of the elided text */ level = G_MAXINT; |