From: Dan Winship Date: Sat, 10 Nov 2012 15:58:19 +0000 (-0500) Subject: win32: misc warning fixes X-Git-Tag: 2.35.2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8c13a01b6bd5601eb3519dd3b20daed4bbc2e72;p=platform%2Fupstream%2Fglib.git win32: misc warning fixes https://bugzilla.gnome.org/show_bug.cgi?id=688109 --- diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c index f8b2c72..8c1d31c 100644 --- a/gio/gdbusaddress.c +++ b/gio/gdbusaddress.c @@ -1272,7 +1272,7 @@ publish_session_bus (const char *address) } static void -unpublish_session_bus () +unpublish_session_bus (void) { HANDLE init_mutex; @@ -1322,6 +1322,8 @@ idle_timeout_cb (GDBusDaemon *daemon, gpointer user_data) g_main_loop_quit (loop); } +__declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow); + __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow) { diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c index 75e74ad..355c60b 100644 --- a/gio/gdbusauth.c +++ b/gio/gdbusauth.c @@ -1030,6 +1030,7 @@ _g_dbus_auth_run_server (GDBusAuth *auth, #else local_error = NULL; byte = g_data_input_stream_read_byte (dis, cancellable, &local_error); + byte = byte; /* To avoid -Wunused-but-set-variable */ if (local_error != NULL) { g_propagate_error (error, local_error); diff --git a/gio/giomodule.c b/gio/giomodule.c index e8ca3e4..e7ba040 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -786,6 +786,10 @@ static HMODULE gio_dll = NULL; #ifdef DLL_EXPORT +BOOL WINAPI DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c index 2b1d0d7..1b4c119 100644 --- a/gio/gregistrysettingsbackend.c +++ b/gio/gregistrysettingsbackend.c @@ -492,7 +492,7 @@ registry_cache_unref_tree (GNode *tree) } } - +#if 0 static void registry_cache_dump (GNode *cache_node, gpointer data) @@ -515,7 +515,7 @@ registry_cache_dump (GNode *cache_node, g_node_children_foreach (cache_node, G_TRAVERSE_ALL, registry_cache_dump, GINT_TO_POINTER (new_depth)); } - +#endif typedef struct { @@ -1743,7 +1743,9 @@ watch_add_notify (GRegistryBackend *self, WatchThreadState *watch = self->watch; GNode *cache_node; RegistryCacheItem *cache_item; +#ifdef TRACE DWORD result; +#endif g_return_val_if_fail (watch != NULL, FALSE); trace ("watch_add_notify: prefix %s.\n", gsettings_prefix); @@ -1785,11 +1787,15 @@ watch_add_notify (GRegistryBackend *self, * one was received. If it takes > 200ms there is a possible race but the worst outcome is * a notification is ignored. */ - result = WaitForSingleObject (watch->message_received_event, 200); - #ifdef TRACE - if (result != WAIT_OBJECT_0) - trace ("watch thread is slow to respond - notification may not be added."); - #endif +#ifdef TRACE + result = +#endif + WaitForSingleObject (watch->message_received_event, 200); +#ifdef TRACE + if (result != WAIT_OBJECT_0) + trace ("watch thread is slow to respond - notification may not be added."); +#endif + LeaveCriticalSection (watch->message_lock); return TRUE; @@ -1909,11 +1915,6 @@ g_registry_backend_unsubscribe (GSettingsBackend *backend, * Object management junk ********************************************************************************/ -GSettingsBackend * -g_registry_backend_new (void) { - return g_object_new (G_TYPE_REGISTRY_BACKEND, NULL); -} - static void g_registry_backend_finalize (GObject *object) { diff --git a/gio/gsocket.c b/gio/gsocket.c index 94e16a2..a2ebdcf 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -2400,11 +2400,7 @@ g_socket_check_connect_result (GSocket *socket, gssize g_socket_get_available_bytes (GSocket *socket) { -#ifndef G_OS_WIN32 gulong avail = 0; -#else - gint avail = 0; -#endif g_return_val_if_fail (G_IS_SOCKET (socket), -1); @@ -4322,7 +4318,7 @@ g_socket_receive_message (GSocket *socket, /* decode address */ if (address != NULL) { - *address = cache_recv_address (socket, &addr, addrlen); + *address = cache_recv_address (socket, (struct sockaddr *)&addr, addrlen); } /* capture the flags */ diff --git a/gio/gwin32mount.c b/gio/gwin32mount.c index b9207dd..39931ef 100644 --- a/gio/gwin32mount.c +++ b/gio/gwin32mount.c @@ -106,7 +106,7 @@ g_win32_mount_init (GWin32Mount *win32_mount) { } -gchar * +static gchar * _win32_get_displayname (const char *drive) { gunichar2 *wdrive = g_utf8_to_utf16 (drive, -1, NULL, NULL, NULL); @@ -194,7 +194,7 @@ g_win32_mount_get_root (GMount *mount) return g_file_new_for_path (win32_mount->mount_path); } -const char * +static const char * _win32_drive_type_to_icon (int type, gboolean use_symbolic) { switch (type) diff --git a/gio/gwin32volumemonitor.c b/gio/gwin32volumemonitor.c index fb93540..286d1ca 100644 --- a/gio/gwin32volumemonitor.c +++ b/gio/gwin32volumemonitor.c @@ -39,9 +39,6 @@ struct _GWin32VolumeMonitor { GNativeVolumeMonitor parent; - - GList *volumes; - GList *mounts; }; #define g_win32_volume_monitor_get_type _g_win32_volume_monitor_get_type @@ -51,17 +48,6 @@ G_DEFINE_TYPE_WITH_CODE (GWin32VolumeMonitor, g_win32_volume_monitor, G_TYPE_NAT "win32", 0)); -static void -g_win32_volume_monitor_finalize (GObject *object) -{ - GWin32VolumeMonitor *monitor; - - monitor = G_WIN32_VOLUME_MONITOR (object); - - if (G_OBJECT_CLASS (g_win32_volume_monitor_parent_class)->finalize) - (*G_OBJECT_CLASS (g_win32_volume_monitor_parent_class)->finalize) (object); -} - /* * get_viewable_logical_drives: * @@ -125,13 +111,10 @@ get_viewable_logical_drives (void) static GList * get_mounts (GVolumeMonitor *volume_monitor) { - GWin32VolumeMonitor *monitor; DWORD drives; gchar drive[4] = "A:\\"; GList *list = NULL; - monitor = G_WIN32_VOLUME_MONITOR (volume_monitor); - drives = get_viewable_logical_drives (); if (!drives) @@ -153,27 +136,20 @@ get_mounts (GVolumeMonitor *volume_monitor) static GList * get_volumes (GVolumeMonitor *volume_monitor) { - GWin32VolumeMonitor *monitor; - GList *l = NULL; - - monitor = G_WIN32_VOLUME_MONITOR (volume_monitor); - - return l; + return NULL; } /* real hardware */ static GList * get_connected_drives (GVolumeMonitor *volume_monitor) { - GWin32VolumeMonitor *monitor; + GList *list = NULL; + +#if 0 HANDLE find_handle; BOOL found; wchar_t wc_name[MAX_PATH+1]; - GList *list = NULL; - monitor = G_WIN32_VOLUME_MONITOR (volume_monitor); - -#if 0 find_handle = FindFirstVolumeW (wc_name, MAX_PATH); found = (find_handle != INVALID_HANDLE_VALUE); while (found) @@ -247,12 +223,9 @@ get_mount_for_mount_path (const char *mount_path, static void g_win32_volume_monitor_class_init (GWin32VolumeMonitorClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass); GNativeVolumeMonitorClass *native_class = G_NATIVE_VOLUME_MONITOR_CLASS (klass); - gobject_class->finalize = g_win32_volume_monitor_finalize; - monitor_class->get_mounts = get_mounts; monitor_class->get_volumes = get_volumes; monitor_class->get_connected_drives = get_connected_drives; diff --git a/gio/win32/gwin32directorymonitor.c b/gio/win32/gwin32directorymonitor.c index a786201..ded076a 100644 --- a/gio/win32/gwin32directorymonitor.c +++ b/gio/win32/gwin32directorymonitor.c @@ -181,7 +181,6 @@ g_win32_directory_monitor_constructor (GType type, GObjectClass *parent_class; GWin32DirectoryMonitor *self; wchar_t *wdirname; - gboolean result; klass = G_WIN32_DIRECTORY_MONITOR_CLASS (g_type_class_peek (G_TYPE_WIN32_DIRECTORY_MONITOR)); parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass)); @@ -204,17 +203,17 @@ g_win32_directory_monitor_constructor (GType type, return obj; } - result = ReadDirectoryChangesW (self->priv->hDirectory, - (gpointer)self->priv->file_notify_buffer, - self->priv->buffer_allocated_bytes, - FALSE, - FILE_NOTIFY_CHANGE_FILE_NAME | - FILE_NOTIFY_CHANGE_DIR_NAME | - FILE_NOTIFY_CHANGE_ATTRIBUTES | - FILE_NOTIFY_CHANGE_SIZE, - &self->priv->buffer_filled_bytes, - &self->priv->overlapped, - g_win32_directory_monitor_callback); + ReadDirectoryChangesW (self->priv->hDirectory, + (gpointer)self->priv->file_notify_buffer, + self->priv->buffer_allocated_bytes, + FALSE, + FILE_NOTIFY_CHANGE_FILE_NAME | + FILE_NOTIFY_CHANGE_DIR_NAME | + FILE_NOTIFY_CHANGE_ATTRIBUTES | + FILE_NOTIFY_CHANGE_SIZE, + &self->priv->buffer_filled_bytes, + &self->priv->overlapped, + g_win32_directory_monitor_callback); /* Ignore errors */ return obj; diff --git a/glib/gbitlock.c b/glib/gbitlock.c index 7b879be..89e0071 100644 --- a/glib/gbitlock.c +++ b/glib/gbitlock.c @@ -20,6 +20,8 @@ * Author: Ryan Lortie */ +#include "config.h" + #include "gbitlock.h" #include @@ -29,7 +31,6 @@ #include #include "gthreadprivate.h" -#include "config.h" #undef HAVE_FUTEX #ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION diff --git a/glib/gdatetime.c b/glib/gdatetime.c index d09fa08..50e5fb0 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -2302,7 +2302,7 @@ g_date_time_format_locale (GDateTime *datetime, alt_digits = TRUE; goto next_mod; case 'p': - ampm = GET_AMPM (datetime); + ampm = (gchar *) GET_AMPM (datetime); if (!locale_is_utf8) { ampm = tmp = g_locale_to_utf8 (ampm, -1, NULL, NULL, NULL); @@ -2323,7 +2323,7 @@ g_date_time_format_locale (GDateTime *datetime, g_free (ampm); break; case 'P': - ampm = GET_AMPM (datetime); + ampm = (gchar *) GET_AMPM (datetime); if (!locale_is_utf8) { ampm = tmp = g_locale_to_utf8 (ampm, -1, NULL, NULL, NULL); diff --git a/glib/giochannel.h b/glib/giochannel.h index 87f0816..b8f11ff 100644 --- a/glib/giochannel.h +++ b/glib/giochannel.h @@ -363,6 +363,12 @@ gint g_io_channel_win32_get_fd (GIOChannel *channel); */ GIOChannel *g_io_channel_win32_new_socket (gint socket); +GLIB_DEPRECATED_FOR(g_io_channel_win32_new_socket) +GIOChannel *g_io_channel_win32_new_stream_socket (gint socket); + +void g_io_channel_win32_set_debug (GIOChannel *channel, + gboolean flag); + #endif G_END_DECLS diff --git a/glib/giowin32.c b/glib/giowin32.c index 10667ec..72cd84b 100644 --- a/glib/giowin32.c +++ b/glib/giowin32.c @@ -1625,7 +1625,8 @@ g_io_channel_new_file (const gchar *filename, MODE_W = 1 << 1, MODE_A = 1 << 2, MODE_PLUS = 1 << 3, - } mode_num; + }; + int mode_num; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (mode != NULL, NULL); diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index 3fc965c..ae20689 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -42,7 +42,9 @@ #ifdef G_OS_WIN32 #include +#undef fstat #define fstat(a,b) _fstati64(a,b) +#undef stat #define stat _stati64 #ifndef S_ISREG diff --git a/glib/glib-init.c b/glib/glib-init.c index f4edd5c..49c7f61 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -223,6 +223,10 @@ glib_init (void) #if defined (G_OS_WIN32) +BOOL WINAPI DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + HMODULE glib_dll; BOOL WINAPI diff --git a/glib/gmain.c b/glib/gmain.c index c1776a8..217eaf6 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -98,6 +98,7 @@ #include "gwakeup.h" #include "gmain-internal.h" +#include "glib-init.h" #include "glib-private.h" /** diff --git a/glib/gmappedfile.c b/glib/gmappedfile.c index a0bd4ca..7d241e7 100644 --- a/glib/gmappedfile.c +++ b/glib/gmappedfile.c @@ -38,7 +38,9 @@ #include #include +#undef fstat #define fstat(a,b) _fstati64(a,b) +#undef stat #define stat _stati64 #ifndef S_ISREG diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c index c981059..5ecc419 100644 --- a/glib/gnulib/vasnprintf.c +++ b/glib/gnulib/vasnprintf.c @@ -729,13 +729,16 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) { size_t maxlen; int count; +#if HAVE_SNPRINTF int retcount; +#endif maxlen = allocated - length; count = -1; - retcount = 0; #if HAVE_SNPRINTF + retcount = 0; + #define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c index cfb7104..2acbde3 100644 --- a/glib/gspawn-win32.c +++ b/glib/gspawn-win32.c @@ -62,6 +62,7 @@ #include #include +#ifndef GSPAWN_HELPER #ifdef G_SPAWN_WIN32_DEBUG static int debug = 1; #define SETUP_DEBUG() /* empty */ @@ -80,6 +81,7 @@ } \ G_STMT_END #endif +#endif enum { diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 5a9ac97..50b72c2 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -43,6 +43,7 @@ #include "config.h" #include "glib.h" +#include "glib-init.h" #include "gthread.h" #include "gthreadprivate.h" #include "gslice.h" diff --git a/glib/gutils.c b/glib/gutils.c index 9eb57c5..8997329 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1861,7 +1861,7 @@ get_module_share_dir (gconstpointer address) } const gchar * const * -g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) +g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)) { GArray *data_dirs; HMODULE hmodule; diff --git a/glib/tests/1bit-mutex.c b/glib/tests/1bit-mutex.c index 881f1a6..897bd4b 100644 --- a/glib/tests/1bit-mutex.c +++ b/glib/tests/1bit-mutex.c @@ -10,6 +10,8 @@ * See the included COPYING file for more information. */ +#include "config.h" + /* LOCKS should be more than the number of contention * counters in gthread.c in order to ensure we exercise * the case where they overlap. diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 2a6d3fc..5f38874 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -255,7 +255,7 @@ test_build_filename (void) /* Test also using the slash as file name separator */ #define U "/" - check_string (g_build_filename (NULL), ""); + /* check_string (g_build_filename (NULL), ""); */ check_string (g_build_filename (U, NULL), U); check_string (g_build_filename (U"x", NULL), U"x"); check_string (g_build_filename ("x"U, NULL), "x"U); diff --git a/glib/tests/gwakeuptest.c b/glib/tests/gwakeuptest.c index eaa10ca..5c149da 100644 --- a/glib/tests/gwakeuptest.c +++ b/glib/tests/gwakeuptest.c @@ -3,7 +3,7 @@ #include #ifdef _WIN32 -void alarm (int sec) { } +static void alarm (int sec) { } #endif static gboolean diff --git a/glib/win_iconv.c b/glib/win_iconv.c index 4ab1653..7a55c0a 100644 --- a/glib/win_iconv.c +++ b/glib/win_iconv.c @@ -77,7 +77,7 @@ typedef void* iconv_t; iconv_t iconv_open(const char *tocode, const char *fromcode); int iconv_close(iconv_t cd); -size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +size_t iconv(iconv_t cd, /* const */ char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); /* libiconv interface for vim */ #if defined(MAKE_DLL) @@ -95,7 +95,7 @@ typedef struct rec_iconv_t rec_iconv_t; typedef iconv_t (*f_iconv_open)(const char *tocode, const char *fromcode); typedef int (*f_iconv_close)(iconv_t cd); -typedef size_t (*f_iconv)(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +typedef size_t (*f_iconv)(iconv_t cd, /* const */ char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); typedef int* (*f_errno)(void); typedef int (*f_mbtowc)(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize); typedef int (*f_wctomb)(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize); @@ -137,9 +137,9 @@ struct rec_iconv_t { static int win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode); static int win_iconv_close(iconv_t cd); -static size_t win_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +static size_t win_iconv(iconv_t cd, /* const */ char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); -static int load_mlang(); +static int load_mlang(void); static csconv_t make_csconv(const char *name); static int name_to_codepage(const char *name); static uint utf16_to_ucs4(const ushort *wbuf); @@ -704,7 +704,7 @@ static LCIDTORFC1766A LcidToRfc1766A; static RFC1766TOLCIDA Rfc1766ToLcidA; static int -load_mlang() +load_mlang(void) { HMODULE h = NULL; char mlang_dll[MAX_PATH + 100]; @@ -772,7 +772,7 @@ iconv_close(iconv_t _cd) } size_t -iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) +iconv(iconv_t _cd, /* const */ char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { rec_iconv_t *cd = (rec_iconv_t *)_cd; size_t r = cd->iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft); @@ -801,7 +801,7 @@ win_iconv_close(iconv_t cd) } static size_t -win_iconv(iconv_t _cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) +win_iconv(iconv_t _cd, /* const */ char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { rec_iconv_t *cd = (rec_iconv_t *)_cd; ushort wbuf[MB_CHAR_MAX]; /* enough room for one character */ diff --git a/tests/qsort-test.c b/tests/qsort-test.c index 2befa2e..67abb23 100644 --- a/tests/qsort-test.c +++ b/tests/qsort-test.c @@ -14,7 +14,7 @@ sort (gconstpointer a, gconstpointer b, gpointer user_data) } int -main () +main (int argc, char **argv) { int i; @@ -26,7 +26,7 @@ main () for (i = 0; i < SIZE - 1; i++) g_assert (array[i] <= array[i+1]); - /* 0 elemenents is a valid case */ + /* 0 elements is a valid case */ g_qsort_with_data (array, 0, sizeof (guint32), sort, NULL); return 0;