From: Eli Zaretskii Date: Tue, 17 Dec 2013 17:46:31 +0000 (+0200) Subject: Fix some warnings in w32 specific code. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~366 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=af025ae850c8f30431cf79876c4452d9f1679250;p=emacs.git Fix some warnings in w32 specific code. src/w32term.c (w32_initialize): Declare the argument of set_user_model as const. src/w32menu.c : Fix argument declarations. (w32_menu_show): Constify some arguments passed to MessageBox. src/w32uniscribe.c (uniscribe_font_driver): Use LISP_INITIALLY_ZERO to initialize Lisp objects. src/w32font.c (w32font_driver): Use LISP_INITIALLY_ZERO to initialize Lisp objects. src/frame.c (x_set_frame_parameters) [HAVE_X_WINDOWS]: Declare and use variables used only on X under that condition. src/fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows variables not used there. --- diff --git a/src/ChangeLog b/src/ChangeLog index 36378fd911e..aaa8788c2ba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2013-12-17 Eli Zaretskii + + * w32term.c (w32_initialize): Declare the argument of + set_user_model as const. + + * w32menu.c : Fix argument declarations. + (w32_menu_show): Constify some arguments passed to MessageBox. + + * w32uniscribe.c (uniscribe_font_driver): Use LISP_INITIALLY_ZERO + to initialize Lisp objects. + + * w32font.c (w32font_driver): Use LISP_INITIALLY_ZERO to + initialize Lisp objects. + + * frame.c (x_set_frame_parameters) [HAVE_X_WINDOWS]: Declare and + use variables used only on X under that condition. + + * fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows + variables not used there. + 2013-12-16 Paul Eggert Fix problems with CANNOT_DUMP and EMACSLOADPATH. diff --git a/src/fileio.c b/src/fileio.c index 47736d2b1b7..295d9d748ad 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1942,10 +1942,7 @@ attributes of FILE to NEWNAME, such as its SELinux context and ACL entries (depending on how Emacs was built). */) (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_extended_attributes) { - int ifd, ofd; - int n; - char buf[16 * 1024]; - struct stat st, out_st; + struct stat out_st; Lisp_Object handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; ptrdiff_t count = SPECPDL_INDEX (); @@ -1956,6 +1953,11 @@ entries (depending on how Emacs was built). */) #endif #ifdef WINDOWSNT int result; +#else + int ifd, ofd; + int n; + char buf[16 * 1024]; + struct stat st; #endif encoded_file = encoded_newname = Qnil; diff --git a/src/frame.c b/src/frame.c index 43e549235df..7699f24fbb1 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2807,7 +2807,9 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) Lisp_Object *values; ptrdiff_t i, p; bool left_no_change = 0, top_no_change = 0; +#ifdef HAVE_X_WINDOWS bool icon_left_no_change = 0, icon_top_no_change = 0; +#endif bool size_changed = 0; struct gcpro gcpro1, gcpro2; @@ -2954,14 +2956,18 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) /* If one of the icon positions was not set, preserve or default it. */ if (! TYPE_RANGED_INTEGERP (int, icon_left)) { +#ifdef HAVE_X_WINDOWS icon_left_no_change = 1; +#endif icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); if (NILP (icon_left)) XSETINT (icon_left, 0); } if (! TYPE_RANGED_INTEGERP (int, icon_top)) { +#ifdef HAVE_X_WINDOWS icon_top_no_change = 1; +#endif icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); if (NILP (icon_top)) XSETINT (icon_top, 0); diff --git a/src/w32font.c b/src/w32font.c index 654e0d9cae4..fb83ec16a5f 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2562,7 +2562,7 @@ w32font_filter_properties (Lisp_Object font, Lisp_Object alist) struct font_driver w32font_driver = { - 0, /* Qgdi */ + LISP_INITIALLY_ZERO, /* Qgdi */ 0, /* case insensitive */ w32font_get_cache, w32font_list, diff --git a/src/w32menu.c b/src/w32menu.c index 4f8e8dbef05..68fbd3aa98e 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -82,8 +82,8 @@ typedef BOOL (WINAPI * SetMenuItemInfoA_Proc) ( IN LPCMENUITEMINFOA); typedef int (WINAPI * MessageBoxW_Proc) ( IN HWND window, - IN WCHAR *text, - IN WCHAR *caption, + IN const WCHAR *text, + IN const WCHAR *caption, IN UINT type); #ifdef NTGUI_UNICODE @@ -629,7 +629,7 @@ w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, { /* Create a new pane. */ Lisp_Object pane_name, prefix; - char *pane_string; + const char *pane_string; pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); @@ -1145,7 +1145,8 @@ simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header) /* Use Unicode if possible, so any language can be displayed. */ if (unicode_message_box) { - WCHAR *text, *title; + WCHAR *text; + const WCHAR *title; USE_SAFE_ALLOCA; if (STRINGP (temp)) @@ -1180,7 +1181,7 @@ simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header) } else { - char *text, *title; + const char *text, *title; /* Fall back on ANSI message box, but at least use system encoding so questions representable by the system codepage diff --git a/src/w32term.c b/src/w32term.c index 0a8dbb39f7b..a66aca1e846 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6468,7 +6468,7 @@ static void w32_initialize (void) { HANDLE shell; - HRESULT (WINAPI * set_user_model) (wchar_t * id); + HRESULT (WINAPI * set_user_model) (const wchar_t * id); baud_rate = 19200; diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index fb3fbd0d607..bf1d903df0b 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -964,7 +964,7 @@ font_table_error: struct font_driver uniscribe_font_driver = { - 0, /* Quniscribe */ + LISP_INITIALLY_ZERO, /* Quniscribe */ 0, /* case insensitive */ w32font_get_cache, uniscribe_list,