mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-20 12:32:10 +02:00
Report more accurate position for invalid UTF-8. (#350802, Simon Budig)
2007-03-06 Matthias Clasen <mclasen@redhat.com> * glib/gmarkup.c (g_markup_parse_context_parse): Report more accurate position for invalid UTF-8. (#350802, Simon Budig) svn path=/trunk/; revision=5373
This commit is contained in:
parent
5ae803a47f
commit
5eaddd21bb
@ -1,3 +1,9 @@
|
|||||||
|
2007-03-06 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmarkup.c (g_markup_parse_context_parse): Report
|
||||||
|
more accurate position for invalid UTF-8. (#350802,
|
||||||
|
Simon Budig)
|
||||||
|
|
||||||
2007-03-06 Matthias Clasen <mclasen@redhat.com>
|
2007-03-06 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gbase64.c: Add NULL checks to the base64
|
* glib/gbase64.c: Add NULL checks to the base64
|
||||||
|
@ -1000,16 +1000,21 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
|||||||
&first_invalid))
|
&first_invalid))
|
||||||
{
|
{
|
||||||
gint newlines = 0;
|
gint newlines = 0;
|
||||||
const gchar *p;
|
const gchar *p, *q;
|
||||||
p = context->current_text;
|
q = p = context->current_text;
|
||||||
while (p != context->current_text_end)
|
while (p != first_invalid)
|
||||||
{
|
{
|
||||||
if (*p == '\n')
|
if (*p == '\n')
|
||||||
|
{
|
||||||
++newlines;
|
++newlines;
|
||||||
|
q = p + 1;
|
||||||
|
context->char_number = 1;
|
||||||
|
}
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
context->line_number += newlines;
|
context->line_number += newlines;
|
||||||
|
context->char_number += g_utf8_strlen (q, first_invalid - q);
|
||||||
|
|
||||||
set_error (context,
|
set_error (context,
|
||||||
error,
|
error,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user