mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 01:48:53 +02:00
gvariant: Clarify that nullable strings should use maybe types
Otherwise people might try to encode a NULL string as "NULL". I’m not even kidding. https://bugzilla.gnome.org/show_bug.cgi?id=741779
This commit is contained in:
@@ -1217,7 +1217,9 @@ g_variant_new_fixed_array (const GVariantType *element_type,
|
||||
*
|
||||
* Creates a string #GVariant with the contents of @string.
|
||||
*
|
||||
* @string must be valid UTF-8.
|
||||
* @string must be valid UTF-8, and must not be %NULL. To encode
|
||||
* potentially-%NULL strings, use g_variant_new() with `ms` as the
|
||||
* [format string][gvariant-format-strings-maybe-types].
|
||||
*
|
||||
* Returns: (transfer none): a floating reference to a new string #GVariant instance
|
||||
*
|
||||
@@ -1239,7 +1241,8 @@ g_variant_new_string (const gchar *string)
|
||||
*
|
||||
* Creates a string #GVariant with the contents of @string.
|
||||
*
|
||||
* @string must be valid UTF-8.
|
||||
* @string must be valid UTF-8, and must not be %NULL. To encode
|
||||
* potentially-%NULL strings, use this with g_variant_new_maybe().
|
||||
*
|
||||
* This function consumes @string. g_free() will be called on @string
|
||||
* when it is no longer required.
|
||||
@@ -1407,7 +1410,7 @@ g_variant_is_signature (const gchar *string)
|
||||
* type. This includes the types %G_VARIANT_TYPE_STRING,
|
||||
* %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
|
||||
*
|
||||
* The string will always be UTF-8 encoded.
|
||||
* The string will always be UTF-8 encoded, and will never be %NULL.
|
||||
*
|
||||
* If @length is non-%NULL then the length of the string (in bytes) is
|
||||
* returned there. For trusted values, this information is already
|
||||
|
Reference in New Issue
Block a user