diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-07-31 18:52:11 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-07-31 18:52:11 +0000 |
commit | 37e7118821a81f524931d8a4fa8d7815dd82eb5e (patch) | |
tree | 098e38241990440886d77d69b32b58b05540b1de /gutf8.c | |
parent | 8bca378a6e77626d7f1a9873bf485c7434015e74 (diff) | |
download | glib-37e7118821a81f524931d8a4fa8d7815dd82eb5e.tar.gz |
Fix stray character
Sun Jul 30 16:54:13 2000 Owen Taylor <otaylor@redhat.com>
* gunicode.h: Fix stray character
* gutf8.c (g_unichar_to_utf8): Allow outbuf to be NULL, in
which case we just compute the length.
Diffstat (limited to 'gutf8.c')
-rw-r--r-- | gutf8.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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; } |