From: Eli Zaretskii Date: Thu, 26 Nov 2015 17:53:47 +0000 (+0200) Subject: Fix compiler warnings in w32.c X-Git-Tag: emacs-25.0.90~640^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6f5f62b3c79485245b1f6d3d9a33d72da92c9e1d;p=emacs.git Fix compiler warnings in w32.c * src/w32.c (sys_socket): In case of error, use -1 as return value, not INVALID_SOCKET, which causes compiler warnings. (maybe_load_unicows_dll): Cast the return value of GetProcAddress to the appropriate function signature, to avoid compiler errors. Reported by Andy Moreton . (Bug#21953) --- diff --git a/src/w32.c b/src/w32.c index 9601012acd6..9b1d94de786 100644 --- a/src/w32.c +++ b/src/w32.c @@ -7432,7 +7432,7 @@ sys_socket (int af, int type, int protocol) if (winsock_lib == NULL) { errno = ENETDOWN; - return INVALID_SOCKET; + return -1; } check_errno (); @@ -9270,8 +9270,10 @@ maybe_load_unicows_dll (void) pointers, and assign the correct addresses to these pointers at program startup (see emacs.c, which calls this function early on). */ - pMultiByteToWideChar = GetProcAddress (ret, "MultiByteToWideChar"); - pWideCharToMultiByte = GetProcAddress (ret, "WideCharToMultiByte"); + pMultiByteToWideChar = + (MultiByteToWideChar_Proc)GetProcAddress (ret, "MultiByteToWideChar"); + pWideCharToMultiByte = + (WideCharToMultiByte_Proc)GetProcAddress (ret, "WideCharToMultiByte"); return ret; } else diff --git a/src/w32.h b/src/w32.h index 2c711502593..1efd562eadb 100644 --- a/src/w32.h +++ b/src/w32.h @@ -179,8 +179,10 @@ extern int _sys_wait_connect (int fd); extern HMODULE w32_delayed_load (Lisp_Object); -extern int (WINAPI *pMultiByteToWideChar)(UINT,DWORD,LPCSTR,int,LPWSTR,int); -extern int (WINAPI *pWideCharToMultiByte)(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL); +typedef int (WINAPI *MultiByteToWideChar_Proc)(UINT,DWORD,LPCSTR,int,LPWSTR,int); +typedef int (WINAPI *WideCharToMultiByte_Proc)(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL); +extern MultiByteToWideChar_Proc pMultiByteToWideChar; +extern WideCharToMultiByte_Proc pWideCharToMultiByte; extern void init_environment (char **); extern void check_windows_init_file (void);