Do not use g_io_channel_unix_new() for the win32 platforms.

It is advised to use the more accurate g_io_channel_win32_new_fd() or
g_io_channel_win32_new_socket() because GLib can't differentiate between
file descriptors and sockets on Windows, which outputs a warning when
there is ambiguity.
This commit is contained in:
Jehan 2014-08-11 23:01:12 +00:00
parent 4d15f219a7
commit b8aabcac5c
3 changed files with 15 additions and 1 deletions

View File

@ -153,7 +153,11 @@ gimp_xml_parser_parse_fd (GimpXmlParser *parser,
g_return_val_if_fail (parser != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
#ifdef G_OS_WIN32
io = g_io_channel_win32_new_fd (fd);
#else
io = g_io_channel_unix_new (fd);
#endif
success = gimp_xml_parser_parse_io_channel (parser, io, error);

View File

@ -261,12 +261,17 @@ gimp_plug_in_open (GimpPlugIn *plug_in,
/* Prevent the plug-in from inheriting our ends of the pipes */
SetHandleInformation ((HANDLE) _get_osfhandle (my_read[0]), HANDLE_FLAG_INHERIT, 0);
SetHandleInformation ((HANDLE) _get_osfhandle (my_write[1]), HANDLE_FLAG_INHERIT, 0);
#endif
plug_in->my_read = g_io_channel_win32_new_fd (my_read[0]);
plug_in->my_write = g_io_channel_win32_new_fd (my_write[1]);
plug_in->his_read = g_io_channel_win32_new_fd (my_write[0]);
plug_in->his_write = g_io_channel_win32_new_fd (my_read[1]);
#else
plug_in->my_read = g_io_channel_unix_new (my_read[0]);
plug_in->my_write = g_io_channel_unix_new (my_write[1]);
plug_in->his_read = g_io_channel_unix_new (my_write[0]);
plug_in->his_write = g_io_channel_unix_new (my_read[1]);
#endif
g_io_channel_set_encoding (plug_in->my_read, NULL, NULL);
g_io_channel_set_encoding (plug_in->my_write, NULL, NULL);

View File

@ -401,8 +401,13 @@ gimp_main (const GimpPlugInInfo *info,
gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
#endif
#ifdef G_OS_WIN32
_readchannel = g_io_channel_win32_new_fd (atoi (argv[2]));
_writechannel = g_io_channel_win32_new_fd (atoi (argv[3]));
#else
_readchannel = g_io_channel_unix_new (atoi (argv[2]));
_writechannel = g_io_channel_unix_new (atoi (argv[3]));
#endif
g_io_channel_set_encoding (_readchannel, NULL, NULL);
g_io_channel_set_encoding (_writechannel, NULL, NULL);