]> code.delx.au - gnu-emacs/blobdiff - src/w32.c
Update copyright year to 2016
[gnu-emacs] / src / w32.c
index bb514960e43e557937d4293e2c74d8e780e7ef8f..c77ed87b003041bab11f23e4f71025cbadd8bb9f 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -1,6 +1,6 @@
 /* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 1994-1995, 2000-2015 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 2000-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -67,7 +67,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef localtime
 
 #include "lisp.h"
-#include "epaths.h"    /* for SHELL */
+#include "epaths.h"    /* for PATH_EXEC */
 
 #include <pwd.h>
 #include <grp.h>
@@ -224,20 +224,22 @@ typedef struct _REPARSE_DATA_BUFFER {
 
 #include <iphlpapi.h>  /* should be after winsock2.h */
 
+#include <c-strcase.h>
+
 #include "w32.h"
 #include <dirent.h>
 #include "w32common.h"
-#include "w32heap.h"
 #include "w32select.h"
-#include "systime.h"
+#include "systime.h"           /* for current_timespec, struct timespec */
 #include "dispextern.h"                /* for xstrcasecmp */
 #include "coding.h"            /* for Vlocale_coding_system */
 
 #include "careadlinkat.h"
 #include "allocator.h"
 
-/* For serial_configure and serial_open.  */
+/* For Lisp_Process, serial_configure and serial_open.  */
 #include "process.h"
+#include "systty.h"
 
 typedef HRESULT (WINAPI * ShGetFolderPath_fn)
   (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
@@ -1511,7 +1513,7 @@ codepage_for_filenames (CPINFO *cp_info)
 
       if (NILP (current_encoding))
        {
-         char *cpname = SDATA (SYMBOL_NAME (current_encoding));
+         char *cpname = SSDATA (SYMBOL_NAME (current_encoding));
          char *cp = NULL, *end;
          int cpnum;
 
@@ -2163,11 +2165,11 @@ unixtodos_filename (register char *p)
    (From msdos.c...probably should figure out a way to share it,
    although this code isn't going to ever change.)  */
 static int
-crlf_to_lf (register int n, register unsigned char *buf)
+crlf_to_lf (register int n, register char *buf)
 {
-  unsigned char *np = buf;
-  unsigned char *startp = buf;
-  unsigned char *endp = buf + n;
+  unsigned char *np = (unsigned char *)buf;
+  unsigned char *startp = np;
+  char *endp = buf + n;
 
   if (n == 0)
     return n;
@@ -2384,7 +2386,7 @@ ansi_encode_filename (Lisp_Object filename)
     {
       char shortname[MAX_PATH];
 
-      if (w32_get_short_filename (SDATA (filename), shortname, MAX_PATH))
+      if (w32_get_short_filename (SSDATA (filename), shortname, MAX_PATH))
        {
          dostounix_filename (shortname);
          encoded_filename = build_string (shortname);
@@ -7430,7 +7432,7 @@ sys_socket (int af, int type, int protocol)
   if (winsock_lib == NULL)
     {
       errno = ENETDOWN;
-      return INVALID_SOCKET;
+      return -1;
     }
 
   check_errno ();
@@ -7493,7 +7495,7 @@ socket_to_fd (SOCKET s)
                   though the socket wasn't really a kernel handle,
                   because a real handle has the same value.  So
                   test whether the new handle really is a socket.  */
-               long nonblocking = 0;
+               unsigned long nonblocking = 0;
                if (pfn_ioctlsocket ((SOCKET) new_s, FIONBIO, &nonblocking) == 0)
                  {
                    pfn_closesocket (s);
@@ -8518,7 +8520,7 @@ sys_write (int fd, const void * buffer, unsigned int count)
          int nbytes = count;
 
          SAFE_NALLOCA (tmpbuf, 2, count);
-         dst = tmpbuf;
+         dst = (unsigned char *)tmpbuf;
 
          while (1)
            {
@@ -9060,8 +9062,8 @@ check_windows_init_file (void)
       if (fd < 0)
        {
          Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil);
-         char *init_file_name = SDATA (init_file);
-         char *load_path = SDATA (load_path_print);
+         char *init_file_name = SSDATA (init_file);
+         char *load_path = SSDATA (load_path_print);
          char *buffer = alloca (1024
                                 + strlen (init_file_name)
                                 + strlen (load_path));
@@ -9268,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
@@ -9377,6 +9381,11 @@ globals_of_w32 (void)
     w32_unicode_filenames = 0;
   else
     w32_unicode_filenames = 1;
+
+#ifdef HAVE_MODULES
+  extern void dynlib_reset_last_error (void);
+  dynlib_reset_last_error ();
+#endif
 }
 
 /* For make-serial-process  */