Implement g_ucs4_to_utf8 which was in

Mon Sep 18 10:58:21 2000  Owen Taylor  <otaylor@redhat.com>

	* gutf8.c: Implement g_ucs4_to_utf8 which was in
This commit is contained in:
Owen Taylor 2000-09-18 14:55:24 +00:00 committed by Owen Taylor
parent 86ce799cdf
commit ddbb2ea440
11 changed files with 159 additions and 18 deletions

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -1,6 +1,15 @@
Mon Sep 18 10:58:21 2000 Owen Taylor <otaylor@redhat.com>
* gutf8.c: Implement g_ucs4_to_utf8 which was in
the header file but not implemented.
Sun Sep 17 2000 Elliot Lee <sopwith@redhat.com>
* glib.h configure.in: Define g_alloca() as an alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on 64-bit platforms.
* glib.h configure.in: Define g_alloca() as an
alloca-that-works-anywhere.
* gconvert.c: Fix warnings which could have caused problems on
64-bit platforms.
Sun Sep 10 12:37:40 2000 Owen Taylor <otaylor@redhat.com>

View File

@ -454,8 +454,7 @@ Summary of rules for use of #GError:
</para>
@err:
<!--
@err: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../glib-docs.sgml" "book" "refsect2" "")

View File

@ -487,6 +487,41 @@ g_utf8_to_ucs4 (const char *str, int len)
return result;
}
/**
* g_ucs4_to_utf8:
* @str: a UCS-4 encoded string
* @len: the length of @
*
* Convert a string from a 32-bit fixed width representation as UCS-4.
* to UTF-8.
*
* Return value: a pointer to a newly allocated UTF-8 string.
* This value must be freed with g_free()
**/
gchar *
g_ucs4_to_utf8 (const gunichar *str, int len)
{
gint result_length;
gchar *result, *p;
gint i;
result_length = 0;
for (i = 0; i < len ; i++)
result_length += g_unichar_to_utf8 (str[i], NULL);
result_length++;
result = g_malloc (result_length + 1);
p = result;
for (i = 0; i < len ; i++)
p += g_unichar_to_utf8 (str[i], p);
*p = '\0';
return result;
}
/**
* g_utf8_validate:
* @str: a pointer to character data

35
gutf8.c
View File

@ -487,6 +487,41 @@ g_utf8_to_ucs4 (const char *str, int len)
return result;
}
/**
* g_ucs4_to_utf8:
* @str: a UCS-4 encoded string
* @len: the length of @
*
* Convert a string from a 32-bit fixed width representation as UCS-4.
* to UTF-8.
*
* Return value: a pointer to a newly allocated UTF-8 string.
* This value must be freed with g_free()
**/
gchar *
g_ucs4_to_utf8 (const gunichar *str, int len)
{
gint result_length;
gchar *result, *p;
gint i;
result_length = 0;
for (i = 0; i < len ; i++)
result_length += g_unichar_to_utf8 (str[i], NULL);
result_length++;
result = g_malloc (result_length + 1);
p = result;
for (i = 0; i < len ; i++)
p += g_unichar_to_utf8 (str[i], p);
*p = '\0';
return result;
}
/**
* g_utf8_validate:
* @str: a pointer to character data