From 79fa3efec28252251f38cf03aae5097cbe004c7f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 26 Oct 2005 13:10:55 +0000 Subject: [PATCH] Fix 319806 --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-12 | 6 ++++++ glib/gutf8.c | 7 +++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32b3188..f508052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-26 Matthias Clasen + + * glib/gutf8.c (g_ucs4_to_utf8): Don't set items_read twice + in the error case, and add some documentation. (#319806, Morten + Welinder) + 2005-10-19 Manish Singh * configure.in: Use AC_CHECK_FUNCS for _NSGetEnviron, to get the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 32b3188..f508052 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2005-10-26 Matthias Clasen + + * glib/gutf8.c (g_ucs4_to_utf8): Don't set items_read twice + in the error case, and add some documentation. (#319806, Morten + Welinder) + 2005-10-19 Manish Singh * configure.in: Use AC_CHECK_FUNCS for _NSGetEnviron, to get the diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 32b3188..f508052 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,9 @@ +2005-10-26 Matthias Clasen + + * glib/gutf8.c (g_ucs4_to_utf8): Don't set items_read twice + in the error case, and add some documentation. (#319806, Morten + Welinder) + 2005-10-19 Manish Singh * configure.in: Use AC_CHECK_FUNCS for _NSGetEnviron, to get the diff --git a/glib/gutf8.c b/glib/gutf8.c index dc87523..e139230 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -958,7 +958,9 @@ g_utf8_to_ucs4 (const gchar *str, * Return value: a pointer to a newly allocated UTF-8 string. * This value must be freed with g_free(). If an * error occurs, %NULL will be returned and - * @error set. + * @error set. In that case, @items_read will be + * set to the position of the first invalid input + * character. **/ gchar * g_ucs4_to_utf8 (const gunichar *str, @@ -980,9 +982,6 @@ g_ucs4_to_utf8 (const gunichar *str, if (str[i] >= 0x80000000) { - if (items_read) - *items_read = i; - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, _("Character out of range for UTF-8")); goto err_out; -- 2.7.4