Fix various warnings

https://bugzilla.gnome.org/show_bug.cgi?id=734737
This commit is contained in:
Руслан Ижбулатов 2014-08-13 18:43:51 +00:00
parent 1b9fa975af
commit a0faf5a51c
7 changed files with 31 additions and 21 deletions

View File

@ -65,6 +65,8 @@ static GdkKeymap *default_keymap = NULL;
static guint *keysym_tab = NULL; static guint *keysym_tab = NULL;
#define KEY_STATE_SIZE 256
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
static void static void
print_keysym_tab (void) print_keysym_tab (void)
@ -74,7 +76,7 @@ print_keysym_tab (void)
g_print ("keymap:%s%s\n", g_print ("keymap:%s%s\n",
_gdk_keyboard_has_altgr ? " (uses AltGr)" : "", _gdk_keyboard_has_altgr ? " (uses AltGr)" : "",
(gdk_shift_modifiers & GDK_LOCK_MASK) ? " (has ShiftLock)" : ""); (gdk_shift_modifiers & GDK_LOCK_MASK) ? " (has ShiftLock)" : "");
for (vk = 0; vk < 256; vk++) for (vk = 0; vk < KEY_STATE_SIZE; vk++)
{ {
gint state; gint state;
@ -279,12 +281,12 @@ set_shift_vks (guchar *key_state,
} }
static void static void
reset_after_dead (guchar key_state[256]) reset_after_dead (guchar key_state[KEY_STATE_SIZE])
{ {
guchar temp_key_state[256]; guchar temp_key_state[KEY_STATE_SIZE];
wchar_t wcs[2]; wchar_t wcs[2];
memmove (temp_key_state, key_state, sizeof (key_state)); memmove (temp_key_state, key_state, KEY_STATE_SIZE);
temp_key_state[VK_SHIFT] = temp_key_state[VK_SHIFT] =
temp_key_state[VK_CONTROL] = temp_key_state[VK_CONTROL] =
@ -348,7 +350,7 @@ static void
update_keymap (void) update_keymap (void)
{ {
static guint current_serial = 0; static guint current_serial = 0;
guchar key_state[256]; guchar key_state[KEY_STATE_SIZE];
guint scancode; guint scancode;
guint vk; guint vk;
gboolean capslock_tested = FALSE; gboolean capslock_tested = FALSE;
@ -359,14 +361,14 @@ update_keymap (void)
current_serial = _gdk_keymap_serial; current_serial = _gdk_keymap_serial;
if (keysym_tab == NULL) if (keysym_tab == NULL)
keysym_tab = g_new (guint, 4*256); keysym_tab = g_new (guint, 4*KEY_STATE_SIZE);
memset (key_state, 0, sizeof (key_state)); memset (key_state, 0, sizeof (key_state));
_gdk_keyboard_has_altgr = FALSE; _gdk_keyboard_has_altgr = FALSE;
gdk_shift_modifiers = GDK_SHIFT_MASK; gdk_shift_modifiers = GDK_SHIFT_MASK;
for (vk = 0; vk < 256; vk++) for (vk = 0; vk < KEY_STATE_SIZE; vk++)
{ {
if ((scancode = MapVirtualKey (vk, 0)) == 0 && if ((scancode = MapVirtualKey (vk, 0)) == 0 &&
vk != VK_DIVIDE) vk != VK_DIVIDE)
@ -583,7 +585,7 @@ gdk_win32_keymap_get_entries_for_keyval (GdkKeymap *keymap,
update_keymap (); update_keymap ();
for (vk = 0; vk < 256; vk++) for (vk = 0; vk < KEY_STATE_SIZE; vk++)
{ {
gint i; gint i;
@ -651,7 +653,7 @@ gdk_win32_keymap_get_entries_for_keycode (GdkKeymap *keymap,
g_return_val_if_fail (n_entries != NULL, FALSE); g_return_val_if_fail (n_entries != NULL, FALSE);
if (hardware_keycode <= 0 || if (hardware_keycode <= 0 ||
hardware_keycode >= 256) hardware_keycode >= KEY_STATE_SIZE)
{ {
if (keys) if (keys)
*keys = NULL; *keys = NULL;
@ -747,7 +749,7 @@ gdk_win32_keymap_lookup_key (GdkKeymap *keymap,
update_keymap (); update_keymap ();
if (key->keycode >= 256 || if (key->keycode >= KEY_STATE_SIZE ||
key->group < 0 || key->group >= 2 || key->group < 0 || key->group >= 2 ||
key->level < 0 || key->level >= 2) key->level < 0 || key->level >= 2)
return 0; return 0;
@ -796,7 +798,7 @@ gdk_win32_keymap_translate_keyboard_state (GdkKeymap *keymap,
if (keymap != NULL && keymap != gdk_keymap_get_default ()) if (keymap != NULL && keymap != gdk_keymap_get_default ())
return FALSE; return FALSE;
if (hardware_keycode >= 256) if (hardware_keycode >= KEY_STATE_SIZE)
return FALSE; return FALSE;
if (group < 0 || group >= 2) if (group < 0 || group >= 2)

View File

@ -415,7 +415,7 @@ _gdk_win32_screen_get_setting (GdkScreen *screen,
*/ */
if (!GetVersionEx (&info) || if (!GetVersionEx (&info) ||
info.dwMajorVersion > 6 || info.dwMajorVersion > 6 ||
info.dwMajorVersion == 6 && info.dwMinorVersion >= 2) (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2))
return FALSE; return FALSE;
/* check whether the system default ANSI codepage matches the /* check whether the system default ANSI codepage matches the

View File

@ -531,7 +531,7 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL) if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL)
{ {
wchar_t *ptr, *p, *q; wchar_t *ptr, *p, *q;
guchar *data; gchar *data;
glong length, wclen; glong length, wclen;
if ((ptr = GlobalLock (hdata)) != NULL) if ((ptr = GlobalLock (hdata)) != NULL)
@ -559,7 +559,7 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
if (data) if (data)
selection_property_store (requestor, _utf8_string, 8, selection_property_store (requestor, _utf8_string, 8,
data, strlen (data) + 1); (guchar *) data, strlen (data) + 1);
GlobalUnlock (hdata); GlobalUnlock (hdata);
} }
} }
@ -940,7 +940,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
g_get_charset (&charset); g_get_charset (&charset);
result = g_convert (text, length, charset, source_charset, result = g_convert ((const gchar *) text, length, charset, source_charset,
NULL, NULL, NULL); NULL, NULL, NULL);
g_free (source_charset); g_free (source_charset);

View File

@ -17,9 +17,13 @@
*/ */
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#endif
#ifndef WINVER
#define WINVER _WIN32_WINNT #define WINVER _WIN32_WINNT
#endif #endif
#endif
#include "config.h" #include "config.h"
#include "gtkprint-win32.h" #include "gtkprint-win32.h"

View File

@ -17,9 +17,13 @@
*/ */
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#endif
#ifndef WINVER
#define WINVER _WIN32_WINNT #define WINVER _WIN32_WINNT
#endif #endif
#endif
#define COBJMACROS #define COBJMACROS
#include "config.h" #include "config.h"
@ -680,7 +684,7 @@ devmode_to_settings (GtkPrintSettings *settings,
devmode->dmDriverVersion); devmode->dmDriverVersion);
if (devmode->dmDriverExtra != 0) if (devmode->dmDriverExtra != 0)
{ {
char *extra = g_base64_encode (((char *)devmode) + sizeof (DEVMODEW), char *extra = g_base64_encode (((const guchar *)devmode) + sizeof (DEVMODEW),
devmode->dmDriverExtra); devmode->dmDriverExtra);
gtk_print_settings_set (settings, gtk_print_settings_set (settings,
GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA, GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA,
@ -935,10 +939,10 @@ devmode_from_settings (GtkPrintSettings *settings,
{ {
HANDLE hDevMode; HANDLE hDevMode;
LPDEVMODEW devmode; LPDEVMODEW devmode;
char *extras; guchar *extras;
GtkPaperSize *paper_size; GtkPaperSize *paper_size;
const char *extras_base64; const char *extras_base64;
int extras_len; gsize extras_len;
const char *val; const char *val;
extras = NULL; extras = NULL;

View File

@ -200,7 +200,7 @@ gtk_win32_embed_widget_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD; attributes.window_type = GDK_WINDOW_CHILD;
attributes.title = gtk_window_get_title (window); attributes.title = (gchar *) gtk_window_get_title (window);
_gtk_window_get_wmclass (window, &attributes.wmclass_name, &attributes.wmclass_class); _gtk_window_get_wmclass (window, &attributes.wmclass_name, &attributes.wmclass_class);
attributes.width = allocation.width; attributes.width = allocation.width;
attributes.height = allocation.height; attributes.height = allocation.height;
@ -219,7 +219,7 @@ gtk_win32_embed_widget_realize (GtkWidget *widget)
GDK_FOCUS_CHANGE_MASK); GDK_FOCUS_CHANGE_MASK);
attributes_mask = GDK_WA_VISUAL; attributes_mask = GDK_WA_VISUAL;
attributes_mask |= (gtk_window_get_title (window) ? GDK_WA_TITLE : 0); attributes_mask |= (attributes.title ? GDK_WA_TITLE : 0);
attributes_mask |= (attributes.wmclass_name ? GDK_WA_WMCLASS : 0); attributes_mask |= (attributes.wmclass_name ? GDK_WA_WMCLASS : 0);
gdk_window = gdk_window_new (embed_widget->parent_window, gdk_window = gdk_window_new (embed_widget->parent_window,

View File

@ -188,7 +188,7 @@ get_data_path (const gchar *subdir)
{ {
gchar *base_datadir, *full_datadir; gchar *base_datadir, *full_datadir;
#if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ) #if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
base_datadir = _gtk_get_datadir(); base_datadir = g_strdup (_gtk_get_datadir());
#else #else
base_datadir = g_strdup (GTK_DATADIR); base_datadir = g_strdup (GTK_DATADIR);
#endif #endif