gio: Add G_IO_ERROR_DESTINATION_UNSET

...and map EDESTADDRREQ to it.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
Sergey Bugaev 2023-11-06 15:01:13 +03:00
parent 734f8184e8
commit 6b7b211338
4 changed files with 10 additions and 2 deletions

View File

@ -517,6 +517,7 @@ typedef enum {
* @G_IO_ERROR_NOT_CONNECTED: Transport endpoint is not connected. Since 2.44
* @G_IO_ERROR_MESSAGE_TOO_LARGE: Message too large. Since 2.48.
* @G_IO_ERROR_NO_SUCH_DEVICE: No such device found. Since 2.74
* @G_IO_ERROR_DESTINATION_UNSET: Destination address unset. Since 2.80
*
* Error codes returned by GIO functions.
*
@ -587,6 +588,7 @@ typedef enum {
G_IO_ERROR_NOT_CONNECTED,
G_IO_ERROR_MESSAGE_TOO_LARGE,
G_IO_ERROR_NO_SUCH_DEVICE GIO_AVAILABLE_ENUMERATOR_IN_2_74,
G_IO_ERROR_DESTINATION_UNSET GIO_AVAILABLE_ENUMERATOR_IN_2_80,
} GIOErrorEnum;

View File

@ -228,6 +228,12 @@ g_io_error_from_errno (gint err_no)
break;
#endif
#ifdef EDESTADDRREQ
case EDESTADDRREQ:
return G_IO_ERROR_DESTINATION_UNSET;
break;
#endif
#ifdef EMSGSIZE
case EMSGSIZE:
return G_IO_ERROR_MESSAGE_TOO_LARGE;

View File

@ -557,7 +557,7 @@ test_error_from_errno (void)
#ifdef EDESTADDRREQ
g_assert_cmpuint (g_io_error_from_errno (EDESTADDRREQ), ==,
G_IO_ERROR_FAILED);
G_IO_ERROR_DESTINATION_UNSET);
#endif
#ifdef EPROTOTYPE

View File

@ -777,7 +777,7 @@ test_ip_sync_dgram (GSocketFamily family)
len = g_socket_send_messages (client, m, G_N_ELEMENTS (m), 0, NULL, &error);
/* This error code may vary between platforms and over time; it is not guaranteed API: */
#ifndef G_OS_WIN32
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DESTINATION_UNSET);
#else
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_CONNECTED);
#endif