aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-05-21 20:06:33 +0300
committerEli Zaretskii2016-05-21 20:06:33 +0300
commitcb5af79249c2c9e21405e6237db11935b50dd1c5 (patch)
tree1f2abf3854f399b16861afaeca9648554b906421 /src
parent99848b37d2c3e14c0af45fc6da437a806aa58a80 (diff)
downloademacs-cb5af79249c2c9e21405e6237db11935b50dd1c5.tar.gz
emacs-cb5af79249c2c9e21405e6237db11935b50dd1c5.zip
Fix compiler warnings in the MinGW build
* configure.ac [mingw32]: Don't add -Wpointer-sign, and add -Wno-pointer-sign, to keep the noise level down. * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable -Wredundant-decls, as that produces a lot of noise due to redeclaration of time-related functions by gnulib. * nt/runemacs.c (set_user_model_id): Fix argument type of 'SetCurrentProcessExplicitAppUserModelID'. * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't declare 'dpyinfo', as it is unused. (xpm_load): Fix warnings about pointer signedness. * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant prototypes. (sys_spawnve): Avoid warnings about discarding 'const' qualifier. (sys_select): Provide prototype. (g_b_init_compare_string_w): Move declaration to file scope. * src/w32heap.c (dumped_data_commit): Now static. (FREEABLE_P): Avoid warnings about pointer comparison with integer. (mmap_realloc): Cast to 'char *' for arithmetics on void pointers. * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr) (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear): Provide prototypes. * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove redundant prototypes. (w32_get_internal_run_time, map_w32_filename): Provide prototype. (init_environment, sys_ctime): Avoid warnings about discarding 'const' qualifier. Include utimens.h. (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir) (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock) (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide prototypes. (sys_rename_replace): Use %d to avoid compiler warnings. (_wsa_errlist): Make the message text 'const char *', to avoid compilation warnings. (dynlib_reset_last_error): Move prototype to file scope. (w32_get_resource): First argument is now 'const char *'. * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype. (otf_features): Second argument is no 'const char *'. * src/w32term.c (free_frame_menubar, x_wm_set_size_hint) (x_set_window_size): Remove redundant prototypes. (XChangeGC, XGetGCValues, w32_draw_underwave) (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave) (x_calc_absolute_position, x_destroy_window): Now static. (menubar_selection_callback): Move prototype to file scope. * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant declaration. (w32_to_x_charset): Fix warnings about discarding 'const' qualifier. (w32font_full_name): Fix warnings about implicit conversion of 'float' to 'double'. * src/w32reg.c (w32_get_rdb_resource): Fix warnings about discarding 'const' qualifier. * src/w32menu.c (syms_of_w32menu, globals_of_w32menu) (set_frame_menubar): Remove redundant prototypes. (menubar_selection_callback, w32_menu_display_help): Provide prototypes. (simple_dialog_show): Avoid warnings about discarding 'const' qualifier. * src/w32fns.c (syms_of_w32fns, globals_of_w32fns) (free_frame_menubar, w32_strerror, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): Remove redundant prototypes. (current_popup_menu): Remove redundant declaration. (colormap_t): Member 'name' is now 'const char *'. (add_system_logical_colors_to_map): Fix signed/unsigned warnings. (x_decode_color, x_set_border_pixel) (x_clear_under_internal_border, x_set_name, hook_w32_key) (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now static. (w32_load_cursor, w32_key_to_modifier, map_keypad_keys) (w32_msg_worker, w32_last_error): Provide prototypes. (funhook, lookup_vk_code): Avoid warnings about missing parentheses. (x_default_font_parameter, Fw32_notification_notify): Avoid warnings about discarding 'const' qualifier. (Fx_create_frame): Avoid warnings about empty body of 'else'. (x_screen_planes): Ifdef away unused function. (Fx_show_tip): Remove unused variables. (Fw32_battery_status): Avoid warnings about implicit promotion from float to double. (Fw32_notification_notify): Initialize 'timeout'. * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only define the TIMER_SETTIME_RUNNING value if it will be used. * src/w32notify.c (send_notifications): Ifdef away an empty if clause. Remove unused variable. (watch_end, watch_completion): Provide prototypes. * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused. * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix warning with pointer signedness. * src/gnutls.c (gnutls_x509_crt_get_signature) (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and don't load them from the GnuTLS library, as they are no longer used. * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't define, as it's unused. * src/unexw32.c (open_input_file, open_output_file) (close_file_data): Remove redundant prototypes. (_start): provide prototype. (mainCRTStartup): Move prototype to file level. (find_section): Use type-cast to shut up compiler warnings. (offset_to_section, relocate_offset): Now static. (find_section): First argument is now a 'const char *'. (offset_to_section): Ifdef away, as it's unused. * src/w32heap.h (find_section): Adjust prototype. * src/dynlib.c (dynlib_reset_last_error): Provide prototype. * src/dired.c (directory_files_internal_w32_unwind): Avoid warnings about missing prototypes. (is_slow_fs) [WINDOWSNT]: Provide prototype at file level. (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer signedness. * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]: Fix warnings about pointer signedness. * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's unused. * src/sysdep.c (_getpid): Remove redundant prototype. (sys_subshell) [DOS_NT]: Don't define 'status', it's unused. [!MSDOS]: Don't define 'st', it's unused. (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused. (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness. * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define n_to_read, as it is not used. (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused. * src/w32font.h (syms_of_w32font): Remove redundant prototype. * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro. * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are not used by DOS_NT builds, to avoid compiler warnings. * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant declaration. * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * src/w32term.h (x_set_window_size, x_get_focus_frame) (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame) (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon) (x_free_frame_resources, x_real_positions) (display_x_get_resource): Remove redundant prototypes. * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp) (sys_rename, gettimeofday): Provide prototypes. * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant declarations. * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'. (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname) (close_winsock, initialize_sockets, w32_set_user_model_id) (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add prototypes. (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness difference. (w32_set_user_model_id): Update prototype of SetCurrentProcessExplicitAppUserModelID to avoid compiler warnings. (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c4
-rw-r--r--src/dired.c10
-rw-r--r--src/dispnew.c2
-rw-r--r--src/dynlib.c1
-rw-r--r--src/fileio.c4
-rw-r--r--src/filelock.c2
-rw-r--r--src/gnutls.c7
-rw-r--r--src/image.c8
-rw-r--r--src/keyboard.c7
-rw-r--r--src/menu.c1
-rw-r--r--src/process.c1
-rw-r--r--src/profiler.c7
-rw-r--r--src/sound.c2
-rw-r--r--src/sysdep.c12
-rw-r--r--src/term.c8
-rw-r--r--src/unexw32.c33
-rw-r--r--src/w32.c51
-rw-r--r--src/w32.h2
-rw-r--r--src/w32console.c22
-rw-r--r--src/w32fns.c78
-rw-r--r--src/w32font.c5
-rw-r--r--src/w32font.h1
-rw-r--r--src/w32heap.c12
-rw-r--r--src/w32heap.h4
-rw-r--r--src/w32menu.c10
-rw-r--r--src/w32notify.c7
-rw-r--r--src/w32proc.c13
-rw-r--r--src/w32reg.c4
-rw-r--r--src/w32select.c1
-rw-r--r--src/w32term.c28
-rw-r--r--src/w32term.h18
-rw-r--r--src/w32uniscribe.c6
-rw-r--r--src/xfaces.c1
33 files changed, 208 insertions, 164 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 3a40626de48..07297820cac 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1295,7 +1295,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1295 1295
1296#ifdef WINDOWSNT 1296#ifdef WINDOWSNT
1297 prepare_standard_handles (in, out, err, handles); 1297 prepare_standard_handles (in, out, err, handles);
1298 set_process_dir (SDATA (current_dir)); 1298 set_process_dir (SSDATA (current_dir));
1299 /* Spawn the child. (See w32proc.c:sys_spawnve). */ 1299 /* Spawn the child. (See w32proc.c:sys_spawnve). */
1300 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); 1300 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
1301 reset_standard_handles (in, out, err, handles); 1301 reset_standard_handles (in, out, err, handles);
@@ -1342,7 +1342,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
1342 && SBYTES (entry) >= varlen 1342 && SBYTES (entry) >= varlen
1343#ifdef WINDOWSNT 1343#ifdef WINDOWSNT
1344 /* NT environment variables are case insensitive. */ 1344 /* NT environment variables are case insensitive. */
1345 && ! strnicmp (SDATA (entry), var, varlen) 1345 && ! strnicmp (SSDATA (entry), var, varlen)
1346#else /* not WINDOWSNT */ 1346#else /* not WINDOWSNT */
1347 && ! memcmp (SDATA (entry), var, varlen) 1347 && ! memcmp (SDATA (entry), var, varlen)
1348#endif /* not WINDOWSNT */ 1348#endif /* not WINDOWSNT */
diff --git a/src/dired.c b/src/dired.c
index 5d0e327ee7b..2dffbb756ac 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -47,6 +47,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47#include "msdos.h" /* for fstatat */ 47#include "msdos.h" /* for fstatat */
48#endif 48#endif
49 49
50#ifdef WINDOWSNT
51extern int is_slow_fs (const char *);
52#endif
53
50static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); 54static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
51static Lisp_Object file_attributes (int, char const *, Lisp_Object); 55static Lisp_Object file_attributes (int, char const *, Lisp_Object);
52 56
@@ -98,7 +102,7 @@ open_directory (Lisp_Object dirname, int *fdp)
98} 102}
99 103
100#ifdef WINDOWSNT 104#ifdef WINDOWSNT
101void 105static void
102directory_files_internal_w32_unwind (Lisp_Object arg) 106directory_files_internal_w32_unwind (Lisp_Object arg)
103{ 107{
104 Vw32_get_true_file_attributes = arg; 108 Vw32_get_true_file_attributes = arg;
@@ -206,8 +210,6 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
206#ifdef WINDOWSNT 210#ifdef WINDOWSNT
207 if (attrs) 211 if (attrs)
208 { 212 {
209 extern int is_slow_fs (const char *);
210
211 /* Do this only once to avoid doing it (in w32.c:stat) for each 213 /* Do this only once to avoid doing it (in w32.c:stat) for each
212 file in the directory, when we call Ffile_attributes below. */ 214 file in the directory, when we call Ffile_attributes below. */
213 record_unwind_protect (directory_files_internal_w32_unwind, 215 record_unwind_protect (directory_files_internal_w32_unwind,
@@ -217,7 +219,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
217 { 219 {
218 /* w32.c:stat will notice these bindings and avoid calling 220 /* w32.c:stat will notice these bindings and avoid calling
219 GetDriveType for each file. */ 221 GetDriveType for each file. */
220 if (is_slow_fs (SDATA (dirfilename))) 222 if (is_slow_fs (SSDATA (dirfilename)))
221 Vw32_get_true_file_attributes = Qnil; 223 Vw32_get_true_file_attributes = Qnil;
222 else 224 else
223 Vw32_get_true_file_attributes = Qt; 225 Vw32_get_true_file_attributes = Qt;
diff --git a/src/dispnew.c b/src/dispnew.c
index 4cc908a3c2a..82d0b76a95f 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6042,7 +6042,7 @@ init_display (void)
6042 fatal ("standard input is not a tty"); 6042 fatal ("standard input is not a tty");
6043 6043
6044#ifdef WINDOWSNT 6044#ifdef WINDOWSNT
6045 terminal_type = "w32console"; 6045 terminal_type = (char *)"w32console";
6046#else 6046#else
6047 terminal_type = getenv ("TERM"); 6047 terminal_type = getenv ("TERM");
6048#endif 6048#endif
diff --git a/src/dynlib.c b/src/dynlib.c
index 64f688ca800..ada58373801 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -52,6 +52,7 @@ typedef BOOL (WINAPI *GetModuleHandleExA_Proc) (DWORD,LPCSTR,HMODULE*);
52 52
53/* This needs to be called at startup to countermand any non-zero 53/* This needs to be called at startup to countermand any non-zero
54 values recorded by temacs. */ 54 values recorded by temacs. */
55void dynlib_reset_last_error (void);
55void 56void
56dynlib_reset_last_error (void) 57dynlib_reset_last_error (void)
57{ 58{
diff --git a/src/fileio.c b/src/fileio.c
index d9318083ce0..9da0bf0234b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2542,7 +2542,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
2542 /* The read-only attribute of the parent directory doesn't affect 2542 /* The read-only attribute of the parent directory doesn't affect
2543 whether a file or directory can be created within it. Some day we 2543 whether a file or directory can be created within it. Some day we
2544 should check ACLs though, which do affect this. */ 2544 should check ACLs though, which do affect this. */
2545 return file_directory_p (SDATA (dir)) ? Qt : Qnil; 2545 return file_directory_p (SSDATA (dir)) ? Qt : Qnil;
2546#else 2546#else
2547 return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil; 2547 return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil;
2548#endif 2548#endif
@@ -2773,7 +2773,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2773 2773
2774 /* Tell stat to use expensive method to get accurate info. */ 2774 /* Tell stat to use expensive method to get accurate info. */
2775 Vw32_get_true_file_attributes = Qt; 2775 Vw32_get_true_file_attributes = Qt;
2776 result = stat (SDATA (absname), &st); 2776 result = stat (SSDATA (absname), &st);
2777 Vw32_get_true_file_attributes = tem; 2777 Vw32_get_true_file_attributes = tem;
2778 2778
2779 if (result < 0) 2779 if (result < 0)
diff --git a/src/filelock.c b/src/filelock.c
index 62017188b33..2f92e0fdc83 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -65,7 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65#define BOOT_TIME_FILE "/var/run/random-seed" 65#define BOOT_TIME_FILE "/var/run/random-seed"
66#endif 66#endif
67 67
68#ifndef WTMP_FILE 68#if !defined WTMP_FILE && !defined WINDOWSNT
69#define WTMP_FILE "/var/log/wtmp" 69#define WTMP_FILE "/var/log/wtmp"
70#endif 70#endif
71 71
diff --git a/src/gnutls.c b/src/gnutls.c
index c7efbcc7cc9..8ee066f46b5 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -55,7 +55,6 @@ DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get,
55 (gnutls_session_t)); 55 (gnutls_session_t));
56DEF_DLL_FN (const char *, gnutls_alert_get_name, 56DEF_DLL_FN (const char *, gnutls_alert_get_name,
57 (gnutls_alert_description_t)); 57 (gnutls_alert_description_t));
58DEF_DLL_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int));
59DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials, 58DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials,
60 (gnutls_anon_client_credentials_t *)); 59 (gnutls_anon_client_credentials_t *));
61DEF_DLL_FN (void, gnutls_anon_free_client_credentials, 60DEF_DLL_FN (void, gnutls_anon_free_client_credentials,
@@ -156,8 +155,6 @@ DEF_DLL_FN (int, gnutls_x509_crt_get_subject_unique_id,
156 (gnutls_x509_crt_t, char *, size_t *)); 155 (gnutls_x509_crt_t, char *, size_t *));
157DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm, 156DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm,
158 (gnutls_x509_crt_t)); 157 (gnutls_x509_crt_t));
159DEF_DLL_FN (int, gnutls_x509_crt_get_signature,
160 (gnutls_x509_crt_t, char *, size_t *));
161DEF_DLL_FN (int, gnutls_x509_crt_get_key_id, 158DEF_DLL_FN (int, gnutls_x509_crt_get_key_id,
162 (gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size)); 159 (gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size));
163DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t)); 160DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t));
@@ -192,7 +189,6 @@ init_gnutls_functions (void)
192 189
193 LOAD_DLL_FN (library, gnutls_alert_get); 190 LOAD_DLL_FN (library, gnutls_alert_get);
194 LOAD_DLL_FN (library, gnutls_alert_get_name); 191 LOAD_DLL_FN (library, gnutls_alert_get_name);
195 LOAD_DLL_FN (library, gnutls_alert_send_appropriate);
196 LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials); 192 LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials);
197 LOAD_DLL_FN (library, gnutls_anon_free_client_credentials); 193 LOAD_DLL_FN (library, gnutls_anon_free_client_credentials);
198 LOAD_DLL_FN (library, gnutls_bye); 194 LOAD_DLL_FN (library, gnutls_bye);
@@ -255,7 +251,6 @@ init_gnutls_functions (void)
255 LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id); 251 LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id);
256 LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id); 252 LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id);
257 LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm); 253 LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm);
258 LOAD_DLL_FN (library, gnutls_x509_crt_get_signature);
259 LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id); 254 LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id);
260 LOAD_DLL_FN (library, gnutls_sec_param_get_name); 255 LOAD_DLL_FN (library, gnutls_sec_param_get_name);
261 LOAD_DLL_FN (library, gnutls_sign_get_name); 256 LOAD_DLL_FN (library, gnutls_sign_get_name);
@@ -282,7 +277,6 @@ init_gnutls_functions (void)
282 277
283# define gnutls_alert_get fn_gnutls_alert_get 278# define gnutls_alert_get fn_gnutls_alert_get
284# define gnutls_alert_get_name fn_gnutls_alert_get_name 279# define gnutls_alert_get_name fn_gnutls_alert_get_name
285# define gnutls_alert_send_appropriate fn_gnutls_alert_send_appropriate
286# define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials 280# define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials
287# define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials 281# define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials
288# define gnutls_bye fn_gnutls_bye 282# define gnutls_bye fn_gnutls_bye
@@ -343,7 +337,6 @@ init_gnutls_functions (void)
343# define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id 337# define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id
344# define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm 338# define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm
345# define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial 339# define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial
346# define gnutls_x509_crt_get_signature fn_gnutls_x509_crt_get_signature
347# define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm 340# define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm
348# define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id 341# define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id
349# define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version 342# define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version
diff --git a/src/image.c b/src/image.c
index 22bbc35fcfb..c1f25aa2357 100644
--- a/src/image.c
+++ b/src/image.c
@@ -270,12 +270,12 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
270ptrdiff_t 270ptrdiff_t
271x_create_bitmap_from_file (struct frame *f, Lisp_Object file) 271x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
272{ 272{
273 Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
274
275#ifdef HAVE_NTGUI 273#ifdef HAVE_NTGUI
276 return -1; /* W32_TODO : bitmap support */ 274 return -1; /* W32_TODO : bitmap support */
277#endif /* HAVE_NTGUI */ 275#endif /* HAVE_NTGUI */
278 276
277 Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
278
279#ifdef HAVE_NS 279#ifdef HAVE_NS
280 ptrdiff_t id; 280 ptrdiff_t id;
281 void *bitmap = ns_image_from_file (file); 281 void *bitmap = ns_image_from_file (file);
@@ -3677,7 +3677,7 @@ xpm_load (struct frame *f, struct image *img)
3677#endif 3677#endif
3678 /* XpmReadFileToPixmap is not available in the Windows port of 3678 /* XpmReadFileToPixmap is not available in the Windows port of
3679 libxpm. But XpmReadFileToImage almost does what we want. */ 3679 libxpm. But XpmReadFileToImage almost does what we want. */
3680 rc = XpmReadFileToImage (&hdc, SDATA (file), 3680 rc = XpmReadFileToImage (&hdc, SSDATA (file),
3681 &xpm_image, &xpm_mask, 3681 &xpm_image, &xpm_mask,
3682 &attrs); 3682 &attrs);
3683#else 3683#else
@@ -3701,7 +3701,7 @@ xpm_load (struct frame *f, struct image *img)
3701#ifdef HAVE_NTGUI 3701#ifdef HAVE_NTGUI
3702 /* XpmCreatePixmapFromBuffer is not available in the Windows port 3702 /* XpmCreatePixmapFromBuffer is not available in the Windows port
3703 of libxpm. But XpmCreateImageFromBuffer almost does what we want. */ 3703 of libxpm. But XpmCreateImageFromBuffer almost does what we want. */
3704 rc = XpmCreateImageFromBuffer (&hdc, SDATA (buffer), 3704 rc = XpmCreateImageFromBuffer (&hdc, SSDATA (buffer),
3705 &xpm_image, &xpm_mask, 3705 &xpm_image, &xpm_mask,
3706 &attrs); 3706 &attrs);
3707#else 3707#else
diff --git a/src/keyboard.c b/src/keyboard.c
index ef2e2788bf3..2b5d514cc40 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2193,8 +2193,8 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
2193 Lisp_Object prev_event, 2193 Lisp_Object prev_event,
2194 bool *used_mouse_menu) 2194 bool *used_mouse_menu)
2195{ 2195{
2196#define MAX_ENCODED_BYTES 16
2197#ifndef WINDOWSNT 2196#ifndef WINDOWSNT
2197#define MAX_ENCODED_BYTES 16
2198 Lisp_Object events[MAX_ENCODED_BYTES]; 2198 Lisp_Object events[MAX_ENCODED_BYTES];
2199 int n = 0; 2199 int n = 0;
2200#endif 2200#endif
@@ -6898,7 +6898,10 @@ tty_read_avail_input (struct terminal *terminal,
6898 the kbd_buffer can really hold. That may prevent loss 6898 the kbd_buffer can really hold. That may prevent loss
6899 of characters on some systems when input is stuffed at us. */ 6899 of characters on some systems when input is stuffed at us. */
6900 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; 6900 unsigned char cbuf[KBD_BUFFER_SIZE - 1];
6901 int n_to_read, i; 6901#ifndef WINDOWSNT
6902 int n_to_read;
6903#endif
6904 int i;
6902 struct tty_display_info *tty = terminal->display_info.tty; 6905 struct tty_display_info *tty = terminal->display_info.tty;
6903 int nread = 0; 6906 int nread = 0;
6904#ifdef subprocesses 6907#ifdef subprocesses
diff --git a/src/menu.c b/src/menu.c
index 737f2b55e8b..e3d943e109f 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -47,7 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47# else /* !NTGUI_UNICODE */ 47# else /* !NTGUI_UNICODE */
48extern AppendMenuW_Proc unicode_append_menu; 48extern AppendMenuW_Proc unicode_append_menu;
49# endif /* NTGUI_UNICODE */ 49# endif /* NTGUI_UNICODE */
50extern HMENU current_popup_menu;
51#endif /* HAVE_NTGUI */ 50#endif /* HAVE_NTGUI */
52 51
53#include "menu.h" 52#include "menu.h"
diff --git a/src/process.c b/src/process.c
index 3e5b83d27dc..4bb3f0b9d6d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -316,7 +316,6 @@ static struct sockaddr_and_len {
316 XPROCESS (proc)->infd >= 0 && \ 316 XPROCESS (proc)->infd >= 0 && \
317 datagram_address[XPROCESS (proc)->infd].sa != 0) 317 datagram_address[XPROCESS (proc)->infd].sa != 0)
318#else 318#else
319#define DATAGRAM_CHAN_P(chan) (0)
320#define DATAGRAM_CONN_P(proc) (0) 319#define DATAGRAM_CONN_P(proc) (0)
321#endif 320#endif
322 321
diff --git a/src/profiler.c b/src/profiler.c
index 844c1f21ca8..07e21aeab10 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -201,7 +201,12 @@ static bool profiler_timer_ok;
201 201
202/* Status of sampling profiler. */ 202/* Status of sampling profiler. */
203static enum profiler_cpu_running 203static enum profiler_cpu_running
204 { NOT_RUNNING, TIMER_SETTIME_RUNNING, SETITIMER_RUNNING } 204 { NOT_RUNNING,
205#ifdef HAVE_ITIMERSPEC
206 TIMER_SETTIME_RUNNING,
207#endif
208 SETITIMER_RUNNING
209 }
205 profiler_cpu_running; 210 profiler_cpu_running;
206 211
207/* Hash-table log of CPU profiler. */ 212/* Hash-table log of CPU profiler. */
diff --git a/src/sound.c b/src/sound.c
index b9a794b6a42..8671d4a6885 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -316,6 +316,7 @@ sound_perror (const char *msg)
316} 316}
317 317
318 318
319#ifndef WINDOWSNT
319/* Display a warning message. */ 320/* Display a warning message. */
320 321
321static void 322static void
@@ -323,6 +324,7 @@ sound_warning (const char *msg)
323{ 324{
324 message1 (msg); 325 message1 (msg);
325} 326}
327#endif /* !WINDOWSNT */
326 328
327 329
328/* Parse sound specification SOUND, and fill ATTRS with what is 330/* Parse sound specification SOUND, and fill ATTRS with what is
diff --git a/src/sysdep.c b/src/sysdep.c
index 53affbf3dbf..a99c2080032 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -107,7 +107,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
107/* In process.h which conflicts with the local copy. */ 107/* In process.h which conflicts with the local copy. */
108#define _P_WAIT 0 108#define _P_WAIT 0
109int _cdecl _spawnlp (int, const char *, const char *, ...); 109int _cdecl _spawnlp (int, const char *, const char *, ...);
110int _cdecl _getpid (void);
111/* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and 110/* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and
112 several prototypes of functions called below. */ 111 several prototypes of functions called below. */
113#include <sys/socket.h> 112#include <sys/socket.h>
@@ -507,15 +506,16 @@ void
507sys_subshell (void) 506sys_subshell (void)
508{ 507{
509#ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */ 508#ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */
510 int st;
511#ifdef MSDOS 509#ifdef MSDOS
510 int st;
512 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ 511 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
513#else 512#else
514 char oldwd[MAX_UTF8_PATH]; 513 char oldwd[MAX_UTF8_PATH];
515#endif 514#endif /* MSDOS */
515#else /* !DOS_NT */
516 int status;
516#endif 517#endif
517 pid_t pid; 518 pid_t pid;
518 int status;
519 struct save_signal saved_handlers[5]; 519 struct save_signal saved_handlers[5];
520 char *str = SSDATA (encode_current_directory ()); 520 char *str = SSDATA (encode_current_directory ());
521 521
@@ -938,7 +938,9 @@ void
938init_sys_modes (struct tty_display_info *tty_out) 938init_sys_modes (struct tty_display_info *tty_out)
939{ 939{
940 struct emacs_tty tty; 940 struct emacs_tty tty;
941#ifndef DOS_NT
941 Lisp_Object terminal; 942 Lisp_Object terminal;
943#endif
942 944
943 Vtty_erase_char = Qnil; 945 Vtty_erase_char = Qnil;
944 946
@@ -3915,7 +3917,7 @@ str_collate (Lisp_Object s1, Lisp_Object s2,
3915 int res, err = errno; 3917 int res, err = errno;
3916 3918
3917 errno = 0; 3919 errno = 0;
3918 res = w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP (ignore_case)); 3920 res = w32_compare_strings (SSDATA (s1), SSDATA (s2), loc, !NILP (ignore_case));
3919 if (errno) 3921 if (errno)
3920 error ("Invalid string for collation: %s", strerror (errno)); 3922 error ("Invalid string for collation: %s", strerror (errno));
3921 3923
diff --git a/src/term.c b/src/term.c
index 07cc3a955f3..df583cb1502 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3913,13 +3913,15 @@ dissociate_if_controlling_tty (int fd)
3913struct terminal * 3913struct terminal *
3914init_tty (const char *name, const char *terminal_type, bool must_succeed) 3914init_tty (const char *name, const char *terminal_type, bool must_succeed)
3915{ 3915{
3916 struct tty_display_info *tty = NULL;
3917 struct terminal *terminal = NULL;
3918#ifndef DOS_NT
3916 char *area; 3919 char *area;
3917 char **address = &area; 3920 char **address = &area;
3918 int status; 3921 int status;
3919 struct tty_display_info *tty = NULL;
3920 struct terminal *terminal = NULL;
3921 sigset_t oldset; 3922 sigset_t oldset;
3922 bool ctty = false; /* True if asked to open controlling tty. */ 3923 bool ctty = false; /* True if asked to open controlling tty. */
3924#endif
3923 3925
3924 if (!terminal_type) 3926 if (!terminal_type)
3925 maybe_fatal (must_succeed, 0, 3927 maybe_fatal (must_succeed, 0,
@@ -3928,8 +3930,10 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
3928 3930
3929 if (name == NULL) 3931 if (name == NULL)
3930 name = DEV_TTY; 3932 name = DEV_TTY;
3933#ifndef DOS_NT
3931 if (!strcmp (name, DEV_TTY)) 3934 if (!strcmp (name, DEV_TTY))
3932 ctty = 1; 3935 ctty = 1;
3936#endif
3933 3937
3934 /* If we already have a terminal on the given device, use that. If 3938 /* If we already have a terminal on the given device, use that. If
3935 all such terminals are suspended, create a new one instead. */ 3939 all such terminals are suspended, create a new one instead. */
diff --git a/src/unexw32.c b/src/unexw32.c
index 15aa7263bf8..f4183dc976f 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -50,10 +50,6 @@ extern char *my_begbss_static;
50/* Basically, our "initialized" flag. */ 50/* Basically, our "initialized" flag. */
51BOOL using_dynamic_heap = FALSE; 51BOOL using_dynamic_heap = FALSE;
52 52
53int open_input_file (file_data *p_file, char *name);
54int open_output_file (file_data *p_file, char *name, unsigned long size);
55void close_file_data (file_data *p_file);
56
57void get_section_info (file_data *p_file); 53void get_section_info (file_data *p_file);
58void copy_executable_and_dump_data (file_data *, file_data *); 54void copy_executable_and_dump_data (file_data *, file_data *);
59void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile); 55void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile);
@@ -81,14 +77,17 @@ DWORD_PTR extra_bss_size_static = 0;
81#define _start __start 77#define _start __start
82#endif 78#endif
83 79
80extern void mainCRTStartup (void);
81
84/* Startup code for running on NT. When we are running as the dumped 82/* Startup code for running on NT. When we are running as the dumped
85 version, we need to bootstrap our heap and .bss section into our 83 version, we need to bootstrap our heap and .bss section into our
86 address space before we can actually hand off control to the startup 84 address space before we can actually hand off control to the startup
87 code supplied by NT (primarily because that code relies upon malloc ()). */ 85 code supplied by NT (primarily because that code relies upon malloc ()). */
86void _start (void);
87
88void 88void
89_start (void) 89_start (void)
90{ 90{
91 extern void mainCRTStartup (void);
92 91
93#if 1 92#if 1
94 /* Give us a way to debug problems with crashes on startup when 93 /* Give us a way to debug problems with crashes on startup when
@@ -205,7 +204,7 @@ close_file_data (file_data *p_file)
205 204
206/* Return pointer to section header for named section. */ 205/* Return pointer to section header for named section. */
207IMAGE_SECTION_HEADER * 206IMAGE_SECTION_HEADER *
208find_section (char * name, IMAGE_NT_HEADERS * nt_header) 207find_section (const char * name, IMAGE_NT_HEADERS * nt_header)
209{ 208{
210 PIMAGE_SECTION_HEADER section; 209 PIMAGE_SECTION_HEADER section;
211 int i; 210 int i;
@@ -214,7 +213,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header)
214 213
215 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) 214 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
216 { 215 {
217 if (strcmp (section->Name, name) == 0) 216 if (strcmp ((char *)section->Name, name) == 0)
218 return section; 217 return section;
219 section++; 218 section++;
220 } 219 }
@@ -249,9 +248,10 @@ rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
249 return NULL; 248 return NULL;
250} 249}
251 250
251#if 0 /* unused */
252/* Return pointer to section header for section containing the given 252/* Return pointer to section header for section containing the given
253 offset in its raw data area. */ 253 offset in its raw data area. */
254IMAGE_SECTION_HEADER * 254static IMAGE_SECTION_HEADER *
255offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header) 255offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
256{ 256{
257 PIMAGE_SECTION_HEADER section; 257 PIMAGE_SECTION_HEADER section;
@@ -268,11 +268,12 @@ offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
268 } 268 }
269 return NULL; 269 return NULL;
270} 270}
271#endif
271 272
272/* Return offset to an object in dst, given offset in src. We assume 273/* Return offset to an object in dst, given offset in src. We assume
273 there is at least one section in both src and dst images, and that 274 there is at least one section in both src and dst images, and that
274 the some sections may have been added to dst (after sections in src). */ 275 the some sections may have been added to dst (after sections in src). */
275DWORD_PTR 276static DWORD_PTR
276relocate_offset (DWORD_PTR offset, 277relocate_offset (DWORD_PTR offset,
277 IMAGE_NT_HEADERS * src_nt_header, 278 IMAGE_NT_HEADERS * src_nt_header,
278 IMAGE_NT_HEADERS * dst_nt_header) 279 IMAGE_NT_HEADERS * dst_nt_header)
@@ -306,9 +307,6 @@ relocate_offset (DWORD_PTR offset,
306 (dst_section->PointerToRawData - src_section->PointerToRawData); 307 (dst_section->PointerToRawData - src_section->PointerToRawData);
307} 308}
308 309
309#define OFFSET_TO_RVA(offset, section) \
310 ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
311
312#define RVA_TO_OFFSET(rva, section) \ 310#define RVA_TO_OFFSET(rva, section) \
313 ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress)) 311 ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress))
314 312
@@ -318,15 +316,20 @@ relocate_offset (DWORD_PTR offset,
318/* Convert address in executing image to RVA. */ 316/* Convert address in executing image to RVA. */
319#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) 317#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
320 318
321#define RVA_TO_PTR(var,section,filedata) \
322 ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
323
324#define PTR_TO_OFFSET(ptr, pfile_data) \ 319#define PTR_TO_OFFSET(ptr, pfile_data) \
325 ((unsigned char *)(ptr) - (pfile_data)->file_base) 320 ((unsigned char *)(ptr) - (pfile_data)->file_base)
326 321
327#define OFFSET_TO_PTR(offset, pfile_data) \ 322#define OFFSET_TO_PTR(offset, pfile_data) \
328 ((pfile_data)->file_base + (DWORD_PTR)(offset)) 323 ((pfile_data)->file_base + (DWORD_PTR)(offset))
329 324
325#if 0 /* unused */
326#define OFFSET_TO_RVA(offset, section) \
327 ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
328
329#define RVA_TO_PTR(var,section,filedata) \
330 ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
331#endif
332
330 333
331/* Flip through the executable and cache the info necessary for dumping. */ 334/* Flip through the executable and cache the info necessary for dumping. */
332void 335void
diff --git a/src/w32.c b/src/w32.c
index 94aa7d891d5..442ce79b23c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -66,6 +66,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
66 66
67#undef localtime 67#undef localtime
68 68
69char *sys_ctime (const time_t *);
70int sys_chdir (const char *);
71int sys_creat (const char *, int);
72FILE *sys_fopen (const char *, const char *);
73int sys_mkdir (const char *);
74int sys_open (const char *, int, int);
75int sys_rename (char const *, char const *);
76int sys_rmdir (const char *);
77int sys_close (int);
78int sys_dup2 (int, int);
79int sys_read (int, char *, unsigned int);
80int sys_write (int, const void *, unsigned int);
81struct tm *sys_localtime (const time_t *);
82
83#ifdef HAVE_MODULES
84extern void dynlib_reset_last_error (void);
85#endif
86
69#include "lisp.h" 87#include "lisp.h"
70#include "epaths.h" /* for PATH_EXEC */ 88#include "epaths.h" /* for PATH_EXEC */
71 89
@@ -227,6 +245,7 @@ typedef struct _REPARSE_DATA_BUFFER {
227#include <wincrypt.h> 245#include <wincrypt.h>
228 246
229#include <c-strcase.h> 247#include <c-strcase.h>
248#include <utimens.h> /* for fdutimens */
230 249
231#include "w32.h" 250#include "w32.h"
232#include <dirent.h> 251#include <dirent.h>
@@ -246,7 +265,6 @@ typedef struct _REPARSE_DATA_BUFFER {
246typedef HRESULT (WINAPI * ShGetFolderPath_fn) 265typedef HRESULT (WINAPI * ShGetFolderPath_fn)
247 (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *); 266 (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
248 267
249void globals_of_w32 (void);
250static DWORD get_rid (PSID); 268static DWORD get_rid (PSID);
251static int is_symlink (const char *); 269static int is_symlink (const char *);
252static char * chase_symlinks (const char *); 270static char * chase_symlinks (const char *);
@@ -512,6 +530,8 @@ static Lisp_Object ltime (ULONGLONG);
512/* Get total user and system times for get-internal-run-time. 530/* Get total user and system times for get-internal-run-time.
513 Returns a list of integers if the times are provided by the OS 531 Returns a list of integers if the times are provided by the OS
514 (NT derivatives), otherwise it returns the result of current-time. */ 532 (NT derivatives), otherwise it returns the result of current-time. */
533Lisp_Object w32_get_internal_run_time (void);
534
515Lisp_Object 535Lisp_Object
516w32_get_internal_run_time (void) 536w32_get_internal_run_time (void)
517{ 537{
@@ -2491,7 +2511,7 @@ sys_putenv (char *str)
2491#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 2511#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
2492 2512
2493LPBYTE 2513LPBYTE
2494w32_get_resource (char *key, LPDWORD lpdwtype) 2514w32_get_resource (const char *key, LPDWORD lpdwtype)
2495{ 2515{
2496 LPBYTE lpvalue; 2516 LPBYTE lpvalue;
2497 HKEY hrootkey = NULL; 2517 HKEY hrootkey = NULL;
@@ -2600,8 +2620,8 @@ init_environment (char ** argv)
2600 2620
2601 static const struct env_entry 2621 static const struct env_entry
2602 { 2622 {
2603 char * name; 2623 const char * name;
2604 char * def_value; 2624 const char * def_value;
2605 } dflt_envvars[] = 2625 } dflt_envvars[] =
2606 { 2626 {
2607 /* If the default value is NULL, we will use the value from the 2627 /* If the default value is NULL, we will use the value from the
@@ -2761,14 +2781,14 @@ init_environment (char ** argv)
2761 { 2781 {
2762 /* If not found in any directory, use the 2782 /* If not found in any directory, use the
2763 default as the last resort. */ 2783 default as the last resort. */
2764 lpval = env_vars[i].def_value; 2784 lpval = (char *)env_vars[i].def_value;
2765 dwType = REG_EXPAND_SZ; 2785 dwType = REG_EXPAND_SZ;
2766 } 2786 }
2767 } while (*pstart); 2787 } while (*pstart);
2768 } 2788 }
2769 else 2789 else
2770 { 2790 {
2771 lpval = env_vars[i].def_value; 2791 lpval = (char *)env_vars[i].def_value;
2772 dwType = REG_EXPAND_SZ; 2792 dwType = REG_EXPAND_SZ;
2773 } 2793 }
2774 if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata) 2794 if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
@@ -2786,7 +2806,7 @@ init_environment (char ** argv)
2786 if (dwType == REG_EXPAND_SZ) 2806 if (dwType == REG_EXPAND_SZ)
2787 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1)); 2807 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1));
2788 else if (dwType == REG_SZ) 2808 else if (dwType == REG_SZ)
2789 strcpy (buf1, lpval); 2809 strcpy (buf1, (char *)lpval);
2790 if (dwType == REG_EXPAND_SZ || dwType == REG_SZ) 2810 if (dwType == REG_EXPAND_SZ || dwType == REG_SZ)
2791 { 2811 {
2792 _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name, 2812 _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name,
@@ -2961,7 +2981,7 @@ char *
2961sys_ctime (const time_t *t) 2981sys_ctime (const time_t *t)
2962{ 2982{
2963 char *str = (char *) ctime (t); 2983 char *str = (char *) ctime (t);
2964 return (str ? str : "Sun Jan 01 00:00:00 1970"); 2984 return (str ? str : (char *)"Sun Jan 01 00:00:00 1970");
2965} 2985}
2966 2986
2967/* Emulate sleep...we could have done this with a define, but that 2987/* Emulate sleep...we could have done this with a define, but that
@@ -3225,6 +3245,8 @@ is_fat_volume (const char * name, const char ** pPath)
3225/* Convert all slashes in a filename to backslashes, and map filename 3245/* Convert all slashes in a filename to backslashes, and map filename
3226 to a valid 8.3 name if necessary. The result is a pointer to a 3246 to a valid 8.3 name if necessary. The result is a pointer to a
3227 static buffer, so CAVEAT EMPTOR! */ 3247 static buffer, so CAVEAT EMPTOR! */
3248const char *map_w32_filename (const char *, const char **);
3249
3228const char * 3250const char *
3229map_w32_filename (const char * name, const char ** pPath) 3251map_w32_filename (const char * name, const char ** pPath)
3230{ 3252{
@@ -4430,7 +4452,7 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force)
4430 { 4452 {
4431 /* Force temp name to require a manufactured 8.3 alias - this 4453 /* Force temp name to require a manufactured 8.3 alias - this
4432 seems to make the second rename work properly. */ 4454 seems to make the second rename work properly. */
4433 sprintf (p, "_.%s.%u", o, i); 4455 sprintf (p, "_.%s.%d", o, i);
4434 i++; 4456 i++;
4435 result = rename (oldname_a, temp_a); 4457 result = rename (oldname_a, temp_a);
4436 } 4458 }
@@ -4858,6 +4880,8 @@ get_file_owner_and_group (PSECURITY_DESCRIPTOR psd, struct stat *st)
4858} 4880}
4859 4881
4860/* Return non-zero if NAME is a potentially slow filesystem. */ 4882/* Return non-zero if NAME is a potentially slow filesystem. */
4883int is_slow_fs (const char *);
4884
4861int 4885int
4862is_slow_fs (const char *name) 4886is_slow_fs (const char *name)
4863{ 4887{
@@ -7215,6 +7239,8 @@ BOOL (WINAPI *pfn_SetHandleInformation) (HANDLE object, DWORD mask, DWORD flags)
7215HANDLE winsock_lib; 7239HANDLE winsock_lib;
7216static int winsock_inuse; 7240static int winsock_inuse;
7217 7241
7242BOOL term_winsock (void);
7243
7218BOOL 7244BOOL
7219term_winsock (void) 7245term_winsock (void)
7220{ 7246{
@@ -7372,7 +7398,7 @@ check_errno (void)
7372/* Extend strerror to handle the winsock-specific error codes. */ 7398/* Extend strerror to handle the winsock-specific error codes. */
7373struct { 7399struct {
7374 int errnum; 7400 int errnum;
7375 char * msg; 7401 const char * msg;
7376} _wsa_errlist[] = { 7402} _wsa_errlist[] = {
7377 {WSAEINTR , "Interrupted function call"}, 7403 {WSAEINTR , "Interrupted function call"},
7378 {WSAEBADF , "Bad file descriptor"}, 7404 {WSAEBADF , "Bad file descriptor"},
@@ -7456,7 +7482,7 @@ sys_strerror (int error_no)
7456 7482
7457 for (i = 0; _wsa_errlist[i].errnum >= 0; i++) 7483 for (i = 0; _wsa_errlist[i].errnum >= 0; i++)
7458 if (_wsa_errlist[i].errnum == error_no) 7484 if (_wsa_errlist[i].errnum == error_no)
7459 return _wsa_errlist[i].msg; 7485 return (char *)_wsa_errlist[i].msg;
7460 7486
7461 sprintf (unknown_msg, "Unidentified error: %d", error_no); 7487 sprintf (unknown_msg, "Unidentified error: %d", error_no);
7462 return unknown_msg; 7488 return unknown_msg;
@@ -8905,8 +8931,6 @@ sys_write (int fd, const void * buffer, unsigned int count)
8905 8931
8906/* Emulation of SIOCGIFCONF and getifaddrs, see process.c. */ 8932/* Emulation of SIOCGIFCONF and getifaddrs, see process.c. */
8907 8933
8908extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, ptrdiff_t);
8909
8910/* Return information about network interface IFNAME, or about all 8934/* Return information about network interface IFNAME, or about all
8911 interfaces (if IFNAME is nil). */ 8935 interfaces (if IFNAME is nil). */
8912static Lisp_Object 8936static Lisp_Object
@@ -9619,7 +9643,6 @@ globals_of_w32 (void)
9619 w32_unicode_filenames = 1; 9643 w32_unicode_filenames = 1;
9620 9644
9621#ifdef HAVE_MODULES 9645#ifdef HAVE_MODULES
9622 extern void dynlib_reset_last_error (void);
9623 dynlib_reset_last_error (); 9646 dynlib_reset_last_error ();
9624#endif 9647#endif
9625 9648
diff --git a/src/w32.h b/src/w32.h
index 42a1c423ce7..702bb5255cd 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -162,7 +162,7 @@ extern void reset_standard_handles (int in, int out,
162 int err, HANDLE handles[4]); 162 int err, HANDLE handles[4]);
163 163
164/* Return the string resource associated with KEY of type TYPE. */ 164/* Return the string resource associated with KEY of type TYPE. */
165extern LPBYTE w32_get_resource (char * key, LPDWORD type); 165extern LPBYTE w32_get_resource (const char * key, LPDWORD type);
166 166
167extern void release_listen_threads (void); 167extern void release_listen_threads (void);
168extern void init_ntproc (int); 168extern void init_ntproc (int);
diff --git a/src/w32console.c b/src/w32console.c
index 82ba4b1cf9c..98343a6c4ff 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -35,6 +35,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35#include "w32common.h" /* for os_subtype */ 35#include "w32common.h" /* for os_subtype */
36#include "w32inevt.h" 36#include "w32inevt.h"
37 37
38#ifdef WINDOWSNT
39#include "w32.h" /* for syms_of_ntterm */
40#endif
41
38static void w32con_move_cursor (struct frame *f, int row, int col); 42static void w32con_move_cursor (struct frame *f, int row, int col);
39static void w32con_clear_to_end (struct frame *f); 43static void w32con_clear_to_end (struct frame *f);
40static void w32con_clear_frame (struct frame *f); 44static void w32con_clear_frame (struct frame *f);
@@ -67,6 +71,8 @@ int w32_console_unicode_input;
67 someone hits ^C in a 'suspended' session (child shell). 71 someone hits ^C in a 'suspended' session (child shell).
68 Also ignore Ctrl-Break signals. */ 72 Also ignore Ctrl-Break signals. */
69 73
74BOOL ctrl_c_handler (unsigned long);
75
70BOOL 76BOOL
71ctrl_c_handler (unsigned long type) 77ctrl_c_handler (unsigned long type)
72{ 78{
@@ -509,11 +515,15 @@ w32con_update_end (struct frame * f)
509 stubs from termcap.c 515 stubs from termcap.c
510 ***********************************************************************/ 516 ***********************************************************************/
511 517
518void sys_tputs (char *, int, int (*) (int));
519
512void 520void
513sys_tputs (char *str, int nlines, int (*outfun) (int)) 521sys_tputs (char *str, int nlines, int (*outfun) (int))
514{ 522{
515} 523}
516 524
525char *sys_tgetstr (char *, char **);
526
517char * 527char *
518sys_tgetstr (char *cap, char **area) 528sys_tgetstr (char *cap, char **area)
519{ 529{
@@ -528,33 +538,45 @@ sys_tgetstr (char *cap, char **area)
528struct tty_display_info *current_tty = NULL; 538struct tty_display_info *current_tty = NULL;
529int cost = 0; 539int cost = 0;
530 540
541int evalcost (int);
542
531int 543int
532evalcost (int c) 544evalcost (int c)
533{ 545{
534 return c; 546 return c;
535} 547}
536 548
549int cmputc (int);
550
537int 551int
538cmputc (int c) 552cmputc (int c)
539{ 553{
540 return c; 554 return c;
541} 555}
542 556
557void cmcheckmagic (struct tty_display_info *);
558
543void 559void
544cmcheckmagic (struct tty_display_info *tty) 560cmcheckmagic (struct tty_display_info *tty)
545{ 561{
546} 562}
547 563
564void cmcostinit (struct tty_display_info *);
565
548void 566void
549cmcostinit (struct tty_display_info *tty) 567cmcostinit (struct tty_display_info *tty)
550{ 568{
551} 569}
552 570
571void cmgoto (struct tty_display_info *, int, int);
572
553void 573void
554cmgoto (struct tty_display_info *tty, int row, int col) 574cmgoto (struct tty_display_info *tty, int row, int col)
555{ 575{
556} 576}
557 577
578void Wcm_clear (struct tty_display_info *);
579
558void 580void
559Wcm_clear (struct tty_display_info *tty) 581Wcm_clear (struct tty_display_info *tty)
560{ 582{
diff --git a/src/w32fns.c b/src/w32fns.c
index 7a1f84a7bac..fa45b4781c1 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -74,15 +74,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74#define FOF_NO_CONNECTED_ELEMENTS 0x2000 74#define FOF_NO_CONNECTED_ELEMENTS 0x2000
75#endif 75#endif
76 76
77void syms_of_w32fns (void);
78void globals_of_w32fns (void);
79
80extern void free_frame_menubar (struct frame *);
81extern int w32_console_toggle_lock_key (int, Lisp_Object); 77extern int w32_console_toggle_lock_key (int, Lisp_Object);
82extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); 78extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
83extern void w32_free_menu_strings (HWND); 79extern void w32_free_menu_strings (HWND);
84extern const char *map_w32_filename (const char *, const char **); 80extern const char *map_w32_filename (const char *, const char **);
85extern char * w32_strerror (int error_no);
86 81
87#ifndef IDC_HAND 82#ifndef IDC_HAND
88#define IDC_HAND MAKEINTRESOURCE(32649) 83#define IDC_HAND MAKEINTRESOURCE(32649)
@@ -222,7 +217,6 @@ static HWND w32_visible_system_caret_hwnd;
222static int w32_unicode_gui; 217static int w32_unicode_gui;
223 218
224/* From w32menu.c */ 219/* From w32menu.c */
225extern HMENU current_popup_menu;
226int menubar_in_use = 0; 220int menubar_in_use = 0;
227 221
228/* From w32uniscribe.c */ 222/* From w32uniscribe.c */
@@ -365,10 +359,7 @@ void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
365void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); 359void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
366void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); 360void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
367void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); 361void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
368void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
369void x_set_title (struct frame *, Lisp_Object, Lisp_Object); 362void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
370void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
371void x_set_internal_border_width (struct frame *f, Lisp_Object, Lisp_Object);
372 363
373 364
374/* Store the screen positions of frame F into XPTR and YPTR. 365/* Store the screen positions of frame F into XPTR and YPTR.
@@ -491,7 +482,7 @@ if the entry is new. */)
491/* The default colors for the w32 color map */ 482/* The default colors for the w32 color map */
492typedef struct colormap_t 483typedef struct colormap_t
493{ 484{
494 char *name; 485 const char *name;
495 COLORREF colorref; 486 COLORREF colorref;
496} colormap_t; 487} colormap_t;
497 488
@@ -829,7 +820,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors)
829 NULL, NULL, (LPBYTE)color_buffer, &color_size) 820 NULL, NULL, (LPBYTE)color_buffer, &color_size)
830 == ERROR_SUCCESS) 821 == ERROR_SUCCESS)
831 { 822 {
832 int r, g, b; 823 unsigned r, g, b;
833 if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3) 824 if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3)
834 *system_colors = Fcons (Fcons (build_string (full_name_buffer), 825 *system_colors = Fcons (Fcons (build_string (full_name_buffer),
835 make_number (RGB (r, g, b))), 826 make_number (RGB (r, g, b))),
@@ -1244,7 +1235,7 @@ w32_defined_color (struct frame *f, const char *color, XColor *color_def,
1244 If F is not a color screen, return DEF (default) regardless of what 1235 If F is not a color screen, return DEF (default) regardless of what
1245 ARG says. */ 1236 ARG says. */
1246 1237
1247int 1238static int
1248x_decode_color (struct frame *f, Lisp_Object arg, int def) 1239x_decode_color (struct frame *f, Lisp_Object arg, int def)
1249{ 1240{
1250 XColor cdef; 1241 XColor cdef;
@@ -1527,7 +1518,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1527 Note that this does not fully take effect if done before 1518 Note that this does not fully take effect if done before
1528 F has a window. */ 1519 F has a window. */
1529 1520
1530void 1521static void
1531x_set_border_pixel (struct frame *f, int pix) 1522x_set_border_pixel (struct frame *f, int pix)
1532{ 1523{
1533 1524
@@ -1638,7 +1629,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1638#endif 1629#endif
1639} 1630}
1640 1631
1641void 1632static void
1642x_clear_under_internal_border (struct frame *f) 1633x_clear_under_internal_border (struct frame *f)
1643{ 1634{
1644 int border = FRAME_INTERNAL_BORDER_WIDTH (f); 1635 int border = FRAME_INTERNAL_BORDER_WIDTH (f);
@@ -1864,7 +1855,7 @@ w32_set_title_bar_text (struct frame *f, Lisp_Object name)
1864 suggesting a new name, which lisp code should override; if 1855 suggesting a new name, which lisp code should override; if
1865 F->explicit_name is set, ignore the new name; otherwise, set it. */ 1856 F->explicit_name is set, ignore the new name; otherwise, set it. */
1866 1857
1867void 1858static void
1868x_set_name (struct frame *f, Lisp_Object name, bool explicit) 1859x_set_name (struct frame *f, Lisp_Object name, bool explicit)
1869{ 1860{
1870 /* Make sure that requests from lisp code override requests from 1861 /* Make sure that requests from lisp code override requests from
@@ -1969,6 +1960,8 @@ x_set_scroll_bar_default_height (struct frame *f)
1969 1960
1970/* Subroutines for creating a frame. */ 1961/* Subroutines for creating a frame. */
1971 1962
1963Cursor w32_load_cursor (LPCTSTR);
1964
1972Cursor 1965Cursor
1973w32_load_cursor (LPCTSTR name) 1966w32_load_cursor (LPCTSTR name)
1974{ 1967{
@@ -2189,8 +2182,8 @@ funhook (int code, WPARAM w, LPARAM l)
2189 can prevent this by setting the 2182 can prevent this by setting the
2190 w32-pass-[lr]window-to-system variable to 2183 w32-pass-[lr]window-to-system variable to
2191 NIL. */ 2184 NIL. */
2192 if (hs->vkCode == VK_LWIN && !NILP (Vw32_pass_lwindow_to_system) || 2185 if (hs->vkCode == (VK_LWIN && !NILP (Vw32_pass_lwindow_to_system)) ||
2193 hs->vkCode == VK_RWIN && !NILP (Vw32_pass_rwindow_to_system)) 2186 (hs->vkCode == VK_RWIN && !NILP (Vw32_pass_rwindow_to_system)))
2194 { 2187 {
2195 /* Not prevented - Simulate the keypress to the system. */ 2188 /* Not prevented - Simulate the keypress to the system. */
2196 memset (inputs, 0, sizeof (inputs)); 2189 memset (inputs, 0, sizeof (inputs));
@@ -2236,8 +2229,8 @@ funhook (int code, WPARAM w, LPARAM l)
2236 /* Some other key was pressed while a captured Win key is down. 2229 /* Some other key was pressed while a captured Win key is down.
2237 This is either an Emacs registered hotkey combination, or a 2230 This is either an Emacs registered hotkey combination, or a
2238 system hotkey. */ 2231 system hotkey. */
2239 if (kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode] || 2232 if ((kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode]) ||
2240 kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode]) 2233 (kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode]))
2241 { 2234 {
2242 /* Hooked Win-x combination, do not pass the keypress to Windows. */ 2235 /* Hooked Win-x combination, do not pass the keypress to Windows. */
2243 kbdhook.suppress_lone = 1; 2236 kbdhook.suppress_lone = 1;
@@ -2375,7 +2368,7 @@ remove_w32_kbdhook (void)
2375 2368
2376/* Mark a specific key combination as hooked, preventing it to be 2369/* Mark a specific key combination as hooked, preventing it to be
2377 handled by the system. */ 2370 handled by the system. */
2378void 2371static void
2379hook_w32_key (int hook, int modifier, int vkey) 2372hook_w32_key (int hook, int modifier, int vkey)
2380{ 2373{
2381 char *tbl = NULL; 2374 char *tbl = NULL;
@@ -2445,7 +2438,7 @@ check_w32_winkey_state (int vkey)
2445 leaves the Win key(s) "down" from the hook's point of view - the 2438 leaves the Win key(s) "down" from the hook's point of view - the
2446 keyup event is never seen. Thus, this function must be called when 2439 keyup event is never seen. Thus, this function must be called when
2447 the system is locked. */ 2440 the system is locked. */
2448void 2441static void
2449reset_w32_kbdhook_state (void) 2442reset_w32_kbdhook_state (void)
2450{ 2443{
2451 kbdhook.lwindown = 0; 2444 kbdhook.lwindown = 0;
@@ -2652,6 +2645,7 @@ modifier_set (int vkey)
2652 2645
2653/* Convert between the modifier bits W32 uses and the modifier bits 2646/* Convert between the modifier bits W32 uses and the modifier bits
2654 Emacs uses. */ 2647 Emacs uses. */
2648unsigned int w32_key_to_modifier (int);
2655 2649
2656unsigned int 2650unsigned int
2657w32_key_to_modifier (int key) 2651w32_key_to_modifier (int key)
@@ -2750,6 +2744,8 @@ w32_get_key_modifiers (unsigned int wparam, unsigned int lparam)
2750 return mods; 2744 return mods;
2751} 2745}
2752 2746
2747unsigned int map_keypad_keys (unsigned int, unsigned int);
2748
2753unsigned int 2749unsigned int
2754map_keypad_keys (unsigned int virt_key, unsigned int extended) 2750map_keypad_keys (unsigned int virt_key, unsigned int extended)
2755{ 2751{
@@ -3122,6 +3118,8 @@ cancel_all_deferred_msgs (void)
3122 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); 3118 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
3123} 3119}
3124 3120
3121DWORD WINAPI w32_msg_worker (void *);
3122
3125DWORD WINAPI 3123DWORD WINAPI
3126w32_msg_worker (void *arg) 3124w32_msg_worker (void *arg)
3127{ 3125{
@@ -3340,7 +3338,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int ignore_ctrl, int ctrl,
3340 Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */ 3338 Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */
3341static int after_deadkey = -1; 3339static int after_deadkey = -1;
3342 3340
3343int 3341static int
3344deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, 3342deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam,
3345 UINT lParam, int legacy_alt_meta) 3343 UINT lParam, int legacy_alt_meta)
3346{ 3344{
@@ -5267,7 +5265,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
5267 if (!STRINGP (font)) 5265 if (!STRINGP (font))
5268 { 5266 {
5269 int i; 5267 int i;
5270 static char *names[] 5268 static const char *names[]
5271 = { "Courier New-10", 5269 = { "Courier New-10",
5272 "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1", 5270 "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1",
5273 "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1", 5271 "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1",
@@ -5610,8 +5608,10 @@ This function is an internal primitive--use `make-frame' instead. */)
5610 else if (! NILP (visibility)) 5608 else if (! NILP (visibility))
5611 x_make_frame_visible (f); 5609 x_make_frame_visible (f);
5612 else 5610 else
5613 /* Must have been Qnil. */ 5611 {
5614 ; 5612 /* Must have been Qnil. */
5613 ;
5614 }
5615 } 5615 }
5616 5616
5617 /* Initialize `default-minibuffer-frame' in case this is the first 5617 /* Initialize `default-minibuffer-frame' in case this is the first
@@ -6154,11 +6154,13 @@ SOUND is nil to use the normal beep. */)
6154 return sound; 6154 return sound;
6155} 6155}
6156 6156
6157#if 0 /* unused */
6157int 6158int
6158x_screen_planes (register struct frame *f) 6159x_screen_planes (register struct frame *f)
6159{ 6160{
6160 return FRAME_DISPLAY_INFO (f)->n_planes; 6161 return FRAME_DISPLAY_INFO (f)->n_planes;
6161} 6162}
6163#endif
6162 6164
6163/* Return the display structure for the display named NAME. 6165/* Return the display structure for the display named NAME.
6164 Open a new connection if necessary. */ 6166 Open a new connection if necessary. */
@@ -6886,12 +6888,12 @@ A tooltip's maximum size is specified by `x-max-tooltip-size'.
6886Text larger than the specified size is clipped. */) 6888Text larger than the specified size is clipped. */)
6887 (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) 6889 (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
6888{ 6890{
6889 struct frame *f, *tip_f; 6891 struct frame *tip_f;
6890 struct window *w; 6892 struct window *w;
6891 int root_x, root_y; 6893 int root_x, root_y;
6892 struct buffer *old_buffer; 6894 struct buffer *old_buffer;
6893 struct text_pos pos; 6895 struct text_pos pos;
6894 int i, width, height; 6896 int width, height;
6895 int old_windows_or_buffers_changed = windows_or_buffers_changed; 6897 int old_windows_or_buffers_changed = windows_or_buffers_changed;
6896 ptrdiff_t count = SPECPDL_INDEX (); 6898 ptrdiff_t count = SPECPDL_INDEX ();
6897 ptrdiff_t count_1; 6899 ptrdiff_t count_1;
@@ -6900,7 +6902,7 @@ Text larger than the specified size is clipped. */)
6900 specbind (Qinhibit_redisplay, Qt); 6902 specbind (Qinhibit_redisplay, Qt);
6901 6903
6902 CHECK_STRING (string); 6904 CHECK_STRING (string);
6903 f = decode_window_system_frame (frame); 6905 decode_window_system_frame (frame);
6904 if (NILP (timeout)) 6906 if (NILP (timeout))
6905 timeout = make_number (5); 6907 timeout = make_number (5);
6906 else 6908 else
@@ -8032,8 +8034,8 @@ lookup_vk_code (char *key)
8032 /* Alphanumerics map to themselves. */ 8034 /* Alphanumerics map to themselves. */
8033 if (key[1] == 0) 8035 if (key[1] == 0)
8034 { 8036 {
8035 if (key[0] >= 'A' && key[0] <= 'Z' || 8037 if ((key[0] >= 'A' && key[0] <= 'Z')
8036 key[0] >= '0' && key[0] <= '9') 8038 || (key[0] >= '0' && key[0] <= '9'))
8037 return key[0]; 8039 return key[0];
8038 if (key[0] >= 'a' && key[0] <= 'z') 8040 if (key[0] >= 'a' && key[0] <= 'z')
8039 return toupper(key[0]); 8041 return toupper(key[0]);
@@ -8667,7 +8669,7 @@ The following %-sequences are provided:
8667 else 8669 else
8668 { 8670 {
8669 long m; 8671 long m;
8670 float h; 8672 double h;
8671 char buffer[16]; 8673 char buffer[16];
8672 snprintf (buffer, 16, "%ld", seconds_left); 8674 snprintf (buffer, 16, "%ld", seconds_left);
8673 seconds = build_string (buffer); 8675 seconds = build_string (buffer);
@@ -8968,6 +8970,8 @@ w32_strerror (int error_no)
8968/* For convenience when debugging. (You cannot call GetLastError 8970/* For convenience when debugging. (You cannot call GetLastError
8969 directly from GDB: it will crash, because it uses the __stdcall 8971 directly from GDB: it will crash, because it uses the __stdcall
8970 calling convention, not the _cdecl convention assumed by GDB.) */ 8972 calling convention, not the _cdecl convention assumed by GDB.) */
8973DWORD w32_last_error (void);
8974
8971DWORD 8975DWORD
8972w32_last_error (void) 8976w32_last_error (void)
8973{ 8977{
@@ -9618,7 +9622,7 @@ usage: (w32-notification-notify &rest PARAMS) */)
9618 EMACS_INT retval; 9622 EMACS_INT retval;
9619 char *icon, *tip, *title, *msg; 9623 char *icon, *tip, *title, *msg;
9620 enum NI_Severity severity; 9624 enum NI_Severity severity;
9621 unsigned timeout; 9625 unsigned timeout = 0;
9622 9626
9623 if (nargs == 0) 9627 if (nargs == 0)
9624 return Qnil; 9628 return Qnil;
@@ -9630,14 +9634,14 @@ usage: (w32-notification-notify &rest PARAMS) */)
9630 if (STRINGP (lres)) 9634 if (STRINGP (lres))
9631 icon = SSDATA (ENCODE_FILE (Fexpand_file_name (lres, Qnil))); 9635 icon = SSDATA (ENCODE_FILE (Fexpand_file_name (lres, Qnil)));
9632 else 9636 else
9633 icon = ""; 9637 icon = (char *)"";
9634 9638
9635 /* Tip. */ 9639 /* Tip. */
9636 lres = Fplist_get (arg_plist, QCtip); 9640 lres = Fplist_get (arg_plist, QCtip);
9637 if (STRINGP (lres)) 9641 if (STRINGP (lres))
9638 tip = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); 9642 tip = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
9639 else 9643 else
9640 tip = "Emacs notification"; 9644 tip = (char *)"Emacs notification";
9641 9645
9642 /* Severity. */ 9646 /* Severity. */
9643 lres = Fplist_get (arg_plist, QClevel); 9647 lres = Fplist_get (arg_plist, QClevel);
@@ -9657,14 +9661,14 @@ usage: (w32-notification-notify &rest PARAMS) */)
9657 if (STRINGP (lres)) 9661 if (STRINGP (lres))
9658 title = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); 9662 title = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
9659 else 9663 else
9660 title = ""; 9664 title = (char *)"";
9661 9665
9662 /* Notification body text. */ 9666 /* Notification body text. */
9663 lres = Fplist_get (arg_plist, QCbody); 9667 lres = Fplist_get (arg_plist, QCbody);
9664 if (STRINGP (lres)) 9668 if (STRINGP (lres))
9665 msg = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); 9669 msg = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
9666 else 9670 else
9667 msg = ""; 9671 msg = (char *)"";
9668 9672
9669 /* Do it! */ 9673 /* Do it! */
9670 retval = add_tray_notification (f, icon, tip, severity, timeout, title, msg); 9674 retval = add_tray_notification (f, icon, tip, severity, timeout, title, msg);
@@ -10254,7 +10258,7 @@ typedef USHORT (WINAPI * CaptureStackBackTrace_proc) (ULONG, ULONG, PVOID *,
10254 10258
10255#define BACKTRACE_LIMIT_MAX 62 10259#define BACKTRACE_LIMIT_MAX 62
10256 10260
10257int 10261static int
10258w32_backtrace (void **buffer, int limit) 10262w32_backtrace (void **buffer, int limit)
10259{ 10263{
10260 static CaptureStackBackTrace_proc s_pfn_CaptureStackBackTrace = NULL; 10264 static CaptureStackBackTrace_proc s_pfn_CaptureStackBackTrace = NULL;
diff --git a/src/w32font.c b/src/w32font.c
index 018e6572563..b8884a50db9 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -102,7 +102,6 @@ static void list_all_matching_fonts (struct font_callback_data *);
102static BOOL g_b_init_get_outline_metrics_w; 102static BOOL g_b_init_get_outline_metrics_w;
103static BOOL g_b_init_get_text_metrics_w; 103static BOOL g_b_init_get_text_metrics_w;
104static BOOL g_b_init_get_glyph_outline_w; 104static BOOL g_b_init_get_glyph_outline_w;
105static BOOL g_b_init_get_glyph_outline_w;
106static BOOL g_b_init_get_char_width_32_w; 105static BOOL g_b_init_get_char_width_32_w;
107 106
108typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) ( 107typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) (
@@ -1688,7 +1687,7 @@ w32_to_x_charset (int fncharset, char *matching)
1688 /* Handle startup case of w32-charset-info-alist not 1687 /* Handle startup case of w32-charset-info-alist not
1689 being set up yet. */ 1688 being set up yet. */
1690 if (NILP (Vw32_charset_info_alist)) 1689 if (NILP (Vw32_charset_info_alist))
1691 return "iso8859-1"; 1690 return (char *)"iso8859-1";
1692 charset_type = Qw32_charset_ansi; 1691 charset_type = Qw32_charset_ansi;
1693 break; 1692 break;
1694 case DEFAULT_CHARSET: 1693 case DEFAULT_CHARSET:
@@ -2355,7 +2354,7 @@ w32font_full_name (LOGFONT * font, Lisp_Object font_obj,
2355 { 2354 {
2356 if (outline) 2355 if (outline)
2357 { 2356 {
2358 float pointsize = height * 72.0 / one_w32_display_info.resy; 2357 double pointsize = height * 72.0 / one_w32_display_info.resy;
2359 /* Round to nearest half point. floor is used, since round is not 2358 /* Round to nearest half point. floor is used, since round is not
2360 supported in MS library. */ 2359 supported in MS library. */
2361 pointsize = floor (pointsize * 2 + 0.5) / 2; 2360 pointsize = floor (pointsize * 2 + 0.5) / 2;
diff --git a/src/w32font.h b/src/w32font.h
index 728ad8be96c..0e2d0f79820 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -84,7 +84,6 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
84 84
85Lisp_Object intern_font_name (char *); 85Lisp_Object intern_font_name (char *);
86 86
87extern void syms_of_w32font (void);
88extern void globals_of_w32font (void); 87extern void globals_of_w32font (void);
89 88
90#endif 89#endif
diff --git a/src/w32heap.c b/src/w32heap.c
index 6643b439a26..658a8a5d691 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -189,7 +189,7 @@ free_fn the_free_fn;
189 claims for new memory. Before dumping, we allocate space 189 claims for new memory. Before dumping, we allocate space
190 from the fixed size dumped_data[] array. 190 from the fixed size dumped_data[] array.
191*/ 191*/
192NTSTATUS NTAPI 192static NTSTATUS NTAPI
193dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize) 193dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize)
194{ 194{
195 /* This is used before dumping. 195 /* This is used before dumping.
@@ -323,9 +323,9 @@ init_heap (void)
323 323
324/* FREEABLE_P checks if the block can be safely freed. */ 324/* FREEABLE_P checks if the block can be safely freed. */
325#define FREEABLE_P(addr) \ 325#define FREEABLE_P(addr) \
326 ((unsigned char *)(addr) > 0 \ 326 ((DWORD_PTR)(unsigned char *)(addr) > 0 \
327 && ((unsigned char *)(addr) < dumped_data \ 327 && ((unsigned char *)(addr) < dumped_data \
328 || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE)) 328 || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE))
329 329
330void * 330void *
331malloc_after_dump (size_t size) 331malloc_after_dump (size_t size)
@@ -708,7 +708,7 @@ mmap_realloc (void **var, size_t nbytes)
708 if (memInfo.RegionSize < nbytes) 708 if (memInfo.RegionSize < nbytes)
709 { 709 {
710 memset (&m2, 0, sizeof (m2)); 710 memset (&m2, 0, sizeof (m2));
711 if (VirtualQuery (*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0) 711 if (VirtualQuery ((char *)*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0)
712 DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", 712 DebPrint (("mmap_realloc: VirtualQuery error = %ld\n",
713 GetLastError ())); 713 GetLastError ()));
714 /* If there is enough room in the current reserved area, then 714 /* If there is enough room in the current reserved area, then
@@ -778,7 +778,7 @@ mmap_realloc (void **var, size_t nbytes)
778 } 778 }
779 779
780 /* We still can decommit pages. */ 780 /* We still can decommit pages. */
781 if (VirtualFree (*var + nbytes + get_page_size(), 781 if (VirtualFree ((char *)*var + nbytes + get_page_size(),
782 memInfo.RegionSize - nbytes - get_page_size(), 782 memInfo.RegionSize - nbytes - get_page_size(),
783 MEM_DECOMMIT) == 0) 783 MEM_DECOMMIT) == 0)
784 DebPrint (("mmap_realloc: VirtualFree error %ld\n", GetLastError ())); 784 DebPrint (("mmap_realloc: VirtualFree error %ld\n", GetLastError ()));
diff --git a/src/w32heap.h b/src/w32heap.h
index 523bcebe125..4f2d6c82a78 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -61,10 +61,10 @@ int open_output_file (file_data *p_file, char *name, unsigned long size);
61void close_file_data (file_data *p_file); 61void close_file_data (file_data *p_file);
62 62
63/* Return pointer to section header for named section. */ 63/* Return pointer to section header for named section. */
64IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header); 64IMAGE_SECTION_HEADER * find_section (const char *, IMAGE_NT_HEADERS *);
65 65
66/* Return pointer to section header for section containing the given 66/* Return pointer to section header for section containing the given
67 relative virtual address. */ 67 relative virtual address. */
68IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header); 68IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR, IMAGE_NT_HEADERS *);
69 69
70#endif /* NTHEAP_H_ */ 70#endif /* NTHEAP_H_ */
diff --git a/src/w32menu.c b/src/w32menu.c
index d9ab8f5e518..fecbf33a12b 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -60,9 +60,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
60 60
61HMENU current_popup_menu; 61HMENU current_popup_menu;
62 62
63void syms_of_w32menu (void);
64void globals_of_w32menu (void);
65
66typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) ( 63typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) (
67 IN HMENU, 64 IN HMENU,
68 IN UINT, 65 IN UINT,
@@ -91,8 +88,6 @@ AppendMenuW_Proc unicode_append_menu = NULL;
91MessageBoxW_Proc unicode_message_box = NULL; 88MessageBoxW_Proc unicode_message_box = NULL;
92#endif /* NTGUI_UNICODE */ 89#endif /* NTGUI_UNICODE */
93 90
94void set_frame_menubar (struct frame *, bool, bool);
95
96#ifdef HAVE_DIALOGS 91#ifdef HAVE_DIALOGS
97static Lisp_Object w32_dialog_show (struct frame *, Lisp_Object, Lisp_Object, char **); 92static Lisp_Object w32_dialog_show (struct frame *, Lisp_Object, Lisp_Object, char **);
98#else 93#else
@@ -172,6 +167,7 @@ x_activate_menubar (struct frame *f)
172 when the user makes a selection. 167 when the user makes a selection.
173 Figure out what the user chose 168 Figure out what the user chose
174 and put the appropriate events into the keyboard buffer. */ 169 and put the appropriate events into the keyboard buffer. */
170void menubar_selection_callback (struct frame *, void *);
175 171
176void 172void
177menubar_selection_callback (struct frame *f, void * client_data) 173menubar_selection_callback (struct frame *f, void * client_data)
@@ -1111,7 +1107,7 @@ simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header)
1111 } 1107 }
1112 else 1108 else
1113 { 1109 {
1114 text = L""; 1110 text = (WCHAR *)L"";
1115 } 1111 }
1116 1112
1117 if (NILP (header)) 1113 if (NILP (header))
@@ -1465,6 +1461,8 @@ fill_in_menu (HMENU menu, widget_value *wv)
1465/* Display help string for currently pointed to menu item. Not 1461/* Display help string for currently pointed to menu item. Not
1466 supported on NT 3.51 and earlier, as GetMenuItemInfo is not 1462 supported on NT 3.51 and earlier, as GetMenuItemInfo is not
1467 available. */ 1463 available. */
1464void w32_menu_display_help (HWND, HMENU, UINT, UINT);
1465
1468void 1466void
1469w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) 1467w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1470{ 1468{
diff --git a/src/w32notify.c b/src/w32notify.c
index 54d9bcc189a..d4a113aaa4d 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -123,7 +123,6 @@ static Lisp_Object watch_list;
123static void 123static void
124send_notifications (struct notifications_set *ns) 124send_notifications (struct notifications_set *ns)
125{ 125{
126 int done = 0;
127 struct frame *f = SELECTED_FRAME (); 126 struct frame *f = SELECTED_FRAME ();
128 127
129 /* We add the current notification set to the linked list. Use the 128 /* We add the current notification set to the linked list. Use the
@@ -153,8 +152,10 @@ send_notifications (struct notifications_set *ns)
153 /* When we are running in batch mode, there's no one to send a 152 /* When we are running in batch mode, there's no one to send a
154 message, so we just signal the data is available and hope 153 message, so we just signal the data is available and hope
155 sys_select will be called soon and will read the data. */ 154 sys_select will be called soon and will read the data. */
155#if 0
156 else if (FRAME_INITIAL_P (f) && noninteractive) 156 else if (FRAME_INITIAL_P (f) && noninteractive)
157 ; 157 ;
158#endif
158} 159}
159 160
160/* An APC routine to cancel outstanding directory watch. Invoked by 161/* An APC routine to cancel outstanding directory watch. Invoked by
@@ -162,6 +163,8 @@ send_notifications (struct notifications_set *ns)
162 thread that issued the ReadDirectoryChangesW call can call CancelIo 163 thread that issued the ReadDirectoryChangesW call can call CancelIo
163 to cancel that. (CancelIoEx is only available since Vista, so we 164 to cancel that. (CancelIoEx is only available since Vista, so we
164 cannot use it on XP.) */ 165 cannot use it on XP.) */
166VOID CALLBACK watch_end (ULONG_PTR);
167
165VOID CALLBACK 168VOID CALLBACK
166watch_end (ULONG_PTR arg) 169watch_end (ULONG_PTR arg)
167{ 170{
@@ -175,6 +178,8 @@ watch_end (ULONG_PTR arg)
175 read by ReadDirectoryChangesW. Called by the OS when the thread 178 read by ReadDirectoryChangesW. Called by the OS when the thread
176 which issued the asynchronous ReadDirectoryChangesW call is in the 179 which issued the asynchronous ReadDirectoryChangesW call is in the
177 "alertable state", i.e. waiting inside SleepEx call. */ 180 "alertable state", i.e. waiting inside SleepEx call. */
181VOID CALLBACK watch_completion (DWORD, DWORD, OVERLAPPED *);
182
178VOID CALLBACK 183VOID CALLBACK
179watch_completion (DWORD status, DWORD bytes_ret, OVERLAPPED *io_info) 184watch_completion (DWORD status, DWORD bytes_ret, OVERLAPPED *io_info)
180{ 185{
diff --git a/src/w32proc.c b/src/w32proc.c
index 4a6f7862801..11a121f7c09 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -45,11 +45,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#undef kill 45#undef kill
46 46
47#include <windows.h> 47#include <windows.h>
48#if defined(__GNUC__) && !defined(__MINGW64__)
49/* This definition is missing from mingw.org headers, but not MinGW64
50 headers. */
51extern BOOL WINAPI IsValidLocale (LCID, DWORD);
52#endif
53 48
54#ifdef HAVE_LANGINFO_CODESET 49#ifdef HAVE_LANGINFO_CODESET
55#include <nl_types.h> 50#include <nl_types.h>
@@ -70,6 +65,10 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
70 + ((DWORD_PTR)(var) - (section)->VirtualAddress) \ 65 + ((DWORD_PTR)(var) - (section)->VirtualAddress) \
71 + (filedata).file_base)) 66 + (filedata).file_base))
72 67
68extern BOOL g_b_init_compare_string_w;
69int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
70 struct timespec *, void *);
71
73/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ 72/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */
74static signal_handler sig_handlers[NSIG]; 73static signal_handler sig_handlers[NSIG];
75 74
@@ -1728,7 +1727,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
1728 are not expanded if we run the program directly without a shell. 1727 are not expanded if we run the program directly without a shell.
1729 Some extra whitespace characters need quoting in Cygwin/MSYS programs, 1728 Some extra whitespace characters need quoting in Cygwin/MSYS programs,
1730 so this list is conditionally modified below. */ 1729 so this list is conditionally modified below. */
1731 char *sepchars = " \t*?"; 1730 const char *sepchars = " \t*?";
1732 /* This is for native w32 apps; modified below for Cygwin/MSUS apps. */ 1731 /* This is for native w32 apps; modified below for Cygwin/MSUS apps. */
1733 char escape_char = '\\'; 1732 char escape_char = '\\';
1734 char cmdname_a[MAX_PATH]; 1733 char cmdname_a[MAX_PATH];
@@ -2815,7 +2814,6 @@ set_process_dir (char * dir)
2815/* From w32.c */ 2814/* From w32.c */
2816extern HANDLE winsock_lib; 2815extern HANDLE winsock_lib;
2817extern BOOL term_winsock (void); 2816extern BOOL term_winsock (void);
2818extern BOOL init_winsock (int load_now);
2819 2817
2820DEFUN ("w32-has-winsock", Fw32_has_winsock, Sw32_has_winsock, 0, 1, 0, 2818DEFUN ("w32-has-winsock", Fw32_has_winsock, Sw32_has_winsock, 0, 1, 0,
2821 doc: /* Test for presence of the Windows socket library `winsock'. 2819 doc: /* Test for presence of the Windows socket library `winsock'.
@@ -3522,7 +3520,6 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
3522 LCID lcid = GetThreadLocale (); 3520 LCID lcid = GetThreadLocale ();
3523 wchar_t *string1_w, *string2_w; 3521 wchar_t *string1_w, *string2_w;
3524 int val, needed; 3522 int val, needed;
3525 extern BOOL g_b_init_compare_string_w;
3526 static CompareStringW_Proc pCompareStringW; 3523 static CompareStringW_Proc pCompareStringW;
3527 DWORD flags = 0; 3524 DWORD flags = 0;
3528 3525
diff --git a/src/w32reg.c b/src/w32reg.c
index a87381831e2..25d6bb83934 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -56,9 +56,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56*/ 56*/
57 57
58static char * 58static char *
59w32_get_rdb_resource (char *rdb, const char *resource) 59w32_get_rdb_resource (const char *rdb, const char *resource)
60{ 60{
61 char *value = rdb; 61 char *value = (char *)rdb;
62 int len = strlen (resource); 62 int len = strlen (resource);
63 63
64 while (*value) 64 while (*value)
diff --git a/src/w32select.c b/src/w32select.c
index a29f5f66278..a38a42ca050 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -76,6 +76,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
76#include "lisp.h" 76#include "lisp.h"
77#include "w32common.h" /* os_subtype */ 77#include "w32common.h" /* os_subtype */
78#include "w32term.h" /* for all of the w32 includes */ 78#include "w32term.h" /* for all of the w32 includes */
79#include "w32select.h"
79#include "keyboard.h" /* for waiting_for_input */ 80#include "keyboard.h" /* for waiting_for_input */
80#include "blockinput.h" 81#include "blockinput.h"
81#include "coding.h" 82#include "coding.h"
diff --git a/src/w32term.c b/src/w32term.c
index 14a43c15641..c16c8f4eecc 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -83,8 +83,6 @@ static int any_help_event_p;
83 83
84extern unsigned int msh_mousewheel; 84extern unsigned int msh_mousewheel;
85 85
86extern void free_frame_menubar (struct frame *);
87
88extern int w32_codepage_for_font (char *fontname); 86extern int w32_codepage_for_font (char *fontname);
89extern Cursor w32_load_cursor (LPCTSTR name); 87extern Cursor w32_load_cursor (LPCTSTR name);
90 88
@@ -178,9 +176,7 @@ static void w32_define_cursor (Window, Cursor);
178 176
179void x_lower_frame (struct frame *); 177void x_lower_frame (struct frame *);
180void x_scroll_bar_clear (struct frame *); 178void x_scroll_bar_clear (struct frame *);
181void x_wm_set_size_hint (struct frame *, long, bool);
182void x_raise_frame (struct frame *); 179void x_raise_frame (struct frame *);
183void x_set_window_size (struct frame *, bool, int, int, bool);
184void x_wm_set_window_state (struct frame *, int); 180void x_wm_set_window_state (struct frame *, int);
185void x_wm_set_icon_pixmap (struct frame *, int); 181void x_wm_set_icon_pixmap (struct frame *, int);
186static void w32_initialize (void); 182static void w32_initialize (void);
@@ -248,7 +244,7 @@ record_event (char *locus, int type)
248#endif /* 0 */ 244#endif /* 0 */
249 245
250 246
251void 247static void
252XChangeGC (void *ignore, XGCValues *gc, unsigned long mask, 248XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
253 XGCValues *xgcv) 249 XGCValues *xgcv)
254{ 250{
@@ -270,12 +266,14 @@ XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
270 return gc; 266 return gc;
271} 267}
272 268
273void 269#if 0 /* unused for now, see x_draw_image_glyph_string below */
270static void
274XGetGCValues (void *ignore, XGCValues *gc, 271XGetGCValues (void *ignore, XGCValues *gc,
275 unsigned long mask, XGCValues *xgcv) 272 unsigned long mask, XGCValues *xgcv)
276{ 273{
277 XChangeGC (ignore, xgcv, mask, gc); 274 XChangeGC (ignore, xgcv, mask, gc);
278} 275}
276#endif
279 277
280static void 278static void
281w32_set_clip_rectangle (HDC hdc, RECT *rect) 279w32_set_clip_rectangle (HDC hdc, RECT *rect)
@@ -321,7 +319,7 @@ w32_restore_glyph_string_clip (struct glyph_string *s)
321 319
322*/ 320*/
323 321
324void 322static void
325w32_draw_underwave (struct glyph_string *s, COLORREF color) 323w32_draw_underwave (struct glyph_string *s, COLORREF color)
326{ 324{
327 int wave_height = 3, wave_length = 2; 325 int wave_height = 3, wave_length = 2;
@@ -384,7 +382,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color)
384} 382}
385 383
386/* Draw a hollow rectangle at the specified position. */ 384/* Draw a hollow rectangle at the specified position. */
387void 385static void
388w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, 386w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
389 int width, int height) 387 int width, int height)
390{ 388{
@@ -2579,7 +2577,7 @@ x_draw_glyph_string (struct glyph_string *s)
2579 2577
2580/* Shift display to make room for inserted glyphs. */ 2578/* Shift display to make room for inserted glyphs. */
2581 2579
2582void 2580static void
2583w32_shift_glyphs_for_insert (struct frame *f, int x, int y, 2581w32_shift_glyphs_for_insert (struct frame *f, int x, int y,
2584 int width, int height, int shift_by) 2582 int width, int height, int shift_by)
2585{ 2583{
@@ -2876,13 +2874,15 @@ w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event,
2876} 2874}
2877 2875
2878 2876
2877#if 0 /* unused */
2879/* Handle an event saying the mouse has moved out of an Emacs frame. */ 2878/* Handle an event saying the mouse has moved out of an Emacs frame. */
2880 2879
2881void 2880static void
2882x_mouse_leave (struct w32_display_info *dpyinfo) 2881x_mouse_leave (struct w32_display_info *dpyinfo)
2883{ 2882{
2884 x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); 2883 x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame);
2885} 2884}
2885#endif
2886 2886
2887/* The focus has changed, or we have redirected a frame's focus to 2887/* The focus has changed, or we have redirected a frame's focus to
2888 another frame (this happens when a frame uses a surrogate 2888 another frame (this happens when a frame uses a surrogate
@@ -4550,6 +4550,8 @@ static char dbcs_lead = 0;
4550 recursively with different messages by the system. 4550 recursively with different messages by the system.
4551*/ 4551*/
4552 4552
4553extern void menubar_selection_callback (struct frame *, void *);
4554
4553static int 4555static int
4554w32_read_socket (struct terminal *terminal, 4556w32_read_socket (struct terminal *terminal,
4555 struct input_event *hold_quit) 4557 struct input_event *hold_quit)
@@ -5281,8 +5283,6 @@ w32_read_socket (struct terminal *terminal,
5281 5283
5282 if (f) 5284 if (f)
5283 { 5285 {
5284 extern void menubar_selection_callback
5285 (struct frame *f, void * client_data);
5286 menubar_selection_callback (f, (void *)msg.msg.wParam); 5286 menubar_selection_callback (f, (void *)msg.msg.wParam);
5287 } 5287 }
5288 5288
@@ -5899,7 +5899,7 @@ xim_close_dpy (dpyinfo)
5899/* Calculate the absolute position in frame F 5899/* Calculate the absolute position in frame F
5900 from its current recorded position values and gravity. */ 5900 from its current recorded position values and gravity. */
5901 5901
5902void 5902static void
5903x_calc_absolute_position (struct frame *f) 5903x_calc_absolute_position (struct frame *f)
5904{ 5904{
5905 int flags = f->size_hint_flags; 5905 int flags = f->size_hint_flags;
@@ -6575,7 +6575,7 @@ x_free_frame_resources (struct frame *f)
6575 6575
6576 6576
6577/* Destroy the window of frame F. */ 6577/* Destroy the window of frame F. */
6578void 6578static void
6579x_destroy_window (struct frame *f) 6579x_destroy_window (struct frame *f)
6580{ 6580{
6581 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 6581 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
diff --git a/src/w32term.h b/src/w32term.h
index 8585c8190db..e134da5ea5c 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -230,25 +230,14 @@ extern struct frame *x_window_to_frame (struct w32_display_info *, HWND);
230 230
231struct w32_display_info *x_display_info_for_name (Lisp_Object); 231struct w32_display_info *x_display_info_for_name (Lisp_Object);
232 232
233Lisp_Object display_x_get_resource (struct w32_display_info *,
234 Lisp_Object, Lisp_Object,
235 Lisp_Object, Lisp_Object);
236
237/* also defined in xterm.h XXX: factor out to common header */ 233/* also defined in xterm.h XXX: factor out to common header */
238 234
239extern struct w32_display_info *w32_term_init (Lisp_Object, 235extern struct w32_display_info *w32_term_init (Lisp_Object,
240 char *, char *); 236 char *, char *);
241extern int w32_defined_color (struct frame *f, const char *color, 237extern int w32_defined_color (struct frame *f, const char *color,
242 XColor *color_def, bool alloc_p); 238 XColor *color_def, bool alloc_p);
243extern void x_set_window_size (struct frame *f, bool change_gravity,
244 int width, int height, bool pixelwise);
245extern int x_display_pixel_height (struct w32_display_info *); 239extern int x_display_pixel_height (struct w32_display_info *);
246extern int x_display_pixel_width (struct w32_display_info *); 240extern int x_display_pixel_width (struct w32_display_info *);
247extern Lisp_Object x_get_focus_frame (struct frame *);
248extern void x_make_frame_visible (struct frame *f);
249extern void x_make_frame_invisible (struct frame *f);
250extern void x_iconify_frame (struct frame *f);
251extern void x_set_frame_alpha (struct frame *f);
252extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 241extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
253extern void x_set_tool_bar_lines (struct frame *f, 242extern void x_set_tool_bar_lines (struct frame *f,
254 Lisp_Object value, 243 Lisp_Object value,
@@ -256,19 +245,12 @@ extern void x_set_tool_bar_lines (struct frame *f,
256extern void x_set_internal_border_width (struct frame *f, 245extern void x_set_internal_border_width (struct frame *f,
257 Lisp_Object value, 246 Lisp_Object value,
258 Lisp_Object oldval); 247 Lisp_Object oldval);
259extern void x_activate_menubar (struct frame *);
260extern bool x_bitmap_icon (struct frame *, Lisp_Object);
261extern void initialize_frame_menubar (struct frame *); 248extern void initialize_frame_menubar (struct frame *);
262extern void x_free_frame_resources (struct frame *);
263extern void x_real_positions (struct frame *, int *, int *);
264 249
265/* w32inevt.c */ 250/* w32inevt.c */
266extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId); 251extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId);
267extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key); 252extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key);
268 253
269
270extern Lisp_Object x_get_focus_frame (struct frame *);
271
272/* w32console.c */ 254/* w32console.c */
273extern void w32con_hide_cursor (void); 255extern void w32con_hide_cursor (void);
274extern void w32con_show_cursor (void); 256extern void w32con_show_cursor (void);
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index ddca5f5ef52..5f91b5022dd 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -50,7 +50,7 @@ static int CALLBACK ALIGN_STACK add_opentype_font_name_to_list (ENUMLOGFONTEX *,
50 NEWTEXTMETRICEX *, 50 NEWTEXTMETRICEX *,
51 DWORD, LPARAM); 51 DWORD, LPARAM);
52/* Used by uniscribe_otf_capability. */ 52/* Used by uniscribe_otf_capability. */
53static Lisp_Object otf_features (HDC context, char *table); 53static Lisp_Object otf_features (HDC context, const char *table);
54 54
55static int 55static int
56memq_no_quit (Lisp_Object elt, Lisp_Object list) 56memq_no_quit (Lisp_Object elt, Lisp_Object list)
@@ -1042,7 +1042,7 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
1042} 1042}
1043 1043
1044static Lisp_Object 1044static Lisp_Object
1045otf_features (HDC context, char *table) 1045otf_features (HDC context, const char *table)
1046{ 1046{
1047 Lisp_Object script_list = Qnil; 1047 Lisp_Object script_list = Qnil;
1048 unsigned short scriptlist_table, n_scripts, feature_table; 1048 unsigned short scriptlist_table, n_scripts, feature_table;
@@ -1166,6 +1166,8 @@ struct font_driver uniscribe_font_driver =
1166 1166
1167/* Note that this should be called at every startup, not just when dumping, 1167/* Note that this should be called at every startup, not just when dumping,
1168 as it needs to test for the existence of the Uniscribe library. */ 1168 as it needs to test for the existence of the Uniscribe library. */
1169void syms_of_w32uniscribe (void);
1170
1169void 1171void
1170syms_of_w32uniscribe (void) 1172syms_of_w32uniscribe (void)
1171{ 1173{
diff --git a/src/xfaces.c b/src/xfaces.c
index c42e55333cf..93d1c471407 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -221,7 +221,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
221#include TERM_HEADER 221#include TERM_HEADER
222#include "fontset.h" 222#include "fontset.h"
223#ifdef HAVE_NTGUI 223#ifdef HAVE_NTGUI
224#define x_display_info w32_display_info
225#define GCGraphicsExposures 0 224#define GCGraphicsExposures 0
226#endif /* HAVE_NTGUI */ 225#endif /* HAVE_NTGUI */
227 226