Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Clarify documentation about g_convert() nul-terminated returns
Browse files Browse the repository at this point in the history
THere is effectively no nul-termination for multibyte characters.
  • Loading branch information
benjamin-otte committed Oct 27, 2009
1 parent d8fc152 commit 8c93617
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions glib/gconvert.c
Expand Up @@ -566,8 +566,16 @@ close_converter (GIConv cd)
* </footnote>.
*
* Return value: If the conversion was successful, a newly allocated
* nul-terminated string, which must be freed with
* g_free(). Otherwise %NULL and @error will be set.
* nul-terminated<footnote id="nul-returns">
* <para>
* Nul-terminated return values from conversion functions
* are terminated by a single 0 byte only. This means that
* for multibyte character sets like UTF-16, they must be
* treated as not nul-terminated.
* </para>
* </footnote>
* string, which must be freed with g_free(). Otherwise %NULL
* and @error will be set.
**/
gchar*
g_convert_with_iconv (const gchar *str,
Expand Down Expand Up @@ -719,8 +727,9 @@ g_convert_with_iconv (const gchar *str,
* conversions<footnoteref linkend="streaming-state"/>.
*
* Return value: If the conversion was successful, a newly allocated
* nul-terminated string, which must be freed with
* g_free(). Otherwise %NULL and @error will be set.
* nul-terminated<footnoteref linkend="nul-returns"/> string,
* which must be freed with g_free(). Otherwise %NULL and
* @error will be set.
**/
gchar*
g_convert (const gchar *str,
Expand Down Expand Up @@ -794,8 +803,9 @@ g_convert (const gchar *str,
* conversions<footnoteref linkend="streaming-state"/>.
*
* Return value: If the conversion was successful, a newly allocated
* nul-terminated string, which must be freed with
* g_free(). Otherwise %NULL and @error will be set.
* nul-terminated<footnoteref linkend="nul-returns"/> string,
* which must be freed with g_free(). Otherwise %NULL and
* @error will be set.
**/
gchar*
g_convert_with_fallback (const gchar *str,
Expand Down

0 comments on commit 8c93617

Please sign in to comment.