mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
Revert "gio: Add private API to create win32 streams from fds"
This reverts commit 292de8cc52
.
This commit is contained in:
@@ -63,7 +63,6 @@ G_DEFINE_TYPE (GWin32OutputStream, g_win32_output_stream, G_TYPE_OUTPUT_STREAM);
|
||||
struct _GWin32OutputStreamPrivate {
|
||||
HANDLE handle;
|
||||
gboolean close_handle;
|
||||
gint fd;
|
||||
};
|
||||
|
||||
static void g_win32_output_stream_set_property (GObject *object,
|
||||
@@ -191,7 +190,6 @@ g_win32_output_stream_init (GWin32OutputStream *win32_stream)
|
||||
|
||||
win32_stream->priv->handle = NULL;
|
||||
win32_stream->priv->close_handle = TRUE;
|
||||
win32_stream->priv->fd = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,45 +364,19 @@ g_win32_output_stream_close (GOutputStream *stream,
|
||||
if (!win32_stream->priv->close_handle)
|
||||
return TRUE;
|
||||
|
||||
if (win32_stream->priv->fd != -1)
|
||||
res = CloseHandle (win32_stream->priv->handle);
|
||||
if (!res)
|
||||
{
|
||||
int errsv = errno;
|
||||
if (close (win32_stream->priv->fd) < 0)
|
||||
{
|
||||
g_set_error_literal (error, G_IO_ERROR,
|
||||
g_io_error_from_errno (errsv),
|
||||
g_strerror (errsv));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CloseHandle (win32_stream->priv->handle);
|
||||
if (!res)
|
||||
{
|
||||
int errsv = GetLastError ();
|
||||
gchar *emsg = g_win32_error_message (errsv);
|
||||
int errsv = GetLastError ();
|
||||
gchar *emsg = g_win32_error_message (errsv);
|
||||
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
g_io_error_from_win32_error (errsv),
|
||||
_("Error closing handle: %s"),
|
||||
emsg);
|
||||
g_free (emsg);
|
||||
return FALSE;
|
||||
}
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
g_io_error_from_win32_error (errsv),
|
||||
_("Error closing handle: %s"),
|
||||
emsg);
|
||||
g_free (emsg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GOutputStream *
|
||||
g_win32_output_stream_new_from_fd (gint fd,
|
||||
gboolean close_fd)
|
||||
{
|
||||
GWin32OutputStream *win32_stream;
|
||||
|
||||
win32_stream = G_WIN32_OUTPUT_STREAM (g_win32_output_stream_new ((HANDLE) _get_osfhandle (fd), close_fd));
|
||||
win32_stream->priv->fd = fd;
|
||||
|
||||
return (GOutputStream*)win32_stream;
|
||||
}
|
||||
|
Reference in New Issue
Block a user