Merge branch 'wip/ernestask/converter-null-out' into 'main'

gio: converter: Forbid null out arguments

See merge request GNOME/glib!3245
This commit is contained in:
Philip Withnall 2023-02-02 22:39:57 +00:00
commit 622e1d8c83

View File

@ -57,12 +57,14 @@ 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: (element-type guint8) (array length=outbuf_size): a buffer to write
* converted data in.
* @outbuf: (element-type guint8) (array length=outbuf_size) (not nullable): 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
* @bytes_written: (out): will be set to the number of bytes written to @outbuf on success
* @bytes_read: (out) (not nullable): will be set to the number of bytes read
* from @inbuf on success
* @bytes_written: (out) (not nullable): will be set to the number of bytes
* written to @outbuf on success
* @error: location to store the error occurring, or %NULL to ignore
*
* This is the main operation used when converting data. It is to be called
@ -166,7 +168,12 @@ g_converter_convert (GConverter *converter,
GConverterIface *iface;
g_return_val_if_fail (G_IS_CONVERTER (converter), G_CONVERTER_ERROR);
g_return_val_if_fail (inbuf != NULL || inbuf_size == 0, G_CONVERTER_ERROR);
g_return_val_if_fail (outbuf != NULL, G_CONVERTER_ERROR);
g_return_val_if_fail (outbuf_size > 0, G_CONVERTER_ERROR);
g_return_val_if_fail (bytes_read != NULL, G_CONVERTER_ERROR);
g_return_val_if_fail (bytes_written != NULL, G_CONVERTER_ERROR);
g_return_val_if_fail (error == NULL || *error == NULL, G_CONVERTER_ERROR);
*bytes_read = 0;
*bytes_written = 0;