From 5eaddd21bb7c0be865e1c9743b23bdb2ff35ad61 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Mar 2007 07:12:50 +0000 Subject: [PATCH] Report more accurate position for invalid UTF-8. (#350802, Simon Budig) 2007-03-06 Matthias Clasen * glib/gmarkup.c (g_markup_parse_context_parse): Report more accurate position for invalid UTF-8. (#350802, Simon Budig) svn path=/trunk/; revision=5373 --- ChangeLog | 6 ++++++ glib/gmarkup.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02917e5..3d6f745 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-03-06 Matthias Clasen + * glib/gmarkup.c (g_markup_parse_context_parse): Report + more accurate position for invalid UTF-8. (#350802, + Simon Budig) + +2007-03-06 Matthias Clasen + * glib/gbase64.c: Add NULL checks to the base64 functions that take pointers. (#399611, Martyn Russell) diff --git a/glib/gmarkup.c b/glib/gmarkup.c index 37bc884..ee2576a 100644 --- a/glib/gmarkup.c +++ b/glib/gmarkup.c @@ -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, -- 2.7.4