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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* 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>
|
2000-12-14 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
|
||||||
|
@ -638,22 +638,14 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
|||||||
while (!feof (f))
|
while (!feof (f))
|
||||||
{
|
{
|
||||||
gint count;
|
gint count;
|
||||||
char *leftover, *next;
|
const char *leftover;
|
||||||
int to_read = 2047 - remaining;
|
int to_read = 2047 - remaining;
|
||||||
|
|
||||||
count = fread (buf + remaining, 1, to_read, f);
|
count = fread (buf + remaining, 1, to_read, f);
|
||||||
buf[count + remaining] = '\0';
|
buf[count + remaining] = '\0';
|
||||||
|
|
||||||
leftover = next = buf;
|
g_utf8_validate (buf, -1, &leftover);
|
||||||
while (next)
|
|
||||||
{
|
|
||||||
leftover = next;
|
|
||||||
if (!*leftover)
|
|
||||||
break;
|
|
||||||
|
|
||||||
next = g_utf8_find_next_char (next, buf + count + remaining);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (g_utf8_validate (buf, leftover - buf, NULL));
|
g_assert (g_utf8_validate (buf, leftover - buf, NULL));
|
||||||
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
||||||
|
|
||||||
|
@ -638,22 +638,14 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
|||||||
while (!feof (f))
|
while (!feof (f))
|
||||||
{
|
{
|
||||||
gint count;
|
gint count;
|
||||||
char *leftover, *next;
|
const char *leftover;
|
||||||
int to_read = 2047 - remaining;
|
int to_read = 2047 - remaining;
|
||||||
|
|
||||||
count = fread (buf + remaining, 1, to_read, f);
|
count = fread (buf + remaining, 1, to_read, f);
|
||||||
buf[count + remaining] = '\0';
|
buf[count + remaining] = '\0';
|
||||||
|
|
||||||
leftover = next = buf;
|
g_utf8_validate (buf, -1, &leftover);
|
||||||
while (next)
|
|
||||||
{
|
|
||||||
leftover = next;
|
|
||||||
if (!*leftover)
|
|
||||||
break;
|
|
||||||
|
|
||||||
next = g_utf8_find_next_char (next, buf + count + remaining);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (g_utf8_validate (buf, leftover - buf, NULL));
|
g_assert (g_utf8_validate (buf, leftover - buf, NULL));
|
||||||
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user