diff options
author | Руслан Ижбулатов <lrn1986@gmail.com> | 2014-08-13 18:43:51 +0000 |
---|---|---|
committer | Руслан Ижбулатов <lrn1986@gmail.com> | 2014-08-13 23:41:56 +0000 |
commit | a0faf5a51ced242985e993abc2bc6684863564e0 (patch) | |
tree | 3b18413c2b3d954e59bc61669eaaddcf721ee4d0 | |
parent | 1b9fa975af45b1723fe21a65503859609dc0e7ad (diff) | |
download | gtk+-a0faf5a51ced242985e993abc2bc6684863564e0.tar.gz |
Fix various warnings
https://bugzilla.gnome.org/show_bug.cgi?id=734737
-rw-r--r-- | gdk/win32/gdkkeys-win32.c | 24 | ||||
-rw-r--r-- | gdk/win32/gdkproperty-win32.c | 2 | ||||
-rw-r--r-- | gdk/win32/gdkselection-win32.c | 6 | ||||
-rw-r--r-- | gtk/gtkprint-win32.c | 4 | ||||
-rw-r--r-- | gtk/gtkprintoperation-win32.c | 10 | ||||
-rw-r--r-- | gtk/gtkwin32embedwidget.c | 4 | ||||
-rw-r--r-- | gtk/inspector/visual.c | 2 |
7 files changed, 31 insertions, 21 deletions
diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c index ca2e9228ac..fe9c05c409 100644 --- a/gdk/win32/gdkkeys-win32.c +++ b/gdk/win32/gdkkeys-win32.c @@ -65,6 +65,8 @@ static GdkKeymap *default_keymap = NULL; static guint *keysym_tab = NULL; +#define KEY_STATE_SIZE 256 + #ifdef G_ENABLE_DEBUG static void print_keysym_tab (void) @@ -74,7 +76,7 @@ print_keysym_tab (void) g_print ("keymap:%s%s\n", _gdk_keyboard_has_altgr ? " (uses AltGr)" : "", (gdk_shift_modifiers & GDK_LOCK_MASK) ? " (has ShiftLock)" : ""); - for (vk = 0; vk < 256; vk++) + for (vk = 0; vk < KEY_STATE_SIZE; vk++) { gint state; @@ -279,12 +281,12 @@ set_shift_vks (guchar *key_state, } 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]; - 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_CONTROL] = @@ -348,7 +350,7 @@ static void update_keymap (void) { static guint current_serial = 0; - guchar key_state[256]; + guchar key_state[KEY_STATE_SIZE]; guint scancode; guint vk; gboolean capslock_tested = FALSE; @@ -359,14 +361,14 @@ update_keymap (void) current_serial = _gdk_keymap_serial; 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)); _gdk_keyboard_has_altgr = FALSE; 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 && vk != VK_DIVIDE) @@ -583,7 +585,7 @@ gdk_win32_keymap_get_entries_for_keyval (GdkKeymap *keymap, update_keymap (); - for (vk = 0; vk < 256; vk++) + for (vk = 0; vk < KEY_STATE_SIZE; vk++) { gint i; @@ -651,7 +653,7 @@ gdk_win32_keymap_get_entries_for_keycode (GdkKeymap *keymap, g_return_val_if_fail (n_entries != NULL, FALSE); if (hardware_keycode <= 0 || - hardware_keycode >= 256) + hardware_keycode >= KEY_STATE_SIZE) { if (keys) *keys = NULL; @@ -747,7 +749,7 @@ gdk_win32_keymap_lookup_key (GdkKeymap *keymap, update_keymap (); - if (key->keycode >= 256 || + if (key->keycode >= KEY_STATE_SIZE || key->group < 0 || key->group >= 2 || key->level < 0 || key->level >= 2) return 0; @@ -796,7 +798,7 @@ gdk_win32_keymap_translate_keyboard_state (GdkKeymap *keymap, if (keymap != NULL && keymap != gdk_keymap_get_default ()) return FALSE; - if (hardware_keycode >= 256) + if (hardware_keycode >= KEY_STATE_SIZE) return FALSE; if (group < 0 || group >= 2) diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index a447c06e94..700fd8571d 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -415,7 +415,7 @@ _gdk_win32_screen_get_setting (GdkScreen *screen, */ if (!GetVersionEx (&info) || info.dwMajorVersion > 6 || - info.dwMajorVersion == 6 && info.dwMinorVersion >= 2) + (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2)) return FALSE; /* check whether the system default ANSI codepage matches the diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index 2bb7ffd7c8..6903943944 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -531,7 +531,7 @@ _gdk_win32_display_convert_selection (GdkDisplay *display, if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL) { wchar_t *ptr, *p, *q; - guchar *data; + gchar *data; glong length, wclen; if ((ptr = GlobalLock (hdata)) != NULL) @@ -559,7 +559,7 @@ _gdk_win32_display_convert_selection (GdkDisplay *display, if (data) selection_property_store (requestor, _utf8_string, 8, - data, strlen (data) + 1); + (guchar *) data, strlen (data) + 1); GlobalUnlock (hdata); } } @@ -940,7 +940,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display, 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); g_free (source_charset); diff --git a/gtk/gtkprint-win32.c b/gtk/gtkprint-win32.c index 04d614cc3a..bc4e7c3eac 100644 --- a/gtk/gtkprint-win32.c +++ b/gtk/gtkprint-win32.c @@ -17,9 +17,13 @@ */ #ifndef _MSC_VER +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 +#endif +#ifndef WINVER #define WINVER _WIN32_WINNT #endif +#endif #include "config.h" #include "gtkprint-win32.h" diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index d537a3490a..64f7714263 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -17,9 +17,13 @@ */ #ifndef _MSC_VER +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 +#endif +#ifndef WINVER #define WINVER _WIN32_WINNT #endif +#endif #define COBJMACROS #include "config.h" @@ -680,7 +684,7 @@ devmode_to_settings (GtkPrintSettings *settings, devmode->dmDriverVersion); 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); gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA, @@ -935,10 +939,10 @@ devmode_from_settings (GtkPrintSettings *settings, { HANDLE hDevMode; LPDEVMODEW devmode; - char *extras; + guchar *extras; GtkPaperSize *paper_size; const char *extras_base64; - int extras_len; + gsize extras_len; const char *val; extras = NULL; diff --git a/gtk/gtkwin32embedwidget.c b/gtk/gtkwin32embedwidget.c index 383da0eedd..a4738c3def 100644 --- a/gtk/gtkwin32embedwidget.c +++ b/gtk/gtkwin32embedwidget.c @@ -200,7 +200,7 @@ gtk_win32_embed_widget_realize (GtkWidget *widget) gtk_widget_get_allocation (widget, &allocation); 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); attributes.width = allocation.width; attributes.height = allocation.height; @@ -219,7 +219,7 @@ gtk_win32_embed_widget_realize (GtkWidget *widget) GDK_FOCUS_CHANGE_MASK); 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); gdk_window = gdk_window_new (embed_widget->parent_window, diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c index f2bb18acbe..ab11cfa2ef 100644 --- a/gtk/inspector/visual.c +++ b/gtk/inspector/visual.c @@ -188,7 +188,7 @@ get_data_path (const gchar *subdir) { gchar *base_datadir, *full_datadir; #if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ) - base_datadir = _gtk_get_datadir(); + base_datadir = g_strdup (_gtk_get_datadir()); #else base_datadir = g_strdup (GTK_DATADIR); #endif |