[glib] Fix build with the Microsoft compiler



commit efb1a054b0858b4475941892f53bbc5186065df9
Author: Tor Lillqvist <tml iki fi>
Date:   Tue Jun 22 12:13:21 2010 +0300

    Fix build with the Microsoft compiler
    
    Correct a few gccisms and C99isms. Ensure the Windows-specific gio
    source files are listed in the generated gio VS project file.

 gio/Makefile.am                  |   12 +++++++-----
 gio/gcredentials.c               |    2 ++
 gio/gdbusauthmechanismexternal.c |    2 ++
 gio/gdbusauthmechanismsha1.c     |    5 +++++
 gio/gdbusconnection.c            |    2 +-
 gio/gdbuserror.c                 |    2 +-
 gio/gdbusintrospection.c         |    2 +-
 gio/gdbusserver.c                |    3 +++
 gio/gio.symbols                  |    2 ++
 gio/glocalfileinputstream.c      |    6 ++++--
 gio/glocalfileoutputstream.c     |    6 ++++--
 11 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/gio/Makefile.am b/gio/Makefile.am
index cfa7ed0..b8cdb34 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -231,10 +231,7 @@ giounixinclude_HEADERS = \
 	$(NULL)
 endif
 
-if OS_WIN32
-appinfo_sources += gwin32appinfo.c gwin32appinfo.h
-platform_libadd += -lshlwapi -lws2_32 -ldnsapi
-win32_sources = \
+win32_actual_sources = \
 	gwin32mount.c \
 	gwin32mount.h \
 	gwin32resolver.c \
@@ -254,6 +251,11 @@ win32_more_sources_for_vcproj = \
 	win32/gwinhttpfileoutputstream.c \
 	win32/gwinhttpvfs.c
 
+if OS_WIN32
+appinfo_sources += gwin32appinfo.c gwin32appinfo.h
+platform_libadd += -lshlwapi -lws2_32 -ldnsapi
+win32_sources = $(win32_actual_sources)
+
 giowin32includedir=$(includedir)/gio-win32-2.0/gio
 giowin32include_HEADERS = \
 	gwin32inputstream.h \
@@ -601,7 +603,7 @@ dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/gio.vcproj
 	  cp $$d/$$f $(distdir) || exit 1; done
 
 ../build/win32/vs9/gio.vcproj: $(top_srcdir)/build/win32/vs9/gio.vcprojin
-	for F in `echo $(libgio_2_0_la_SOURCES) $(win32_sources) $(win32_more_sources_for_vcproj) | tr '/' '\\'`; do \
+	for F in `echo $(libgio_2_0_la_SOURCES) $(win32_actual_sources) $(win32_actual_more_sources_for_vcproj) | tr '/' '\\'`; do \
 		case $$F in \
 		gunix*.c|gdesktopappinfo.c) ;; \
 		*.c) echo '   <File RelativePath="..\..\..\gio\'$$F'" />' \
diff --git a/gio/gcredentials.c b/gio/gcredentials.c
index bc70291..40d6757 100644
--- a/gio/gcredentials.c
+++ b/gio/gcredentials.c
@@ -67,7 +67,9 @@ struct _GCredentialsPrivate
 #ifdef __linux__
   struct ucred native;
 #else
+#ifdef __GNUC__
 #warning Please add GCredentials support for your OS
+#endif
   guint foo;
 #endif
 };
diff --git a/gio/gdbusauthmechanismexternal.c b/gio/gdbusauthmechanismexternal.c
index 46d3931..ce6484e 100644
--- a/gio/gdbusauthmechanismexternal.c
+++ b/gio/gdbusauthmechanismexternal.c
@@ -352,7 +352,9 @@ mechanism_client_initiate (GDBusAuthMechanism   *mechanism,
 #if defined(G_OS_UNIX)
   initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) g_credentials_get_unix_user (credentials, NULL));
 #elif defined(G_OS_WIN32)
+#ifdef __GNUC__
 #warning Dont know how to send credentials on this OS. The EXTERNAL D-Bus authentication mechanism will not work.
+#endif
   m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_REJECTED;
 #endif
   return initial_response;
diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
index bca42a8..9a471b0 100644
--- a/gio/gdbusauthmechanismsha1.c
+++ b/gio/gdbusauthmechanismsha1.c
@@ -29,6 +29,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef _WIN32
+#include <io.h>
+#endif
 
 #include <glib/gstdio.h>
 
@@ -281,8 +284,10 @@ ensure_keyring_directory (GError **error)
               goto out;
             }
 #else
+#ifdef __GNUC__
 #warning Please implement permission checking on this non-UNIX platform
 #endif
+#endif
         }
         goto out;
     }
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index d2ab2d4..d80dfc0 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -4773,7 +4773,7 @@ handle_subtree_method_invocation (GDBusConnection *connection,
                                   ExportedSubtree *es,
                                   GDBusMessage    *message)
 {
-  gboolean handled;;
+  gboolean handled;
   const gchar *sender;
   const gchar *interface_name;
   const gchar *member;
diff --git a/gio/gdbuserror.c b/gio/gdbuserror.c
index a6e552b..33105cf 100644
--- a/gio/gdbuserror.c
+++ b/gio/gdbuserror.c
@@ -152,12 +152,12 @@ static const GDBusErrorEntry g_dbus_error_entries[] =
 GQuark
 g_dbus_error_quark (void)
 {
+  G_STATIC_ASSERT (G_N_ELEMENTS (g_dbus_error_entries) - 1 == G_DBUS_ERROR_OBJECT_PATH_IN_USE);
   static volatile gsize quark_volatile = 0;
   g_dbus_error_register_error_domain ("g-dbus-error-quark",
                                       &quark_volatile,
                                       g_dbus_error_entries,
                                       G_N_ELEMENTS (g_dbus_error_entries));
-  G_STATIC_ASSERT (G_N_ELEMENTS (g_dbus_error_entries) - 1 == G_DBUS_ERROR_OBJECT_PATH_IN_USE);
   return (GQuark) quark_volatile;
 }
 
diff --git a/gio/gdbusintrospection.c b/gio/gdbusintrospection.c
index c92e307..2e8acef 100644
--- a/gio/gdbusintrospection.c
+++ b/gio/gdbusintrospection.c
@@ -1826,6 +1826,7 @@ g_dbus_node_info_new_for_xml (const gchar  *xml_data,
   GMarkupParser *parser;
   guint num_nodes;
   ParseData *data;
+  GDBusNodeInfo **ughret;
 
   ret = NULL;
   parser = NULL;
@@ -1848,7 +1849,6 @@ g_dbus_node_info_new_for_xml (const gchar  *xml_data,
                                      error))
     goto out;
 
-  GDBusNodeInfo **ughret;
   ughret = parse_data_steal_nodes (data, &num_nodes);
 
   if (num_nodes != 1)
diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c
index 008f85d..85adccc 100644
--- a/gio/gdbusserver.c
+++ b/gio/gdbusserver.c
@@ -28,6 +28,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef _WIN32
+#include <io.h>
+#endif
 
 #include "giotypes.h"
 #include "gioerror.h"
diff --git a/gio/gio.symbols b/gio/gio.symbols
index 05da84b..f93b779 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -81,6 +81,7 @@ g_app_launch_context_launch_failed
 #endif
 
 #if IN_FILE(__G_DESKTOP_APP_INFO_C__)
+#ifdef G_OS_UNIX
 g_app_info_create_from_commandline
 g_app_info_get_all
 g_app_info_get_all_for_type
@@ -89,6 +90,7 @@ g_app_info_get_default_for_uri_scheme
 g_app_info_reset_type_associations
 #endif
 #endif
+#endif
 
 
 #if IN_HEADER(__G_DESKTOP_APP_INFO_H__)
diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c
index 646daef..5988a4f 100644
--- a/gio/glocalfileinputstream.c
+++ b/gio/glocalfileinputstream.c
@@ -54,12 +54,14 @@ static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIfac
 #endif
 
 #define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type
-G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
 #ifdef G_OS_UNIX
+G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
 			 G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
 						g_file_descriptor_based_iface_init)
-#endif
 );
+#else
+G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,);
+#endif
 
 struct _GLocalFileInputStreamPrivate {
   int fd;
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index 7916b03..d080fef 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -64,12 +64,14 @@ static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIfac
 #endif
 
 #define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type
-G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
 #ifdef G_OS_UNIX
+G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
 			 G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
 						g_file_descriptor_based_iface_init)
-#endif
                            );
+#else
+G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,);
+#endif
 
 
 /* Some of the file replacement code was based on the code from gedit,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]