From 43ae3892110d4d4a0c744a10cbcbdcc337efefc1 Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Mon, 3 Dec 2007 22:37:44 +0000 Subject: [PATCH] [start of port to win32/msvc] HAVE_UNIST_H and _pipe() only include 2007-12-03 Hans Breuer [start of port to win32/msvc] * gcancellable.c : HAVE_UNIST_H and _pipe() * gcontenttype.c : only include in the UNIX branch * gdatainputstream.c : pointer arithmetic on void* is a gcc extension * gdummyfile.c glocalfileinputstream.c gsimpleasyncresult.c : use HAVE_UNIST_H * glocalfileoutputstream.c : use HAVE_UNIST_H and s/ssize_t/gssize/ * glocalvfs.c : use HAVE_PWD_H * gio.symbols : ifdef unix specific functions with G_OS_UNIX * makefile.msc : new file (maybe later converted to makefile.msc.in) * Makefile.am : added to EXTRA_DIST svn path=/trunk/; revision=6027 --- gio/ChangeLog | 14 +++ gio/gcancellable.c | 8 ++ gio/gcontenttype.c | 3 +- gio/gdatainputstream.c | 4 +- gio/gdummyfile.c | 2 + gio/gio.symbols | 10 ++ gio/glocalfileinputstream.c | 2 + gio/glocalfileoutputstream.c | 8 +- gio/glocalvfs.c | 4 + gio/gsimpleasyncresult.c | 2 + gio/makefile.msc | 254 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 305 insertions(+), 6 deletions(-) create mode 100644 gio/makefile.msc diff --git a/gio/ChangeLog b/gio/ChangeLog index 8a9b075..bfebabe 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,17 @@ +2007-12-03 Hans Breuer + + [start of port to win32/msvc] + * gcancellable.c : HAVE_UNIST_H and _pipe() + * gcontenttype.c : only include in the UNIX branch + * gdatainputstream.c : pointer arithmetic on void* is a gcc extension + * gdummyfile.c glocalfileinputstream.c gsimpleasyncresult.c : use + HAVE_UNIST_H + * glocalfileoutputstream.c : use HAVE_UNIST_H and s/ssize_t/gssize/ + * glocalvfs.c : use HAVE_PWD_H + * gio.symbols : ifdef unix specific functions with G_OS_UNIX + * makefile.msc : new file (maybe later converted to makefile.msc.in) + * Makefile.am : added to EXTRA_DIST + 2007-12-03 Matthias Clasen * gfile.c (g_file_copy): Add a cross-reference to g_file_dup(). diff --git a/gio/gcancellable.c b/gio/gcancellable.c index e14e981..5be536b 100644 --- a/gio/gcancellable.c +++ b/gio/gcancellable.c @@ -21,9 +21,17 @@ */ #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include +#ifdef G_OS_WIN32 +#include +#ifndef pipe +#define pipe(fds) _pipe(fds, 4096, _O_BINARY) +#endif +#endif #include "gcancellable.h" #include "glibintl.h" diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c index fbf4fc9..a53b566 100644 --- a/gio/gcontenttype.c +++ b/gio/gcontenttype.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include "gcontenttypeprivate.h" @@ -286,6 +285,8 @@ g_content_types_get_registered (void) #else /* !G_OS_WIN32 - Unix specific version */ +#include + #define XDG_PREFIX _gio_xdg #include "xdgmime/xdgmime.h" diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c index e52348f..b5fdd6a 100644 --- a/gio/gdatainputstream.c +++ b/gio/gdatainputstream.c @@ -650,7 +650,7 @@ scan_for_newline (GDataInputStream *stream, newline_len = 0; start = checked; - buffer = g_buffered_input_stream_peek_buffer (bstream, &available) + start; + buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start; end = available; peeked = end - start; @@ -826,7 +826,7 @@ scan_for_chars (GDataInputStream *stream, found_pos = -1; start = checked; - buffer = g_buffered_input_stream_peek_buffer (bstream, &available) + start; + buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start; end = available; peeked = end - start; diff --git a/gio/gdummyfile.c b/gio/gdummyfile.c index be1402d..a1a8a25 100644 --- a/gio/gdummyfile.c +++ b/gio/gdummyfile.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include "gdummyfile.h" diff --git a/gio/gio.symbols b/gio/gio.symbols index d51eaf4..db331fa 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -629,6 +629,7 @@ g_themed_icon_get_names #if IN_HEADER(__G_UNIX_MOUNTS_H__) #if IN_FILE(__G_UNIX_MOUNTS_C__) +#ifdef G_OS_UNIX g_unix_mount_free g_unix_mount_point_free g_unix_mount_compare @@ -653,20 +654,25 @@ g_unix_mounts_changed_since g_unix_mount_points_changed_since g_unix_mount_monitor_get_type G_GNUC_CONST g_unix_mount_monitor_new +#endif /* G_OS_UNIX */ #endif #endif #if IN_HEADER(__G_UNIX_INPUT_STREAM_H__) #if IN_FILE(__G_UNIX_INPUT_STREAM_C__) +#ifdef G_OS_UNIX g_unix_input_stream_get_type G_GNUC_CONST g_unix_input_stream_new +#endif /* G_OS_UNIX */ #endif #endif #if IN_HEADER(__G_UNIX_OUTPUT_STREAM_H__) #if IN_FILE(__G_UNIX_OUTPUT_STREAM_C__) +#ifdef G_OS_UNIX g_unix_output_stream_get_type G_GNUC_CONST g_unix_output_stream_new +#endif /* G_OS_UNIX */ #endif #endif @@ -705,15 +711,19 @@ g_native_volume_monitor_get_type G_GNUC_CONST #if IN_HEADER(__G_LOCAL_FILE_MONITOR_H__) #if IN_FILE(__G_LOCAL_FILE_MONITOR_C__) +#ifdef G_OS_UNIX g_local_file_monitor_get_type G_GNUC_CONST #endif #endif +#endif #if IN_HEADER(__G_LOCAL_DIRECTORY_MONITOR_H__) #if IN_FILE(__G_LOCAL_DIRECTORY_MONITOR_C__) +#ifdef G_OS_UNIX g_local_directory_monitor_get_type G_GNUC_CONST #endif #endif +#endif #if IN_HEADER(__GIO_ENUM_TYPES_H__) #if IN_FILE(__GIO_ENUM_TYPES_C__) diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c index a1aa00b..c634f90 100644 --- a/gio/glocalfileinputstream.c +++ b/gio/glocalfileinputstream.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index fb76bf6..9949c2f 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include @@ -506,9 +508,9 @@ copy_file_data (gint sfd, gboolean ret = TRUE; gpointer buffer; const gchar *write_buffer; - ssize_t bytes_read; - ssize_t bytes_to_write; - ssize_t bytes_written; + gssize bytes_read; + gssize bytes_to_write; + gssize bytes_written; buffer = g_malloc (BUFSIZE); diff --git a/gio/glocalvfs.c b/gio/glocalvfs.c index 8e195c4..e4ec85a 100644 --- a/gio/glocalvfs.c +++ b/gio/glocalvfs.c @@ -25,7 +25,9 @@ #include "glocalfile.h" #include #include +#ifdef HAVE_PWD_H #include +#endif #include "gioalias.h" @@ -135,6 +137,7 @@ g_local_vfs_parse_name (GVfs *vfs, user_prefix = g_strdup (g_get_home_dir()); else { +#ifdef HAVE_PWD_H user_name = g_strndup (user_start, user_end - user_start); passwd_file_entry = getpwnam (user_name); g_free (user_name); @@ -143,6 +146,7 @@ g_local_vfs_parse_name (GVfs *vfs, passwd_file_entry->pw_dir != NULL) user_prefix = g_strdup (passwd_file_entry->pw_dir); else +#endif user_prefix = g_strdup (g_get_home_dir ()); } diff --git a/gio/gsimpleasyncresult.c b/gio/gsimpleasyncresult.c index 9a23bd6..81d1005 100644 --- a/gio/gsimpleasyncresult.c +++ b/gio/gsimpleasyncresult.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include "gsimpleasyncresult.h" #include "gioscheduler.h" diff --git a/gio/makefile.msc b/gio/makefile.msc new file mode 100644 index 0000000..2e9c624 --- /dev/null +++ b/gio/makefile.msc @@ -0,0 +1,254 @@ +# autogenerated from automake.am with automake.py +TOP = ..\.. +PRJ_TOP = .. +PACKAGE = gio +PKG_VER = 2.0 +!INCLUDE $(TOP)\glib\build\win32\make.msc + +# SUBDIRS = fam + +sub-all: + for %d in ($(SUBDIRS)) do nmake -nologo -f makefile.msc sub-one THIS=%d + +sub-one: + cd $(THIS) + nmake -nologo -f makefile.msc + cd .. + +INCLUDES = \ + -I .. -I ..\glib -I ..\gmodule -I . \ + $(INTL_CFLAGS) + +DEFINES = \ + -DG_LOG_DOMAIN=\"GLib-GIO\" \ + -DGIO_MODULE_DIR=\"$(libdir)/gio/modules\" + +appinfo_sources = \ + gwin32appinfo.c gwin32appinfo.h + +gio_headers = \ + gappinfo.h \ + gasyncresult.h \ + gbufferedinputstream.h \ + gbufferedoutputstream.h \ + gcancellable.h \ + gcontenttype.h \ + gdatainputstream.h \ + gdataoutputstream.h \ + gdirectorymonitor.h \ + gdrive.h \ + gfile.h \ + gfileattribute.h \ + gfileenumerator.h \ + gfileicon.h \ + gfileinfo.h \ + gfileinputstream.h \ + gfilemonitor.h \ + gfilenamecompleter.h \ + gfileoutputstream.h \ + gfilterinputstream.h \ + gfilteroutputstream.h \ + gicon.h \ + ginputstream.h \ + gio.h \ + gioerror.h \ + giomodule.h \ + gioscheduler.h \ + gloadableicon.h \ + gmemoryinputstream.h \ + gmemoryoutputstream.h \ + gmountoperation.h \ + goutputstream.h \ + gseekable.h \ + gsimpleasyncresult.h \ + gthemedicon.h \ + gvfs.h \ + gvolume.h \ + gvolumemonitor.h \ + $(NULL) + +OBJECTS = \ + gappinfo.obj \ + gasynchelper.obj \ + gasyncresult.obj \ + gbufferedinputstream.obj \ + gbufferedoutputstream.obj \ + gcancellable.obj \ + gcontenttype.obj \ + gdatainputstream.obj \ + gdataoutputstream.obj \ + gdirectorymonitor.obj \ + gdrive.obj \ + gdummyfile.obj \ + gfile.obj \ + gfileattribute.obj \ + gfileenumerator.obj \ + gfileicon.obj \ + gfileinfo.obj \ + gfileinputstream.obj \ + gfilemonitor.obj \ + gfilenamecompleter.obj \ + gfileoutputstream.obj \ + gfilterinputstream.obj \ + gfilteroutputstream.obj \ + gicon.obj \ + ginputstream.obj \ + gioenumtypes.obj \ + gioerror.obj \ + giomodule.obj \ + gioscheduler.obj \ + gloadableicon.obj \ + gmemoryinputstream.obj \ + gmemoryoutputstream.obj \ + gmountoperation.obj \ + gnativevolumemonitor.obj \ + goutputstream.obj \ + gpollfilemonitor.obj \ + gseekable.obj \ + gsimpleasyncresult.obj \ +# gsocketinputstream.obj \ +# gsocketoutputstream.obj \ + gthemedicon.obj \ + gunionvolumemonitor.obj \ + gvfs.obj \ + gvolume.obj \ + gvolumemonitor.obj \ + \ + glocalvfs.obj \ + glocalfile.obj \ + glocalfileenumerator.obj \ + glocalfileinfo.obj \ + glocalfileinputstream.obj \ + glocalfileoutputstream.obj \ + gwin32appinfo.obj \ + \ + gio-marshal.obj + +libgio_2_0_la_LIBADD = \ + $(top_builddir)/glib/libglib-2.0.la \ + $(top_builddir)/gobject/libgobject-2.0.la \ + $(top_builddir)/gmodule/libgmodule-2.0.la \ + $(platform_libadd) \ + $(SELINUX_LIBS) \ + $(GLIB_LIBS) \ + $(XATTR_LIBS) \ + $(NULL) + +unix_sources = \ + gunixdrive.c \ + gunixdrive.h \ + gunixmounts.c \ + gunixmounts.h \ + gunixvolume.c \ + gunixvolume.h \ + gunixvolumemonitor.c \ + gunixvolumemonitor.h \ + $(NULL) + +NULL = \ + + +libgio_2_0_la_LDFLAG = \ + -export-dynamic \ + $(no_undefined) \ + -export-symbols-regex \ + '^g_.*' + +giounixincludedi = \ + $(includedir)/gio-unix-2.0/gio + +platform_libadd = \ + -lshlwapi + +marshal_sources = \ + gio-marshal.h gio-marshal.c $(NULL) + +gioincludedi = \ + $(includedir)/glib-2.0/gio/ + +EXTRA_DIST = \ + gio-marshal.list $(NULL) + +CLEANFILES = \ + $(marshal_sources) $(NULL) + +no_undefined = \ + -no-undefined + +giounixinclude_HEADERS = \ + gunixmounts.h $(NULL) + +GLIB_GEN_MARSHAL = ..\gobject\glib-genmarshal.exe + +gio-marshal.h: gio-marshal.list + $(GLIB_GEN_MARSHAL) --prefix=_gio_marshal gio-marshal.list --header >> xgen-gwmh \ + && copy /y xgen-gwmh gio-marshal.h \ + && del xgen-gwmh xgen-gwmh~ + +gio-marshal.c: gio-marshal.h + echo #include "gio-marshal.h" >> xgen-gwmc \ + && $(GLIB_GEN_MARSHAL) --prefix=_gio_marshal gio-marshal.list --body >> xgen-gwmc \ + && copy xgen-gwmc gio-marshal.c \ + && del xgen-gwmc xgen-gwmc~ + +local_sources = \ + glocaldirectorymonitor.c \ + glocaldirectorymonitor.h \ + glocalfile.c \ + glocalfile.h \ + glocalfileenumerator.c \ + glocalfileenumerator.h \ + glocalfileinfo.c \ + glocalfileinfo.h \ + glocalfileinputstream.c \ + glocalfileinputstream.h \ + glocalfilemonitor.c \ + glocalfilemonitor.h \ + glocalfileoutputstream.c \ + glocalfileoutputstream.h \ + glocalvfs.c \ + glocalvfs.h \ + $(NULL) + +all : \ + $(PRJ_TOP)\config.h \ + gioalias.h \ + gioaliasdef.c \ + gio-marshal.c \ + gioenumtypes.h \ + gioenumtypes.c \ + libgio-$(PKG_VER).dll + + +$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32 + copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h + +gioalias.h: gio.symbols + perl ..\glib\makegalias.pl < gio.symbols > gioalias.h + +gioaliasdef.c: gio.symbols + perl ..\glib\makegalias.pl -def < gio.symbols > gioaliasdef.c + +gioenumtypes.h: $(gio_headers) gioenumtypes.h.template + $(PERL) ..\gobject\glib-mkenums --template gioenumtypes.h.template $(gio_headers) > gioenumtypes.h + +gioenumtypes.c: $(gio_headers) gioenumtypes.c.template + $(PERL) ..\gobject\glib-mkenums --template gioenumtypes.c.template $(gio_headers) > gioenumtypes.c + +gio.def: gio.symbols + echo EXPORTS > gio.def + cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DINCLUDE_INTERNAL_SYMBOLS -DALL_FILES \ + -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= \ + -DG_GNUC_PRINTF=;G_GNUC_PRINTF gio.symbols >> gio.def + + +RESOURCE = $(PACKAGE).res + +libgio-$(PKG_VER).dll : $(OBJECTS) $(PACKAGE).def + $(CC) $(CFLAGS) -LD -Felibgio-$(PKG_VER).dll $(OBJECTS) \ + ..\glib\glib-2.0.lib ..\gobject\gobject-2.0.lib ..\gmodule\gmodule-2.0.lib \ + $(INTL_LIBS) \ + user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:$(PACKAGE).def + +.c.obj : + $(CC) $(CFLAGS) -GD -c $(PKG_CFLAGS) $< -- 2.7.4