glib: Add missing (nullable) and (optional) annotations

Add various (nullable) and (optional) annotations which were missing
from a variety of functions. Also port a couple of existing (allow-none)
annotations in the same files to use (nullable) and (optional) as
appropriate instead.

Secondly, add various (not nullable) annotations as needed by the new
default in gobject-introspection of marking gpointers as (nullable). See
https://bugzilla.gnome.org/show_bug.cgi?id=729660.

This includes adding some stub documentation comments for the
assertion macro error functions, which weren’t previously documented.
The new comments are purely to allow for annotations, and hence are
marked as (skip) to prevent the symbols appearing in the GIR file.

https://bugzilla.gnome.org/show_bug.cgi?id=719966
This commit is contained in:
Philip Withnall
2013-12-06 12:23:09 +00:00
parent 90808a0279
commit 25a7c817d3
48 changed files with 303 additions and 223 deletions
+2 -1
View File
@@ -55,7 +55,8 @@ g_converter_default_init (GConverterInterface *iface)
* @inbuf: (array length=inbuf_size) (element-type guint8): the buffer
* containing the data to convert.
* @inbuf_size: the number of bytes in @inbuf
* @outbuf: a buffer to write converted data in.
* @outbuf: (element-type guint8) (array length=outbuf_size): a buffer to write
* converted data in.
* @outbuf_size: the number of bytes in @outbuf, must be at least one
* @flags: a #GConverterFlags controlling the conversion details
* @bytes_read: (out): will be set to the number of bytes read from @inbuf on success
+1 -1
View File
@@ -393,7 +393,7 @@ g_credentials_get_native (GCredentials *credentials,
* g_credentials_set_native:
* @credentials: A #GCredentials.
* @native_type: The type of native credentials to set.
* @native: A pointer to native credentials.
* @native: (not nullable): A pointer to native credentials.
*
* Copies the native credentials of type @native_type from @native
* into @credentials.
+1 -1
View File
@@ -487,7 +487,7 @@ typedef GDBusInterfaceInfo ** (*GDBusSubtreeIntrospectFunc) (GDBusConnection
* @object_path: The object path that was registered with g_dbus_connection_register_subtree().
* @interface_name: The D-Bus interface name that the method call or property access is for.
* @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
* @out_user_data: Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL).
* @out_user_data: (nullable) (not optional): Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL).
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
*
* The type of the @dispatch function in #GDBusSubtreeVTable.
+5 -4
View File
@@ -711,9 +711,10 @@ g_file_info_remove_attribute (GFileInfo *info,
* g_file_info_get_attribute_data:
* @info: a #GFileInfo
* @attribute: a file attribute key
* @type: (out) (allow-none): return location for the attribute type, or %NULL
* @value_pp: (out) (allow-none): return location for the attribute value, or %NULL
* @status: (out) (allow-none): return location for the attribute status, or %NULL
* @type: (out) (optional): return location for the attribute type, or %NULL
* @value_pp: (out) (optional) (not nullable): return location for the
* attribute value, or %NULL; the attribute value will not be %NULL
* @status: (out) (optional): return location for the attribute status, or %NULL
*
* Gets the attribute type, value and status for an attribute key.
*
@@ -1108,7 +1109,7 @@ _g_file_info_set_attribute_by_id (GFileInfo *info,
* @info: a #GFileInfo.
* @attribute: a file attribute key.
* @type: a #GFileAttributeType
* @value_p: pointer to the value
* @value_p: (not nullable): pointer to the value
*
* Sets the @attribute to contain the given value, if possible. To unset the
* attribute, use %G_ATTRIBUTE_TYPE_INVALID for @type.
+1 -1
View File
@@ -83,7 +83,7 @@ g_icon_default_init (GIconInterface *iface)
/**
* g_icon_hash:
* @icon: #gconstpointer to an icon object.
* @icon: (not nullable): #gconstpointer to an icon object.
*
* Gets a hash for an icon.
*
+4 -2
View File
@@ -422,7 +422,8 @@ g_memory_output_stream_new_resizable (void)
* Note that the returned pointer may become invalid on the next
* write or truncate operation on the stream.
*
* Returns: (transfer none): pointer to the stream's data
* Returns: (transfer none): pointer to the stream's data, or %NULL if the data
* has been stolen
**/
gpointer
g_memory_output_stream_get_data (GMemoryOutputStream *ostream)
@@ -492,7 +493,8 @@ g_memory_output_stream_get_data_size (GMemoryOutputStream *ostream)
*
* @ostream must be closed before calling this function.
*
* Returns: (transfer full): the stream's data
* Returns: (transfer full): the stream's data, or %NULL if it has previously
* been stolen
*
* Since: 2.26
**/
+1 -1
View File
@@ -192,7 +192,7 @@ g_socket_address_to_native (GSocketAddress *address,
/**
* g_socket_address_new_from_native:
* @native: a pointer to a struct sockaddr
* @native: (not nullable): a pointer to a struct sockaddr
* @len: the size of the memory location pointed to by @native
*
* Creates a #GSocketAddress subclass corresponding to the native
+1 -1
View File
@@ -118,7 +118,7 @@ g_socket_control_message_get_msg_type (GSocketControlMessage *message)
/**
* g_socket_control_message_serialize:
* @message: a #GSocketControlMessage
* @data: A buffer to write data to
* @data: (not nullable): A buffer to write data to
*
* Converts the data in the message to bytes placed in the
* message.