mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
Clarify the behaviour is max_len is zero. (#400044, Benjamin Dauvergne)
2007-01-23 Matthias Clasen <mclasen@redhat.com> * glib/gutf8.c (g_utf8_get_char_validated): Clarify the behaviour is max_len is zero. (#400044, Benjamin Dauvergne) svn path=/trunk/; revision=5311
This commit is contained in:
parent
62534876c5
commit
ffabd954ee
@ -1,3 +1,9 @@
|
|||||||
|
2007-01-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gutf8.c (g_utf8_get_char_validated): Clarify
|
||||||
|
the behaviour is max_len is zero. (#400044,
|
||||||
|
Benjamin Dauvergne)
|
||||||
|
|
||||||
2007-01-23 Matthias Clasen <mclasen@redhat.com>
|
2007-01-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/goption.c (print_help): Use bitwise &
|
* glib/goption.c (print_help): Use bitwise &
|
||||||
|
12
glib/gutf8.c
12
glib/gutf8.c
@ -764,14 +764,20 @@ g_utf8_get_char_extended (const gchar *p,
|
|||||||
*
|
*
|
||||||
* Return value: the resulting character. If @p points to a partial
|
* Return value: the resulting character. If @p points to a partial
|
||||||
* sequence at the end of a string that could begin a valid
|
* sequence at the end of a string that could begin a valid
|
||||||
* character, returns (gunichar)-2; otherwise, if @p does not point
|
* character (or if @max_len is zero), returns (gunichar)-2;
|
||||||
* to a valid UTF-8 encoded Unicode character, returns (gunichar)-1.
|
* otherwise, if @p does not point to a valid UTF-8 encoded
|
||||||
|
* Unicode character, returns (gunichar)-1.
|
||||||
**/
|
**/
|
||||||
gunichar
|
gunichar
|
||||||
g_utf8_get_char_validated (const gchar *p,
|
g_utf8_get_char_validated (const gchar *p,
|
||||||
gssize max_len)
|
gssize max_len)
|
||||||
{
|
{
|
||||||
gunichar result = g_utf8_get_char_extended (p, max_len);
|
gunichar result;
|
||||||
|
|
||||||
|
if (max_len == 0)
|
||||||
|
return (gunichar)-2;
|
||||||
|
|
||||||
|
result = g_utf8_get_char_extended (p, max_len);
|
||||||
|
|
||||||
if (result & 0x80000000)
|
if (result & 0x80000000)
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user