diff src/nt.c @ 5000:44d7bde26046

fix compile errors, fix revert-buffer bug on binary/Latin 1 files, Mule-ize some files -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-07 Ben Wing <ben@xemacs.org> * emacs.c (make_argc_argv): Cast to Wexttext * to fix compile error. * nt.c (init_user_info): Cast to CIbyte * to fix compile error. * nt.c (open_unc_volume): To fix compile error, store pathname into an Extbyte * variable then write into the dest, casting to LPTSTR. * emacs.c (debug_can_access_memory): * fileio.c (Fmake_temp_name): * fileio.c (a_write): * fns.c: * fns.c (check_losing_bytecode): * fns.c (plists_differ): * fns.c (internal_equal_trapping_problems): * fns.c (base64_value_to_char): * fns.c (base64_conversion_error): * fns.c (STORE_BYTE): * fns.c (vars_of_fns): * lisp.h: * nt.c (init_user_info): * nt.c (mswindows_readdir): * nt.c (mswindows_executable_type): Replace raw `char *' or `unsigned char *' with characterized type -- Rawbyte, Binbyte, Boolbyte, Ibyte or Ascbyte. This should fix at least one real bug -- in a_write(), the "speedy insert" code that checks for an unchanged region declared the file data read in as char[] but then compared the value to an Ichar. Hence, any chars in the range 128-255 would always appear changed -- in particular, this algorithm would fail completely with binary data.
author Ben Wing <ben@xemacs.org>
date Sun, 07 Feb 2010 05:21:40 -0600
parents 3c3c1d139863
children ecdc03ef6e12
line wrap: on
line diff
--- a/src/nt.c	Sat Feb 06 04:27:47 2010 -0600
+++ b/src/nt.c	Sun Feb 07 05:21:40 2010 -0600
@@ -158,9 +158,9 @@
       && qxeLookupAccountSid (NULL, sidinfo.User.Sid, name, &length,
 			      domain, &dlength, &user_type))
     {
-      the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name);
+      the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
       /* Determine a reasonable uid value. */
-      if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0)
+      if (qxestrcasecmp ((Ibyte *) the_passwd.pw_name, "administrator") == 0)
 	{
 	  the_passwd.pw_uid = 0;
 	  the_passwd.pw_gid = 0;
@@ -202,8 +202,9 @@
        are running under Windows 95), fallback to this. */
   else if (qxeGetUserName (name, &length))
     {
-      the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name);
-      if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0)
+      the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
+      if (qxestrcasecmp_ascii ((Ibyte *) the_passwd.pw_name,
+			       "administrator") == 0)
 	the_passwd.pw_uid = 0;
       else
 	the_passwd.pw_uid = 123;
@@ -223,7 +224,7 @@
   DWORD length = UNLEN + 1;
   Extbyte name[MAX_XETCHAR_SIZE * (UNLEN + 1)];
   if (qxeGetUserName (name, &length))
-    the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name);
+    the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
   else
     the_passwd.pw_name = "unknown";
 #endif
@@ -238,7 +239,7 @@
 #endif
 
   /* Set dir from environment variables. */
-  the_passwd.pw_dir = (char *) qxestrdup (get_home_directory ());
+  the_passwd.pw_dir = (CIbyte *) qxestrdup (get_home_directory ());
   /* We used to set pw_shell here, but the order is wrong (SHELL gets
      initted in process.c, called later in the init process) and pw_shell
      is not used anywhere. */
@@ -940,7 +941,7 @@
       eilwr (found);
 
     namlen = min (eilen (found), sizeof (dir_static.d_name) - 1);
-    strncpy (dir_static.d_name, (char *) eidata (found), namlen);
+    qxestrncpy ((Ibyte *) dir_static.d_name, eidata (found), namlen);
     dir_static.d_name[namlen] = '\0';
     dir_static.d_namlen = (unsigned short) namlen;
   }
@@ -954,13 +955,15 @@
   NETRESOURCEW nr; 
   HANDLE henum;
   int result;
+  Extbyte *extpath;
 
   nr.dwScope = RESOURCE_GLOBALNET; 
   nr.dwType = RESOURCETYPE_DISK; 
   nr.dwDisplayType = RESOURCEDISPLAYTYPE_SERVER; 
   nr.dwUsage = RESOURCEUSAGE_CONTAINER; 
   nr.lpLocalName = NULL;
-  PATHNAME_CONVERT_OUT (path, nr.lpRemoteName);
+  PATHNAME_CONVERT_OUT (path, extpath);
+  nr.lpRemoteName = (LPTSTR) extpath;
   nr.lpComment = NULL; 
   nr.lpProvider = NULL;   
 
@@ -2002,7 +2005,7 @@
       if (exe_header->e_magic != DOSMAGIC)
 	goto unwind;
 
-      if ((char *) exe_header->e_lfanew > (char *) executable.size)
+      if ((Rawbyte *) exe_header->e_lfanew > (Rawbyte *) executable.size)
 	{
 	  /* Some dos headers (pkunzip) have bogus e_lfanew fields.  */
 	  *is_dos_app = TRUE;
@@ -2019,10 +2022,10 @@
       if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
 	goto unwind;
 	  
-      nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header +
+      nt_header = (PIMAGE_NT_HEADERS) ((Rawbyte *) dos_header +
 				       dos_header->e_lfanew);
 	  
-      if ((char *) nt_header > (char *) dos_header + executable.size) 
+      if ((Rawbyte *) nt_header > (Rawbyte *) dos_header + executable.size) 
 	{
 	  /* Some dos headers (pkunzip) have bogus e_lfanew fields.  */
 	  *is_dos_app = TRUE;