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.
This commit is contained in:
Owen Taylor 2000-07-31 18:52:11 +00:00 committed by Owen Taylor
parent 8bca378a6e
commit 37e7118821
12 changed files with 76 additions and 12 deletions

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -1,3 +1,10 @@
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.
2000-07-31 Havoc Pennington <hp@redhat.com> 2000-07-31 Havoc Pennington <hp@redhat.com>
* Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST * Makefile.am (EXTRA_DIST): forgot to add .pc.in to EXTRA_DIST

View File

@ -77,7 +77,7 @@ gboolean g_get_charset (char **charset);
gboolean g_unichar_isalnum (gunichar c); gboolean g_unichar_isalnum (gunichar c);
gboolean g_unichar_isalpha (gunichar c); gboolean g_unichar_isalpha (gunichar c);
gboolean g_unichar_iscntrl (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_isgraph (gunichar c);
gboolean g_unichar_islower (gunichar c); gboolean g_unichar_islower (gunichar c);
gboolean g_unichar_isprint (gunichar c); gboolean g_unichar_isprint (gunichar c);

View File

@ -75,7 +75,6 @@
(Result) <<= 6; \ (Result) <<= 6; \
(Result) |= ((Chars)[(Count)] & 0x3f); \ (Result) |= ((Chars)[(Count)] & 0x3f); \
} }
gchar g_utf8_skip[256] = { 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,
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: * g_unichar_to_utf8:
* @ch: a ISO10646 character code * @ch: a ISO10646 character code
* @out: output buffer, must have at least 6 bytes of space. * @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 * Convert a single character to utf8
* *
@ -392,12 +393,15 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf)
len = 6; len = 6;
} }
for (i = len - 1; i > 0; --i) if (outbuf)
{ {
outbuf[i] = (c & 0x3f) | 0x80; for (i = len - 1; i > 0; --i)
c >>= 6; {
outbuf[i] = (c & 0x3f) | 0x80;
c >>= 6;
}
outbuf[0] = c | first;
} }
outbuf[0] = c | first;
return len; return len;
} }

View File

@ -77,7 +77,7 @@ gboolean g_get_charset (char **charset);
gboolean g_unichar_isalnum (gunichar c); gboolean g_unichar_isalnum (gunichar c);
gboolean g_unichar_isalpha (gunichar c); gboolean g_unichar_isalpha (gunichar c);
gboolean g_unichar_iscntrl (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_isgraph (gunichar c);
gboolean g_unichar_islower (gunichar c); gboolean g_unichar_islower (gunichar c);
gboolean g_unichar_isprint (gunichar c); gboolean g_unichar_isprint (gunichar c);

14
gutf8.c
View File

@ -75,7 +75,6 @@
(Result) <<= 6; \ (Result) <<= 6; \
(Result) |= ((Chars)[(Count)] & 0x3f); \ (Result) |= ((Chars)[(Count)] & 0x3f); \
} }
gchar g_utf8_skip[256] = { 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,
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: * g_unichar_to_utf8:
* @ch: a ISO10646 character code * @ch: a ISO10646 character code
* @out: output buffer, must have at least 6 bytes of space. * @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 * Convert a single character to utf8
* *
@ -392,12 +393,15 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf)
len = 6; len = 6;
} }
for (i = len - 1; i > 0; --i) if (outbuf)
{ {
outbuf[i] = (c & 0x3f) | 0x80; for (i = len - 1; i > 0; --i)
c >>= 6; {
outbuf[i] = (c & 0x3f) | 0x80;
c >>= 6;
}
outbuf[0] = c | first;
} }
outbuf[0] = c | first;
return len; return len;
} }