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/pango-glyph-item.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/pango-glyph-item.c')
-rw-r--r-- | pango/pango-glyph-item.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index 9a90a4ca..8d19d94a 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -300,7 +300,7 @@ pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) if (glyphs->log_clusters[glyph_index] != cluster) { iter->end_index = item->offset + glyphs->log_clusters[glyph_index]; - iter->end_char += g_utf8_strlen (iter->text + iter->start_index, + iter->end_char += pango_utf8_strlen (iter->text + iter->start_index, iter->end_index - iter->start_index); break; } @@ -323,7 +323,7 @@ pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) if (glyphs->log_clusters[glyph_index] != cluster) { iter->end_index = item->offset + glyphs->log_clusters[glyph_index]; - iter->end_char += g_utf8_strlen (iter->text + iter->start_index, + iter->end_char += pango_utf8_strlen (iter->text + iter->start_index, iter->end_index - iter->start_index); break; } @@ -388,7 +388,7 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) { glyph_index++; iter->start_index = item->offset + glyphs->log_clusters[glyph_index]; - iter->start_char -= g_utf8_strlen (iter->text + iter->start_index, + iter->start_char -= pango_utf8_strlen (iter->text + iter->start_index, iter->end_index - iter->start_index); break; } @@ -412,7 +412,7 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) { glyph_index--; iter->start_index = item->offset + glyphs->log_clusters[glyph_index]; - iter->start_char -= g_utf8_strlen (iter->text + iter->start_index, + iter->start_char -= pango_utf8_strlen (iter->text + iter->start_index, iter->end_index - iter->start_index); break; } |