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.
This commit is contained in:
Tor Lillqvist 2010-06-22 12:13:21 +03:00
parent 2e84249082
commit efb1a054b0
11 changed files with 32 additions and 12 deletions

View File

@ -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'" />' \

View File

@ -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
};

View File

@ -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;

View File

@ -29,6 +29,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _WIN32
#include <io.h>
#endif
#include <glib/gstdio.h>
@ -281,7 +284,9 @@ ensure_keyring_directory (GError **error)
goto out;
}
#else
#ifdef __GNUC__
#warning Please implement permission checking on this non-UNIX platform
#endif
#endif
}
goto out;

View File

@ -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;

View File

@ -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;
}

View File

@ -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)

View File

@ -28,6 +28,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _WIN32
#include <io.h>
#endif
#include "giotypes.h"
#include "gioerror.h"

View File

@ -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__)

View File

@ -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;

View File

@ -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,