mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
win32: misc warning fixes
https://bugzilla.gnome.org/show_bug.cgi?id=688109
This commit is contained in:
parent
f248c86b0a
commit
b8c13a01b6
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -20,6 +20,8 @@
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gbitlock.h"
|
||||
|
||||
#include <glib/gmessages.h>
|
||||
@ -29,7 +31,6 @@
|
||||
#include <glib/gslice.h>
|
||||
|
||||
#include "gthreadprivate.h"
|
||||
#include "config.h"
|
||||
|
||||
#undef HAVE_FUTEX
|
||||
#ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -42,7 +42,9 @@
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
|
||||
#undef fstat
|
||||
#define fstat(a,b) _fstati64(a,b)
|
||||
#undef stat
|
||||
#define stat _stati64
|
||||
|
||||
#ifndef S_ISREG
|
||||
|
@ -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
|
||||
|
@ -98,6 +98,7 @@
|
||||
|
||||
#include "gwakeup.h"
|
||||
#include "gmain-internal.h"
|
||||
#include "glib-init.h"
|
||||
#include "glib-private.h"
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,9 @@
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#undef fstat
|
||||
#define fstat(a,b) _fstati64(a,b)
|
||||
#undef stat
|
||||
#define stat _stati64
|
||||
|
||||
#ifndef S_ISREG
|
||||
|
@ -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) \
|
||||
{ \
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include <direct.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#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
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "glib.h"
|
||||
#include "glib-init.h"
|
||||
#include "gthread.h"
|
||||
#include "gthreadprivate.h"
|
||||
#include "gslice.h"
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <glib/gwakeup.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
void alarm (int sec) { }
|
||||
static void alarm (int sec) { }
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user