diff --git a/ChangeLog b/ChangeLog index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4ab9817a2e..73ab05d427 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2000-12-14 Havoc Pennington + + * gtk/testtext.c (fill_file_buffer): fix unicode validation when + reading a file + 2000-12-14 Havoc Pennington * gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove diff --git a/gtk/testtext.c b/gtk/testtext.c index 4eaf62b75c..50da85b6d2 100644 --- a/gtk/testtext.c +++ b/gtk/testtext.c @@ -638,22 +638,14 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename) while (!feof (f)) { gint count; - char *leftover, *next; + const char *leftover; int to_read = 2047 - remaining; count = fread (buf + remaining, 1, to_read, f); buf[count + remaining] = '\0'; - leftover = next = buf; - while (next) - { - leftover = next; - if (!*leftover) - break; - - next = g_utf8_find_next_char (next, buf + count + remaining); - } - + g_utf8_validate (buf, -1, &leftover); + g_assert (g_utf8_validate (buf, leftover - buf, NULL)); gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf); diff --git a/tests/testtext.c b/tests/testtext.c index 4eaf62b75c..50da85b6d2 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -638,22 +638,14 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename) while (!feof (f)) { gint count; - char *leftover, *next; + const char *leftover; int to_read = 2047 - remaining; count = fread (buf + remaining, 1, to_read, f); buf[count + remaining] = '\0'; - leftover = next = buf; - while (next) - { - leftover = next; - if (!*leftover) - break; - - next = g_utf8_find_next_char (next, buf + count + remaining); - } - + g_utf8_validate (buf, -1, &leftover); + g_assert (g_utf8_validate (buf, leftover - buf, NULL)); gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);