Fixing g_socket_send_message() documentation to make it clearer

This commit is contained in:
Emmanuel Fleury 2021-01-12 17:33:49 +01:00
parent af0a555d27
commit 7e00091b60

View File

@ -4754,9 +4754,9 @@ input_message_from_msghdr (const struct msghdr *msg,
* notified of a %G_IO_OUT condition. (On Windows in particular, this is * notified of a %G_IO_OUT condition. (On Windows in particular, this is
* very common due to the way the underlying APIs work.) * very common due to the way the underlying APIs work.)
* *
* Finally, it must be mentioned that the whole message buffer cannot * The sum of the sizes of each #GOutputVector in vectors must not be
* exceed %G_MAXSSIZE, if the message can be more than this, then it * greater than %G_MAXSSIZE. If the message can be larger than this,
* is mandatory to use the g_socket_send_message_with_timeout() * then it is mandatory to use the g_socket_send_message_with_timeout()
* function. * function.
* *
* On error -1 is returned and @error is set accordingly. * On error -1 is returned and @error is set accordingly.
@ -4788,18 +4788,19 @@ g_socket_send_message (GSocket *socket,
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Unable to send message: %s"), _("Unable to send message: %s"),
_("Message too large")); _("Message vectors too large"));
return -1; return -1;
} }
vectors_size += vectors[i].size; vectors_size += vectors[i].size;
} }
/* Check if vectors buffers are too big for gssize */
/* Check if vector's buffers are too big for gssize */
if (vectors_size > G_MAXSSIZE) if (vectors_size > G_MAXSSIZE)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Unable to send message: %s"), _("Unable to send message: %s"),
_("Message too large")); _("Message vectors too large"));
return -1; return -1;
} }