Commit cb5af792 authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 99848b37
......@@ -967,6 +967,11 @@ AS_IF([test $gl_gcc_warnings = no],
nw="$nw -Wcast-align"
fi
# This causes too much noise in the MinGW build
if test $opsys = mingw32; then
nw="$nw -Wpointer-sign"
fi
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do
......@@ -987,6 +992,11 @@ AS_IF([test $gl_gcc_warnings = no],
gl_WARN_ADD([-Wno-unused-value])
fi
# This causes too much noise in the MinGW build
if test $opsys = mingw32; then
gl_WARN_ADD([-Wno-pointer-sign])
fi
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
......
......@@ -39,7 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# define CLOSE_SOCKET closesocket
# define INITIALIZE() (initialize_sockets ())
char *w32_getenv (char *);
char *w32_getenv (const char *);
#define egetenv(VAR) w32_getenv(VAR)
#else /* !WINDOWSNT */
......@@ -254,6 +254,7 @@ get_current_dir_name (void)
#ifdef WINDOWSNT
/* Like strdup but get a fatal error if memory is exhausted. */
char *xstrdup (const char *);
char *
xstrdup (const char *s)
......@@ -269,11 +270,13 @@ xstrdup (const char *s)
#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
char *w32_get_resource (HKEY, const char *, LPDWORD);
/* Retrieve an environment variable from the Emacs subkeys of the registry.
Return NULL if the variable was not found, or it was empty.
This code is based on w32_get_resource (w32.c). */
char *
w32_get_resource (HKEY predefined, char *key, LPDWORD type)
w32_get_resource (HKEY predefined, const char *key, LPDWORD type)
{
HKEY hrootkey = NULL;
char *result = NULL;
......@@ -285,7 +288,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
{
result = (char *) xmalloc (cbData);
if ((RegQueryValueEx (hrootkey, key, NULL, type, result, &cbData) != ERROR_SUCCESS)
if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, &cbData) != ERROR_SUCCESS)
|| (*result == 0))
{
free (result);
......@@ -308,7 +311,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
environment variables in the registry if they don't appear in the
environment. */
char *
w32_getenv (char *envvar)
w32_getenv (const char *envvar)
{
char *value;
DWORD dwType;
......@@ -356,6 +359,7 @@ w32_getenv (char *envvar)
return NULL;
}
int w32_window_app (void);
int
w32_window_app (void)
......@@ -383,11 +387,13 @@ w32_window_app (void)
predictably bad results. By contrast, POSIX execvp passes the arguments
directly into the argv array of the child process. */
int w32_execvp (const char *, char **);
extern int execvp (const char*, char **);
int
w32_execvp (const char *path, char **argv)
{
int i;
extern int execvp (const char*, char **);
/* Required to allow a .BAT script as alternate editor. */
argv[0] = (char *) alternate_editor;
......@@ -407,7 +413,8 @@ w32_execvp (const char *path, char **argv)
#define execvp w32_execvp
/* Emulation of ttyname for Windows. */
char *
const char *ttyname (int);
const char *
ttyname (int fd)
{
return "CONOUT$";
......@@ -852,6 +859,7 @@ file_name_absolute_p (const char *filename)
#ifdef WINDOWSNT
/* Wrapper to make WSACleanup a cdecl, as required by atexit. */
void __cdecl close_winsock (void);
void __cdecl
close_winsock (void)
{
......@@ -859,6 +867,7 @@ close_winsock (void)
}
/* Initialize the WinSock2 library. */
void initialize_sockets (void);
void
initialize_sockets (void)
{
......@@ -1380,11 +1389,13 @@ set_socket (int no_exit_if_error)
FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */
FARPROC get_wc; /* Pointer to RealGetWindowClassA. */
void w32_set_user_model_id (void);
void
w32_set_user_model_id (void)
{
HMODULE shell;
HRESULT (WINAPI * set_user_model) (wchar_t * id);
HRESULT (WINAPI * set_user_model) (const wchar_t * id);
/* On Windows 7 and later, we need to set the user model ID
to associate emacsclient launched files with Emacs frames
......@@ -1407,6 +1418,8 @@ w32_set_user_model_id (void)
}
}
BOOL CALLBACK w32_find_emacs_process (HWND, LPARAM);
BOOL CALLBACK
w32_find_emacs_process (HWND hWnd, LPARAM lParam)
{
......@@ -1433,6 +1446,7 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam)
/* Search for a window of class "Emacs" and owned by a process with
process id = emacs_pid. If found, allow it to grab the focus. */
void w32_give_focus (void);
void
w32_give_focus (void)
......@@ -1526,7 +1540,7 @@ start_daemon_and_retry_set_socket (void)
it is ready to accept client connections, by asserting an event
whose name is known to the daemon (defined by nt/inc/ms-w32.h). */
if (!CreateProcess (NULL, "emacs --daemon", NULL, NULL, FALSE,
if (!CreateProcess (NULL, (LPSTR)"emacs --daemon", NULL, NULL, FALSE,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
char* msg = NULL;
......@@ -1548,7 +1562,7 @@ start_daemon_and_retry_set_socket (void)
if ((wait_result = WaitForSingleObject (w32_daemon_event, INFINITE))
!= WAIT_OBJECT_0)
{
char *msg = NULL;
const char *msg = NULL;
switch (wait_result)
{
......
......@@ -112,7 +112,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
#ifdef WINDOWSNT
# include <direct.h>
# define MAXPATHLEN _MAX_PATH
# undef HAVE_NTGUI
# undef DOS_NT
# define DOS_NT
......
......@@ -34,6 +34,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "ntlib.h"
char *sys_ctime (const time_t *);
FILE *sys_fopen (const char *, const char *);
int sys_chdir (const char *);
int mkostemp (char *, int);
int sys_rename (const char *, const char *);
/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
its system headers. */
#ifndef _TIMEZONE_DEFINED
......@@ -44,6 +50,8 @@ struct timezone
};
#endif
void gettimeofday (struct timeval *, struct timezone *);
#define MAXPATHLEN _MAX_PATH
/* Emulate sleep...we could have done this with a define, but that
......
......@@ -34,15 +34,12 @@ char *getwd (char *dir);
int getppid (void);
char * getlogin (void);
char * cuserid (char * s);
unsigned getuid (void);
unsigned geteuid (void);
unsigned getegid (void);
unsigned getgid (void);
int setuid (unsigned uid);
int setregid (unsigned rgid, unsigned gid);
char * getpass (const char * prompt);
int fchown (int fd, unsigned uid, unsigned gid);
int mkostemp (char * template, int flags);
/* redirect or undo interceptions created by config.h */
#undef access
......
......@@ -129,3 +129,5 @@ gl_cv_func_stat_file_slash=yes
ac_cv_func_random=yes
# Implemented in w32.c as sys_putenv
gl_cv_func_svid_putenv=yes
# GCC warnings that produce too much noise
gl_cv_warn_c__Wredundant_decls=no
......@@ -203,7 +203,7 @@ void
set_user_model_id (void)
{
HMODULE shell;
HRESULT (WINAPI * set_user_model) (wchar_t * id);
HRESULT (WINAPI * set_user_model) (const wchar_t * id);
/* On Windows 7 and later, we need to set the user model ID
to associate emacsclient launched files with Emacs frames
......
......@@ -1295,7 +1295,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
#ifdef WINDOWSNT
prepare_standard_handles (in, out, err, handles);
set_process_dir (SDATA (current_dir));
set_process_dir (SSDATA (current_dir));
/* Spawn the child. (See w32proc.c:sys_spawnve). */
cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
reset_standard_handles (in, out, err, handles);
......@@ -1342,7 +1342,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
&& SBYTES (entry) >= varlen
#ifdef WINDOWSNT
/* NT environment variables are case insensitive. */
&& ! strnicmp (SDATA (entry), var, varlen)
&& ! strnicmp (SSDATA (entry), var, varlen)
#else /* not WINDOWSNT */
&& ! memcmp (SDATA (entry), var, varlen)
#endif /* not WINDOWSNT */
......
......@@ -47,6 +47,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "msdos.h" /* for fstatat */
#endif
#ifdef WINDOWSNT
extern int is_slow_fs (const char *);
#endif
static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
static Lisp_Object file_attributes (int, char const *, Lisp_Object);
......@@ -98,7 +102,7 @@ open_directory (Lisp_Object dirname, int *fdp)
}
#ifdef WINDOWSNT
void
static void
directory_files_internal_w32_unwind (Lisp_Object arg)
{
Vw32_get_true_file_attributes = arg;
......@@ -206,8 +210,6 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
#ifdef WINDOWSNT
if (attrs)
{
extern int is_slow_fs (const char *);
/* Do this only once to avoid doing it (in w32.c:stat) for each
file in the directory, when we call Ffile_attributes below. */
record_unwind_protect (directory_files_internal_w32_unwind,
......@@ -217,7 +219,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
{
/* w32.c:stat will notice these bindings and avoid calling
GetDriveType for each file. */
if (is_slow_fs (SDATA (dirfilename)))
if (is_slow_fs (SSDATA (dirfilename)))
Vw32_get_true_file_attributes = Qnil;
else
Vw32_get_true_file_attributes = Qt;
......
......@@ -6042,7 +6042,7 @@ init_display (void)
fatal ("standard input is not a tty");
#ifdef WINDOWSNT
terminal_type = "w32console";
terminal_type = (char *)"w32console";
#else
terminal_type = getenv ("TERM");
#endif
......
......@@ -52,6 +52,7 @@ typedef BOOL (WINAPI *GetModuleHandleExA_Proc) (DWORD,LPCSTR,HMODULE*);
/* This needs to be called at startup to countermand any non-zero
values recorded by temacs. */
void dynlib_reset_last_error (void);
void
dynlib_reset_last_error (void)
{
......
......@@ -2542,7 +2542,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
/* The read-only attribute of the parent directory doesn't affect
whether a file or directory can be created within it. Some day we
should check ACLs though, which do affect this. */
return file_directory_p (SDATA (dir)) ? Qt : Qnil;
return file_directory_p (SSDATA (dir)) ? Qt : Qnil;
#else
return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil;
#endif
......@@ -2773,7 +2773,7 @@ See `file-symlink-p' to distinguish symlinks. */)
/* Tell stat to use expensive method to get accurate info. */
Vw32_get_true_file_attributes = Qt;
result = stat (SDATA (absname), &st);
result = stat (SSDATA (absname), &st);
Vw32_get_true_file_attributes = tem;
if (result < 0)
......
......@@ -65,7 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define BOOT_TIME_FILE "/var/run/random-seed"
#endif
#ifndef WTMP_FILE
#if !defined WTMP_FILE && !defined WINDOWSNT
#define WTMP_FILE "/var/log/wtmp"
#endif
......
......@@ -55,7 +55,6 @@ DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get,
(gnutls_session_t));
DEF_DLL_FN (const char *, gnutls_alert_get_name,
(gnutls_alert_description_t));
DEF_DLL_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int));
DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials,
(gnutls_anon_client_credentials_t *));
DEF_DLL_FN (void, gnutls_anon_free_client_credentials,
......@@ -156,8 +155,6 @@ DEF_DLL_FN (int, gnutls_x509_crt_get_subject_unique_id,
(gnutls_x509_crt_t, char *, size_t *));
DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm,
(gnutls_x509_crt_t));
DEF_DLL_FN (int, gnutls_x509_crt_get_signature,
(gnutls_x509_crt_t, char *, size_t *));
DEF_DLL_FN (int, gnutls_x509_crt_get_key_id,
(gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size));
DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t));
......@@ -192,7 +189,6 @@ init_gnutls_functions (void)
LOAD_DLL_FN (library, gnutls_alert_get);
LOAD_DLL_FN (library, gnutls_alert_get_name);
LOAD_DLL_FN (library, gnutls_alert_send_appropriate);
LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials);
LOAD_DLL_FN (library, gnutls_anon_free_client_credentials);
LOAD_DLL_FN (library, gnutls_bye);
......@@ -255,7 +251,6 @@ init_gnutls_functions (void)
LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id);
LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id);
LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm);
LOAD_DLL_FN (library, gnutls_x509_crt_get_signature);
LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id);
LOAD_DLL_FN (library, gnutls_sec_param_get_name);
LOAD_DLL_FN (library, gnutls_sign_get_name);
......@@ -282,7 +277,6 @@ init_gnutls_functions (void)
# define gnutls_alert_get fn_gnutls_alert_get
# define gnutls_alert_get_name fn_gnutls_alert_get_name
# define gnutls_alert_send_appropriate fn_gnutls_alert_send_appropriate
# define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials
# define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials
# define gnutls_bye fn_gnutls_bye
......@@ -343,7 +337,6 @@ init_gnutls_functions (void)
# define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id
# define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm
# define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial
# define gnutls_x509_crt_get_signature fn_gnutls_x509_crt_get_signature
# define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm
# define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id
# define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version
......
......@@ -270,12 +270,12 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
ptrdiff_t
x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
#ifdef HAVE_NTGUI
return -1; /* W32_TODO : bitmap support */
#endif /* HAVE_NTGUI */
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
#ifdef HAVE_NS
ptrdiff_t id;
void *bitmap = ns_image_from_file (file);
......@@ -3677,7 +3677,7 @@ xpm_load (struct frame *f, struct image *img)
#endif
/* XpmReadFileToPixmap is not available in the Windows port of
libxpm. But XpmReadFileToImage almost does what we want. */
rc = XpmReadFileToImage (&hdc, SDATA (file),
rc = XpmReadFileToImage (&hdc, SSDATA (file),
&xpm_image, &xpm_mask,
&attrs);
#else
......@@ -3701,7 +3701,7 @@ xpm_load (struct frame *f, struct image *img)
#ifdef HAVE_NTGUI
/* XpmCreatePixmapFromBuffer is not available in the Windows port
of libxpm. But XpmCreateImageFromBuffer almost does what we want. */
rc = XpmCreateImageFromBuffer (&hdc, SDATA (buffer),
rc = XpmCreateImageFromBuffer (&hdc, SSDATA (buffer),
&xpm_image, &xpm_mask,
&attrs);
#else
......
......@@ -2193,8 +2193,8 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
Lisp_Object prev_event,
bool *used_mouse_menu)
{
#define MAX_ENCODED_BYTES 16
#ifndef WINDOWSNT
#define MAX_ENCODED_BYTES 16
Lisp_Object events[MAX_ENCODED_BYTES];
int n = 0;
#endif
......@@ -6898,7 +6898,10 @@ tty_read_avail_input (struct terminal *terminal,
the kbd_buffer can really hold. That may prevent loss
of characters on some systems when input is stuffed at us. */
unsigned char cbuf[KBD_BUFFER_SIZE - 1];
int n_to_read, i;
#ifndef WINDOWSNT
int n_to_read;
#endif
int i;
struct tty_display_info *tty = terminal->display_info.tty;
int nread = 0;
#ifdef subprocesses
......
......@@ -47,7 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# else /* !NTGUI_UNICODE */
extern AppendMenuW_Proc unicode_append_menu;
# endif /* NTGUI_UNICODE */
extern HMENU current_popup_menu;
#endif /* HAVE_NTGUI */
#include "menu.h"
......
......@@ -316,7 +316,6 @@ static struct sockaddr_and_len {
XPROCESS (proc)->infd >= 0 && \
datagram_address[XPROCESS (proc)->infd].sa != 0)
#else
#define DATAGRAM_CHAN_P(chan) (0)
#define DATAGRAM_CONN_P(proc) (0)
#endif
......
......@@ -201,7 +201,12 @@ static bool profiler_timer_ok;
/* Status of sampling profiler. */
static enum profiler_cpu_running
{ NOT_RUNNING, TIMER_SETTIME_RUNNING, SETITIMER_RUNNING }
{ NOT_RUNNING,
#ifdef HAVE_ITIMERSPEC
TIMER_SETTIME_RUNNING,
#endif
SETITIMER_RUNNING
}
profiler_cpu_running;
/* Hash-table log of CPU profiler. */
......
......@@ -316,6 +316,7 @@ sound_perror (const char *msg)
}
#ifndef WINDOWSNT
/* Display a warning message. */
static void
......@@ -323,6 +324,7 @@ sound_warning (const char *msg)
{
message1 (msg);
}
#endif /* !WINDOWSNT */
/* Parse sound specification SOUND, and fill ATTRS with what is
......
......@@ -107,7 +107,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* In process.h which conflicts with the local copy. */
#define _P_WAIT 0
int _cdecl _spawnlp (int, const char *, const char *, ...);
int _cdecl _getpid (void);
/* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and
several prototypes of functions called below. */
#include <sys/socket.h>
......@@ -507,15 +506,16 @@ void
sys_subshell (void)
{
#ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */
int st;
#ifdef MSDOS
int st;
char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
#else
char oldwd[MAX_UTF8_PATH];
#endif
#endif /* MSDOS */
#else /* !DOS_NT */
int status;
#endif
pid_t pid;
int status;
struct save_signal saved_handlers[5];
char *str = SSDATA (encode_current_directory ());
......@@ -938,7 +938,9 @@ void
init_sys_modes (struct tty_display_info *tty_out)
{
struct emacs_tty tty;
#ifndef DOS_NT
Lisp_Object terminal;
#endif
Vtty_erase_char = Qnil;
......@@ -3915,7 +3917,7 @@ str_collate (Lisp_Object s1, Lisp_Object s2,
int res, err = errno;
errno = 0;
res = w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP (ignore_case));
res = w32_compare_strings (SSDATA (s1), SSDATA (s2), loc, !NILP (ignore_case));
if (errno)
error ("Invalid string for collation: %s", strerror (errno));
......
......@@ -3913,13 +3913,15 @@ dissociate_if_controlling_tty (int fd)
struct terminal *
init_tty (const char *name, const char *terminal_type, bool must_succeed)
{
struct tty_display_info *tty = NULL;
struct terminal *terminal = NULL;
#ifndef DOS_NT
char *area;
char **address = &area;
int status;
struct tty_display_info *tty = NULL;
struct terminal *terminal = NULL;
sigset_t oldset;
bool ctty = false; /* True if asked to open controlling tty. */
#endif
if (!terminal_type)
maybe_fatal (must_succeed, 0,
......@@ -3928,8 +3930,10 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
if (name == NULL)
name = DEV_TTY;
#ifndef DOS_NT
if (!strcmp (name, DEV_TTY))
ctty = 1;
#endif
/* If we already have a terminal on the given device, use that. If
all such terminals are suspended, create a new one instead. */
......
......@@ -50,10 +50,6 @@ extern char *my_begbss_static;
/* Basically, our "initialized" flag. */
BOOL using_dynamic_heap = FALSE;
int open_input_file (file_data *p_file, char *name);
int open_output_file (file_data *p_file, char *name, unsigned long size);
void close_file_data (file_data *p_file);
void get_section_info (file_data *p_file);
void copy_executable_and_dump_data (file_data *, file_data *);
void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile);
......@@ -81,14 +77,17 @@ DWORD_PTR extra_bss_size_static = 0;
#define _start __start
#endif
extern void mainCRTStartup (void);
/* Startup code for running on NT. When we are running as the dumped
version, we need to bootstrap our heap and .bss section into our
address space before we can actually hand off control to the startup
code supplied by NT (primarily because that code relies upon malloc ()). */
void _start (void);
void
_start (void)
{
extern void mainCRTStartup (void);
#if 1
/* Give us a way to debug problems with crashes on startup when
......@@ -205,7 +204,7 @@ close_file_data (file_data *p_file)
/* Return pointer to section header for named section. */
IMAGE_SECTION_HEADER *
find_section (char * name, IMAGE_NT_HEADERS * nt_header)
find_section (const char * name, IMAGE_NT_HEADERS * nt_header)
{
PIMAGE_SECTION_HEADER section;
int i;
......@@ -214,7 +213,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header)
for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
{
if (strcmp (section->Name, name) == 0)
if (strcmp ((char *)section->Name, name) == 0)
return section;
section++;
}
......@@ -249,9 +248,10 @@ rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
return NULL;
}
#if 0 /* unused */
/* Return pointer to section header for section containing the given
offset in its raw data area. */
IMAGE_SECTION_HEADER *
static IMAGE_SECTION_HEADER *
offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
{
PIMAGE_SECTION_HEADER section;
......@@ -268,11 +268,12 @@ offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
}
return NULL;
}
#endif
/* Return offset to an object in dst, given offset in src. We assume
there is at least one section in both src and dst images, and that
the some sections may have been added to dst (after sections in src). */
DWORD_PTR
static DWORD_PTR
relocate_offset (DWORD_PTR offset,
IMAGE_NT_HEADERS * src_nt_header,
IMAGE_NT_HEADERS * dst_nt_header)
......@@ -306,9 +307,6 @@ relocate_offset (DWORD_PTR offset,
(dst_section->PointerToRawData - src_section->PointerToRawData);
}
#define OFFSET_TO_RVA(offset, section) \
((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
#define RVA_TO_OFFSET(rva, section) \
((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress))
......@@ -318,15 +316,20 @@ relocate_offset (DWORD_PTR offset,
/* Convert address in executing image to RVA. */
#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
#define RVA_TO_PTR(var,section,filedata) \
((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
#define PTR_TO_OFFSET(ptr, pfile_data) \
((unsigned char *)(ptr) - (pfile_data)->file_base)
#define OFFSET_TO_PTR(offset, pfile_data) \
((pfile_data)->file_base + (DWORD_PTR)(offset))
#if 0 /* unused */
#define OFFSET_TO_RVA(offset, section) \
((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
#define RVA_TO_PTR(var,section,filedata) \
((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
#endif
/* Flip through the executable and cache the info necessary for dumping. */
void
......
......@@ -66,6 +66,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef localtime
char *sys_ctime (const time_t *);
int sys_chdir (const char *);
int sys_creat (const char *, int);
FILE *sys_fopen (const char *, const char *);
int sys_mkdir (const char *);
int sys_open (const char *, int, int);
int sys_rename (char const *, char const *);
int sys_rmdir (const char *);
int sys_close (int);
int sys_dup2 (int, int);
int sys_read (int, char *, unsigned int);
int sys_write (int, const void *, unsigned int);
struct tm *sys_localtime (const time_t *);
#ifdef HAVE_MODULES
extern void dynlib_reset_last_error (void);
#endif
#include "lisp.h"
#include "epaths.h" /* for PATH_EXEC */
......@@ -227,6 +245,7 @@ typedef struct _REPARSE_DATA_BUFFER {
#include <wincrypt.h>
#include <c-strcase.h>
#include <utimens.h> /* for fdutimens */
#include "w32.h"
#include <dirent.h>
......@@ -246,7 +265,6 @@ typedef struct _REPARSE_DATA_BUFFER {
typedef HRESULT (WINAPI * ShGetFolderPath_fn)
(IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
void globals_of_w32 (void);
static DWORD get_rid (PSID);
static int is_symlink (const char *);
static char * chase_symlinks (const char *);
......@@ -512,6 +530,8 @@ static Lisp_Object ltime (ULONGLONG);
/* Get total user and system times for get-internal-run-time.
Returns a list of integers if the times are provided by the OS
(NT derivatives), otherwise it returns the result of current-time. */
Lisp_Object w32_get_internal_run_time (void);
Lisp_Object
w32_get_internal_run_time (void)
{
......@@ -2491,7 +2511,7 @@ sys_putenv (char *str)
#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
LPBYTE
w32_get_resource (char *key, LPDWORD lpdwtype)
w32_get_resource (const char *key, LPDWORD lpdwtype)
{
LPBYTE lpvalue;
HKEY hrootkey = NULL;
......@@ -2600,8 +2620,8 @@ init_environment (char ** argv)
static const struct env_entry
{
char * name;
char * def_value;
const char * name;
const char * def_value;
} dflt_envvars[] =
{
/* If the default value is NULL, we will use the value from the
......@@ -2761,14 +2781,14 @@ init_environment (char ** argv)
{
/* If not found in any directory, use the
default as the last resort. */
lpval = env_vars[i].def_value;
lpval = (char *)env_vars[i].def_value;
dwType = REG_EXPAND_SZ;
}
} while (*pstart);
}
else
{
lpval = env_vars[i].def_value;
lpval = (char *)env_vars[i].def_value;
dwType = REG_EXPAND_SZ;
}
if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
......@@ -2786,7 +2806,7 @@ init_environment (char ** argv)
if (dwType == REG_EXPAND_SZ)
ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1));
else if (dwType == REG_SZ)
strcpy (buf1, lpval);