Commit 2142a98c authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

fix unicode validation when reading a file

2000-12-14  Havoc Pennington  <hp@redhat.com>

	* gtk/testtext.c (fill_file_buffer): fix unicode validation when
	reading a file
parent 94ec8cff
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
reading a file
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment