From 37e7118821a81f524931d8a4fa8d7815dd82eb5e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 31 Jul 2000 18:52:11 +0000 Subject: [PATCH] Fix stray character Sun Jul 30 16:54:13 2000 Owen Taylor * gunicode.h: Fix stray character * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in which case we just compute the length. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ glib/gunicode.h | 2 +- glib/gutf8.c | 14 +++++++++----- gunicode.h | 2 +- gutf8.c | 14 +++++++++----- 12 files changed, 76 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index acc659ba..7baf383b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index acc659ba..7baf383b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Sun Jul 30 16:54:13 2000 Owen Taylor + + * gunicode.h: Fix stray character + + * gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in + which case we just compute the length. + 2000-07-31 Havoc Pennington * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST diff --git a/glib/gunicode.h b/glib/gunicode.h index 4018eb66..18997b24 100644 --- a/glib/gunicode.h +++ b/glib/gunicode.h @@ -77,7 +77,7 @@ gboolean g_get_charset (char **charset); gboolean g_unichar_isalnum (gunichar c); gboolean g_unichar_isalpha (gunichar c); gboolean g_unichar_iscntrl (gunichar c); -gboolean g_unicphar_isdigit (gunichar c); +gboolean g_unichar_isdigit (gunichar c); gboolean g_unichar_isgraph (gunichar c); gboolean g_unichar_islower (gunichar c); gboolean g_unichar_isprint (gunichar c); diff --git a/glib/gutf8.c b/glib/gutf8.c index bf50d1ee..a510dfd6 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -75,7 +75,6 @@ (Result) <<= 6; \ (Result) |= ((Chars)[(Count)] & 0x3f); \ } - gchar g_utf8_skip[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -349,6 +348,8 @@ g_get_charset (char **charset) * g_unichar_to_utf8: * @ch: a ISO10646 character code * @out: output buffer, must have at least 6 bytes of space. + * If %NULL, the length will be computed and returned + * and nothing will be written to @out. * * Convert a single character to utf8 * @@ -392,12 +393,15 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf) len = 6; } - for (i = len - 1; i > 0; --i) + if (outbuf) { - outbuf[i] = (c & 0x3f) | 0x80; - c >>= 6; + for (i = len - 1; i > 0; --i) + { + outbuf[i] = (c & 0x3f) | 0x80; + c >>= 6; + } + outbuf[0] = c | first; } - outbuf[0] = c | first; return len; } diff --git a/gunicode.h b/gunicode.h index 4018eb66..18997b24 100644 --- a/gunicode.h +++ b/gunicode.h @@ -77,7 +77,7 @@ gboolean g_get_charset (char **charset); gboolean g_unichar_isalnum (gunichar c); gboolean g_unichar_isalpha (gunichar c); gboolean g_unichar_iscntrl (gunichar c); -gboolean g_unicphar_isdigit (gunichar c); +gboolean g_unichar_isdigit (gunichar c); gboolean g_unichar_isgraph (gunichar c); gboolean g_unichar_islower (gunichar c); gboolean g_unichar_isprint (gunichar c); diff --git a/gutf8.c b/gutf8.c index bf50d1ee..a510dfd6 100644 --- a/gutf8.c +++ b/gutf8.c @@ -75,7 +75,6 @@ (Result) <<= 6; \ (Result) |= ((Chars)[(Count)] & 0x3f); \ } - gchar g_utf8_skip[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -349,6 +348,8 @@ g_get_charset (char **charset) * g_unichar_to_utf8: * @ch: a ISO10646 character code * @out: output buffer, must have at least 6 bytes of space. + * If %NULL, the length will be computed and returned + * and nothing will be written to @out. * * Convert a single character to utf8 * @@ -392,12 +393,15 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf) len = 6; } - for (i = len - 1; i > 0; --i) + if (outbuf) { - outbuf[i] = (c & 0x3f) | 0x80; - c >>= 6; + for (i = len - 1; i > 0; --i) + { + outbuf[i] = (c & 0x3f) | 0x80; + c >>= 6; + } + outbuf[0] = c | first; } - outbuf[0] = c | first; return len; } -- 2.34.1