forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
94ec8cff93
commit
2142a98c9e
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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,21 +638,13 @@ 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,21 +638,13 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user