GNOME Bugzilla – Bug 734977
Make rsvg-convert work again on Windows for stdin input
Last modified: 2015-02-14 04:33:19 UTC
Hi, In the works to support huge SVG XML parsing, g_unix_input_stream_new() was used, which made the program not buildable on Windows. This bug is to have the tool re-support Windows. With blessings, thank you!
Created attachment 283703 [details] [review] Use GIO-Win32 API to regain support for Win32 Hi, This is my patch to use GIO-Win32 APIs to regain support for this tool on Windows, to be able to read input from STDIN on Windows. With blessings, thank you!
Hi, This bug has been fixed upstream by commit 1811f20, so I will close this now. With blessings, thank you!
Hi, Sorry, unfortunately I have to re-open this bug so soon, as commmit 1811f20 didn't fix the use of rsvg-convert on Windows correctly (I blindly closed this bug as I thought that commit fixed this correctly), as g_win32_input_stream_new() expects a HANDLE as the first parameter, not a special constant like STDIN_FILENO. I will attach a new version of the patch for it, based on the latest git master checkout. With blessings, thank you!
Created attachment 293034 [details] [review] Patch to fix build and use of rsvg-convert on Windows Hi, This is my fix for this. With blessings, thank you!
Hi, Adding Nacho to the CC list as well, as he might want a look at this. With blessings.
Review of attachment 293034 [details] [review]: See the comments. ::: rsvg-convert.c @@ +128,3 @@ +#ifdef G_OS_WIN32 + gpointer handle; should this be just HANDLE? @@ +232,3 @@ + + if (handle == INVALID_HANDLE_VALUE) { + gchar* emsg = g_win32_error_message (GetLastError()); it should be gchar *emsg @@ +234,3 @@ + gchar* emsg = g_win32_error_message (GetLastError()); + fprintf (stderr, _("Unable to acquire HANDLE for STDIN. Error was:\n")); + fprintf (stderr, "%s\n", emsg); use g_printerr here and maybe change it to: g_printerr ( _("Unable to acquire HANDLE for STDIN: %s\n"), emsg);
Created attachment 293038 [details] [review] Patch to fix build and use of rsvg-convert on Windows (take ii) Hello Nacho, Thanks for the reviews... (In reply to comment #6) > +#ifdef G_OS_WIN32 > + gpointer handle; > > should this be just HANDLE? Ideally yes, so I updated it here. It's interesting to see that the prototype of g_win32_input_stream_new() wanted a void*, so I followed it initially, oh well (HANDLE is typedef'ed as > it should be gchar *emsg Got it. > use g_printerr here and maybe change it to: > g_printerr ( _("Unable to acquire HANDLE for STDIN: %s\n"), emsg); Got it. With blessings, thank you!
("HANDLE is typedef'ed as" should read "HANDLE is typedef'ed as void*"), typed ahead of myself...
Review of attachment 293038 [details] [review]: See the comment. ::: rsvg-convert.c @@ +237,3 @@ + exit (1); + } + stream = g_win32_input_stream_new (handle, FALSE); does the compiler complains here about the missing cast? if yes add (void *) here if not feel free to push it
Review of attachment 293038 [details] [review]: Hello Nacho, The compiler only had a few C4996 (use of deprecated APIs), which means this patch by itself had no warning, so I went ahead to push the patch (as 452ef81). Thanks for the reviews, with blessings.
Might better to see gio\tests\win32-streams.c how to implement this.