summaryrefslogtreecommitdiff
path: root/pango/break.c
diff options
context:
space:
mode:
authorPadraig O'Briain <padraigo@src.gnome.org>2001-11-23 17:11:26 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2001-11-23 17:11:26 +0000
commit2efe6aa596fd509d91fd5e549b8d3cc5632b0570 (patch)
treef35758f10e61dc09c020acc15287a7f22f5af849 /pango/break.c
parentb4b11e4ba669ddfdb54e7da737f9b9b0f22b9e9f (diff)
downloadpango-2efe6aa596fd509d91fd5e549b8d3cc5632b0570.tar.gz
Fix for bug 65183; i.e. do not call g_utf8_next_char(next) when next is
* pango/break.c (pango_default_break): Fix for bug 65183; i.e. do not call g_utf8_next_char(next) when next is end.
Diffstat (limited to 'pango/break.c')
-rw-r--r--pango/break.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/pango/break.c b/pango/break.c
index 1437503d..dd979e5b 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -405,6 +405,7 @@ pango_default_break (const gchar *text,
GUnicodeType prev_type;
GUnicodeBreakType prev_break_type; /* skips spaces */
gboolean prev_was_break_space;
+ gboolean prev_was_end = FALSE;
WordType current_word_type = WordNone;
gunichar last_word_letter = 0;
SentenceState sentence_state = STATE_SENTENCE_OUTSIDE;
@@ -452,23 +453,31 @@ pango_default_break (const gchar *text,
wc = next_wc;
- next = g_utf8_next_char (next);
-
- if (next == end)
+ if (prev_was_end)
{
- /* This is how we fill in the last element (end position) of the
- * attr array - assume there's a newline off the end of @text.
+ /*
+ * If we have already reached the end of @text g_utf8_next_char()
+ * may not increment next
*/
- next_wc = '\n';
- }
- else if (next > end)
- {
next_wc = 0;
}
else
{
- next_wc = g_utf8_get_char (next);
- g_assert (next_wc != 0);
+ next = g_utf8_next_char (next);
+
+ if (next == end)
+ {
+ /* This is how we fill in the last element (end position) of the
+ * attr array - assume there's a newline off the end of @text.
+ */
+ next_wc = '\n';
+ prev_was_end = TRUE;
+ }
+ else
+ {
+ next_wc = g_utf8_get_char (next);
+ g_assert (next_wc != 0);
+ }
}
type = g_unichar_type (wc);