Commit eec0827a authored by Olivier Crête's avatar Olivier Crête
Browse files

pseudotcp: Also convert Win32 errors

Win32 has some special error code, so add function to convert those.
parent f61b9455
...@@ -205,8 +205,16 @@ nice_pseudo_tcp_input_stream_set_property (GObject *object, guint prop_id, ...@@ -205,8 +205,16 @@ nice_pseudo_tcp_input_stream_set_property (GObject *object, guint prop_id,
static void static void
set_g_error_from_pseudo_tcp_error (GError **error, gint err_no) set_g_error_from_pseudo_tcp_error (GError **error, gint err_no)
{ {
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (err_no), "%s", GIOErrorEnum code = G_IO_ERROR_FAILED;
g_strerror (err_no));
#ifdef G_OS_WIN32
code = g_io_error_from_win32_error (err_no);
#endif
if (code == G_IO_ERROR_FAILED)
code = g_io_error_from_errno (err_no);
g_set_error (error, G_IO_ERROR, code, "%s", g_strerror (err_no));
} }
static gssize static gssize
......
...@@ -205,8 +205,16 @@ nice_pseudo_tcp_output_stream_set_property (GObject *object, guint prop_id, ...@@ -205,8 +205,16 @@ nice_pseudo_tcp_output_stream_set_property (GObject *object, guint prop_id,
static void static void
set_g_error_from_pseudo_tcp_error (GError **error, gint err_no) set_g_error_from_pseudo_tcp_error (GError **error, gint err_no)
{ {
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (err_no), "%s", GIOErrorEnum code = G_IO_ERROR_FAILED;
g_strerror (err_no));
#ifdef G_OS_WIN32
code = g_io_error_from_win32_error (err_no);
#endif
if (code == G_IO_ERROR_FAILED)
code = g_io_error_from_errno (err_no);
g_set_error (error, G_IO_ERROR, code, "%s", g_strerror (err_no));
} }
static gssize static gssize
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment