Merge branch '872-ucs-annotations' into 'master'

Add missing (transfer) annotations to gutf8.c functions

Closes #872

See merge request GNOME/glib!938
This commit is contained in:
Philip Withnall 2019-06-21 17:01:11 +00:00
commit 9d668a6a86
2 changed files with 18 additions and 18 deletions

View File

@ -685,7 +685,7 @@ g_unichar_compose (gunichar a,
* g_unichar_fully_decompose: * g_unichar_fully_decompose:
* @ch: a Unicode character. * @ch: a Unicode character.
* @compat: whether perform canonical or compatibility decomposition * @compat: whether perform canonical or compatibility decomposition
* @result: (nullable): location to store decomposed result, or %NULL * @result: (optional) (out caller-allocates): location to store decomposed result, or %NULL
* @result_len: length of @result * @result_len: length of @result
* *
* Computes the canonical or compatibility decomposition of a * Computes the canonical or compatibility decomposition of a

View File

@ -136,7 +136,7 @@ const gchar * const g_utf8_skip = utf8_skip_data;
* is made to see if the character found is actually valid other than * is made to see if the character found is actually valid other than
* it starts with an appropriate byte. * it starts with an appropriate byte.
* *
* Returns: a pointer to the found character or %NULL. * Returns: (transfer none) (nullable): a pointer to the found character or %NULL.
*/ */
gchar * gchar *
g_utf8_find_prev_char (const char *str, g_utf8_find_prev_char (const char *str,
@ -167,7 +167,7 @@ g_utf8_find_prev_char (const char *str,
* @end is non-%NULL, the return value will be %NULL if the end of the string * @end is non-%NULL, the return value will be %NULL if the end of the string
* is reached. * is reached.
* *
* Returns: (nullable): a pointer to the found character or %NULL if @end is * Returns: (transfer none) (nullable): a pointer to the found character or %NULL if @end is
* set and is reached * set and is reached
*/ */
gchar * gchar *
@ -199,7 +199,7 @@ g_utf8_find_next_char (const gchar *p,
* it starts with an appropriate byte. If @p might be the first * it starts with an appropriate byte. If @p might be the first
* character of the string, you must use g_utf8_find_prev_char() instead. * character of the string, you must use g_utf8_find_prev_char() instead.
* *
* Returns: a pointer to the found character * Returns: (transfer none) (not nullable): a pointer to the found character
*/ */
gchar * gchar *
g_utf8_prev_char (const gchar *p) g_utf8_prev_char (const gchar *p)
@ -275,7 +275,7 @@ g_utf8_strlen (const gchar *p,
* Copies a substring out of a UTF-8 encoded string. * Copies a substring out of a UTF-8 encoded string.
* The substring will contain @end_pos - @start_pos characters. * The substring will contain @end_pos - @start_pos characters.
* *
* Returns: a newly allocated copy of the requested * Returns: (transfer full): a newly allocated copy of the requested
* substring. Free with g_free() when no longer needed. * substring. Free with g_free() when no longer needed.
* *
* Since: 2.30 * Since: 2.30
@ -344,7 +344,7 @@ g_utf8_get_char (const gchar *p)
* This limitation exists as this function is called frequently during * This limitation exists as this function is called frequently during
* text rendering and therefore has to be as fast as possible. * text rendering and therefore has to be as fast as possible.
* *
* Returns: the resulting pointer * Returns: (transfer none): the resulting pointer
*/ */
gchar * gchar *
g_utf8_offset_to_pointer (const gchar *str, g_utf8_offset_to_pointer (const gchar *str,
@ -412,7 +412,7 @@ g_utf8_pointer_to_offset (const gchar *str,
/** /**
* g_utf8_strncpy: * g_utf8_strncpy:
* @dest: buffer to fill with characters from @src * @dest: (transfer none): buffer to fill with characters from @src
* @src: UTF-8 encoded string * @src: UTF-8 encoded string
* @n: character count * @n: character count
* *
@ -424,7 +424,7 @@ g_utf8_pointer_to_offset (const gchar *str,
* Note you must ensure @dest is at least 4 * @n to fit the * Note you must ensure @dest is at least 4 * @n to fit the
* largest possible UTF-8 characters * largest possible UTF-8 characters
* *
* Returns: @dest * Returns: (transfer none): @dest
*/ */
gchar * gchar *
g_utf8_strncpy (gchar *dest, g_utf8_strncpy (gchar *dest,
@ -518,7 +518,7 @@ g_unichar_to_utf8 (gunichar c,
* in a UTF-8 encoded string, while limiting the search to @len bytes. * in a UTF-8 encoded string, while limiting the search to @len bytes.
* If @len is -1, allow unbounded search. * If @len is -1, allow unbounded search.
* *
* Returns: %NULL if the string does not contain the character, * Returns: (transfer none) (nullable): %NULL if the string does not contain the character,
* otherwise, a pointer to the start of the leftmost occurrence * otherwise, a pointer to the start of the leftmost occurrence
* of the character in the string. * of the character in the string.
*/ */
@ -546,7 +546,7 @@ g_utf8_strchr (const char *p,
* in a UTF-8 encoded string, while limiting the search to @len bytes. * in a UTF-8 encoded string, while limiting the search to @len bytes.
* If @len is -1, allow unbounded search. * If @len is -1, allow unbounded search.
* *
* Returns: %NULL if the string does not contain the character, * Returns: (transfer none) (nullable): %NULL if the string does not contain the character,
* otherwise, a pointer to the start of the rightmost occurrence * otherwise, a pointer to the start of the rightmost occurrence
* of the character in the string. * of the character in the string.
*/ */
@ -709,7 +709,7 @@ g_utf8_get_char_validated (const gchar *p,
* but does no error checking on the input. A trailing 0 character * but does no error checking on the input. A trailing 0 character
* will be added to the string after the converted text. * will be added to the string after the converted text.
* *
* Returns: a pointer to a newly allocated UCS-4 string. * Returns: (transfer full): a pointer to a newly allocated UCS-4 string.
* This value must be freed with g_free(). * This value must be freed with g_free().
*/ */
gunichar * gunichar *
@ -834,7 +834,7 @@ try_malloc_n (gsize n_blocks, gsize n_block_bytes, GError **error)
* representation as UCS-4. A trailing 0 character will be added to the * representation as UCS-4. A trailing 0 character will be added to the
* string after the converted text. * string after the converted text.
* *
* Returns: a pointer to a newly allocated UCS-4 string. * Returns: (transfer full): a pointer to a newly allocated UCS-4 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. * %NULL will be returned and @error set.
*/ */
@ -915,7 +915,7 @@ g_utf8_to_ucs4 (const gchar *str,
* Convert a string from a 32-bit fixed width representation as UCS-4. * Convert a string from a 32-bit fixed width representation as UCS-4.
* to UTF-8. The result will be terminated with a 0 byte. * to UTF-8. The result will be terminated with a 0 byte.
* *
* Returns: a pointer to a newly allocated UTF-8 string. * Returns: (transfer full): a pointer to a newly allocated UTF-8 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. In that case, @items_read * %NULL will be returned and @error set. In that case, @items_read
* will be set to the position of the first invalid input character. * will be set to the position of the first invalid input character.
@ -1002,7 +1002,7 @@ g_ucs4_to_utf8 (const gunichar *str,
* be correctly interpreted as UTF-16, i.e. it doesn't contain * be correctly interpreted as UTF-16, i.e. it doesn't contain
* things unpaired surrogates. * things unpaired surrogates.
* *
* Returns: a pointer to a newly allocated UTF-8 string. * Returns: (transfer full): a pointer to a newly allocated UTF-8 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. * %NULL will be returned and @error set.
**/ **/
@ -1146,7 +1146,7 @@ g_utf16_to_utf8 (const gunichar2 *str,
* Convert a string from UTF-16 to UCS-4. The result will be * Convert a string from UTF-16 to UCS-4. The result will be
* nul-terminated. * nul-terminated.
* *
* Returns: a pointer to a newly allocated UCS-4 string. * Returns: (transfer full): a pointer to a newly allocated UCS-4 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. * %NULL will be returned and @error set.
*/ */
@ -1284,7 +1284,7 @@ g_utf16_to_ucs4 (const gunichar2 *str,
* Convert a string from UTF-8 to UTF-16. A 0 character will be * Convert a string from UTF-8 to UTF-16. A 0 character will be
* added to the result after the converted text. * added to the result after the converted text.
* *
* Returns: a pointer to a newly allocated UTF-16 string. * Returns: (transfer full): a pointer to a newly allocated UTF-16 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. * %NULL will be returned and @error set.
*/ */
@ -1400,7 +1400,7 @@ g_utf8_to_utf16 (const gchar *str,
* Convert a string from UCS-4 to UTF-16. A 0 character will be * Convert a string from UCS-4 to UTF-16. A 0 character will be
* added to the result after the converted text. * added to the result after the converted text.
* *
* Returns: a pointer to a newly allocated UTF-16 string. * Returns: (transfer full): a pointer to a newly allocated UTF-16 string.
* This value must be freed with g_free(). If an error occurs, * This value must be freed with g_free(). If an error occurs,
* %NULL will be returned and @error set. * %NULL will be returned and @error set.
*/ */
@ -1752,7 +1752,7 @@ g_unichar_validate (gunichar ch)
* newly-allocated memory, which should be freed with g_free() when * newly-allocated memory, which should be freed with g_free() when
* no longer needed. * no longer needed.
* *
* Returns: a newly-allocated string which is the reverse of @str * Returns: (transfer full): a newly-allocated string which is the reverse of @str
* *
* Since: 2.2 * Since: 2.2
*/ */