GNOME Bugzilla – Bug 318577
win32 port
Last modified: 2014-02-15 12:52:50 UTC
Tracking bug for the required changes for a win32 port. Tor (CC'ed) some time ago sent in a preliminary patch for the port. I am going to attach it here so that it doesn't get lost and also report here the comments done by mail.
Created attachment 53330 [details] [review] preliminary patch by Tor
- use xmlReaderForFd also on unix to avoid the ifdef - move the added function from gsv-i18n.h to a gsv-win32 since that's where they belong and since we are goin to switch to gi18n-lib.h - the patch may be simplyfied after forting out bug #304147 (use of XDG_DATA_DIRS, includes a patch)
Created attachment 55642 [details] [review] proposed patch Here is an updated patch: it's simply the above patch with - the ifdefs removed (except were we use g_file_get_contents, since that load all the file into memory... I was not sure if libxml is doing the same thing or if it's a bit smarter) - the code to locate lang files removed since we now use g_get_system_data_dir (xdg stuff). I assumed that g_get_system_data_dir works out of the box on win32 in the same way, obviously I have no idea if that is correct :) Tor, any chance you could give this a quick try? I'd love to have an official win32 version of sourceview since there are varius proects using it
I will look into this again "soon" (next week probably), thanks!
Comment on attachment 55642 [details] [review] proposed patch >+ /* >+ * Use of filename is not ut8 safe on w32, so read >+ * the whole file there. >+ */ >+#ifndef G_OS_WIN32 > doc = xmlParseFile (language->priv->lang_file_name); >+#else >+ { >+ gchar *file_contents; >+ gsize file_length; >+ >+ if (g_file_get_contents (language->priv->lang_file_name, >+ &file_contents, &file_length, NULL)) { >+ doc = xmlParseMemory (file_contents, file_length); >+ g_free (file_contents); >+ } else { >+ doc = NULL; >+ } >+ } What about using GMappedFile on glib >= 2.8 and removing the G_OS_WIN32 check.
Created attachment 57438 [details] [review] Patch using GMappedFile as proposed (does not patch configure.in and Makefile.am) This patch uses GMappedFile as I proposed in my previous comment. It does not patch configure.in and Makefile.am to generate gtksourceview-zip. We are going to commit this patch now. Tor: can you please give a look at it and let us know what is missing for complete win32 support? Feel free to commit "build" related patches.
I have just committed to CVS HEAD a modified version of patch at comment #6 containing also what is needed to generate gtksourceview-zip. I'm closing this bug. Tor: feel free to re-open this bug if gtksourceview 1.5.5 or CVS HEAD does not build/work on Win32. 2006-01-16 Paolo Maggi <paolo@gnome.org> Fixed bug #318577 – win32 port Based on a patch by Tor Lillqvist modified by Paolo Borelli * configure.in: added gtksourceview-zip to AC_CONFIG_FILES * makefile.am: added gtksourceview-zip.in to EXTRA_DIST * gtksourceview-zip.in: new file * gtksourceview/Makefile.am: define PREFIX in INCLUDES * gtksourceview/gtksourcelanguage.c (_gtk_source_language_new_from_file): use xmlReaderForFd instead of xmlNewTextReaderFilename so that it's utf8 safe on win32. (get_mime_types_from_file): ditto (language_file_parse): use GMappedFile and xmlParseMemory instead of xmlParseFile