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=/branches/glib-2-12/; revision=5374
This commit is contained in:
Matthias Clasen 2007-03-06 07:14:10 +00:00 committed by Matthias Clasen
parent 1929e66919
commit dbec2bd1f6
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-03-06 Matthias Clasen <mclasen@redhat.com>
Merge from trunk:
* 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>
Merge from trunk:

View File

@ -1000,16 +1000,21 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
&first_invalid))
{
gint newlines = 0;
const gchar *p;
p = context->current_text;
while (p != context->current_text_end)
const gchar *p, *q;
q = p = context->current_text;
while (p != first_invalid)
{
if (*p == '\n')
++newlines;
{
++newlines;
q = p + 1;
context->char_number = 1;
}
++p;
}
context->line_number += newlines;
context->char_number += g_utf8_strlen (q, first_invalid - q);
set_error (context,
error,