comparison src/fns.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 48b63cd88a21
children 714d854d00e9
comparison
equal deleted inserted replaced
4994:76af7fc13e81 5000:44d7bde26046
1 /* Random utility Lisp functions. 1 /* Random utility Lisp functions.
2 Copyright (C) 1985, 86, 87, 93, 94, 95 Free Software Foundation, Inc. 2 Copyright (C) 1985, 86, 87, 93, 94, 95 Free Software Foundation, Inc.
3 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003 Ben Wing. 3 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2010 Ben Wing.
4 4
5 This file is part of XEmacs. 5 This file is part of XEmacs.
6 6
7 XEmacs is free software; you can redistribute it and/or modify it 7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
216 } 216 }
217 217
218 #endif /* LOSING_BYTECODE */ 218 #endif /* LOSING_BYTECODE */
219 219
220 void 220 void
221 check_losing_bytecode (const char *function, Lisp_Object seq) 221 check_losing_bytecode (const Ascbyte *function, Lisp_Object seq)
222 { 222 {
223 if (COMPILED_FUNCTIONP (seq)) 223 if (COMPILED_FUNCTIONP (seq))
224 signal_ferror_with_frob 224 signal_ferror_with_frob
225 (Qinvalid_argument, seq, 225 (Qinvalid_argument, seq,
226 "As of 20.3, `%s' no longer works with compiled-function objects", 226 "As of 20.3, `%s' no longer works with compiled-function objects",
1986 int laxp, int depth, int foldcase) 1986 int laxp, int depth, int foldcase)
1987 { 1987 {
1988 int eqp = (depth == -1); /* -1 as depth means use eq, not equal. */ 1988 int eqp = (depth == -1); /* -1 as depth means use eq, not equal. */
1989 int la, lb, m, i, fill; 1989 int la, lb, m, i, fill;
1990 Lisp_Object *keys, *vals; 1990 Lisp_Object *keys, *vals;
1991 char *flags; 1991 Boolbyte *flags;
1992 Lisp_Object rest; 1992 Lisp_Object rest;
1993 1993
1994 if (NILP (a) && NILP (b)) 1994 if (NILP (a) && NILP (b))
1995 return 0; 1995 return 0;
1996 1996
2001 lb = XINT (Flength (b)); 2001 lb = XINT (Flength (b));
2002 m = (la > lb ? la : lb); 2002 m = (la > lb ? la : lb);
2003 fill = 0; 2003 fill = 0;
2004 keys = alloca_array (Lisp_Object, m); 2004 keys = alloca_array (Lisp_Object, m);
2005 vals = alloca_array (Lisp_Object, m); 2005 vals = alloca_array (Lisp_Object, m);
2006 flags = alloca_array (char, m); 2006 flags = alloca_array (Boolbyte, m);
2007 2007
2008 /* First extract the pairs from A. */ 2008 /* First extract the pairs from A. */
2009 for (rest = a; !NILP (rest); rest = XCDR (XCDR (rest))) 2009 for (rest = a; !NILP (rest); rest = XCDR (XCDR (rest)))
2010 { 2010 {
2011 Lisp_Object k = XCAR (rest); 2011 Lisp_Object k = XCAR (rest);
2808 return make_int (internal_equal (obj1, obj2, XINT (depth))); 2808 return make_int (internal_equal (obj1, obj2, XINT (depth)));
2809 } 2809 }
2810 2810
2811 int 2811 int
2812 internal_equal_trapping_problems (Lisp_Object warning_class, 2812 internal_equal_trapping_problems (Lisp_Object warning_class,
2813 const char *warning_string, 2813 const Ascbyte *warning_string,
2814 int flags, 2814 int flags,
2815 struct call_trapping_problems_result *p, 2815 struct call_trapping_problems_result *p,
2816 int retval, 2816 int retval,
2817 Lisp_Object obj1, Lisp_Object obj2, 2817 Lisp_Object obj1, Lisp_Object obj2,
2818 int depth) 2818 int depth)
3723 ((Character) < 128) 3723 ((Character) < 128)
3724 #define IS_BASE64(Character) \ 3724 #define IS_BASE64(Character) \
3725 (IS_ASCII (Character) && base64_char_to_value[Character] >= 0) 3725 (IS_ASCII (Character) && base64_char_to_value[Character] >= 0)
3726 3726
3727 /* Table of characters coding the 64 values. */ 3727 /* Table of characters coding the 64 values. */
3728 static char base64_value_to_char[64] = 3728 static Ascbyte base64_value_to_char[64] =
3729 { 3729 {
3730 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', /* 0- 9 */ 3730 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', /* 0- 9 */
3731 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', /* 10-19 */ 3731 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', /* 10-19 */
3732 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', /* 20-29 */ 3732 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', /* 20-29 */
3733 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', /* 30-39 */ 3733 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', /* 30-39 */
3770 `--------+--------+--------+--------' 3770 `--------+--------+--------+--------'
3771 3771
3772 The octets are divided into 6 bit chunks, which are then encoded into 3772 The octets are divided into 6 bit chunks, which are then encoded into
3773 base64 characters. */ 3773 base64 characters. */
3774 3774
3775 static DECLARE_DOESNT_RETURN (base64_conversion_error (const char *, 3775 static DECLARE_DOESNT_RETURN (base64_conversion_error (const Ascbyte *,
3776 Lisp_Object)); 3776 Lisp_Object));
3777 3777
3778 static DOESNT_RETURN 3778 static DOESNT_RETURN
3779 base64_conversion_error (const char *reason, Lisp_Object frob) 3779 base64_conversion_error (const Ascbyte *reason, Lisp_Object frob)
3780 { 3780 {
3781 signal_error (Qbase64_conversion_error, reason, frob); 3781 signal_error (Qbase64_conversion_error, reason, frob);
3782 } 3782 }
3783 3783
3784 #define ADVANCE_INPUT(c, stream) \ 3784 #define ADVANCE_INPUT(c, stream) \
3857 if (ec < 0 || IS_BASE64 (ec) || ec == '=') \ 3857 if (ec < 0 || IS_BASE64 (ec) || ec == '=') \
3858 break; \ 3858 break; \
3859 } while (1) 3859 } while (1)
3860 3860
3861 #define STORE_BYTE(pos, val, ccnt) do { \ 3861 #define STORE_BYTE(pos, val, ccnt) do { \
3862 pos += set_itext_ichar (pos, (Ichar)((unsigned char)(val))); \ 3862 pos += set_itext_ichar (pos, (Ichar)((Binbyte)(val))); \
3863 ++ccnt; \ 3863 ++ccnt; \
3864 } while (0) 3864 } while (0)
3865 3865
3866 static Bytebpos 3866 static Bytebpos
3867 base64_decode_1 (Lstream *istream, Ibyte *to, Charcount *ccptr) 3867 base64_decode_1 (Lstream *istream, Ibyte *to, Charcount *ccptr)
4202 { 4202 {
4203 DEFVAR_LISP ("path-separator", &Vpath_separator /* 4203 DEFVAR_LISP ("path-separator", &Vpath_separator /*
4204 The directory separator in search paths, as a string. 4204 The directory separator in search paths, as a string.
4205 */ ); 4205 */ );
4206 { 4206 {
4207 char c = SEPCHAR; 4207 Ascbyte c = SEPCHAR;
4208 Vpath_separator = make_string ((Ibyte *) &c, 1); 4208 Vpath_separator = make_string ((Ibyte *) &c, 1);
4209 } 4209 }
4210 } 4210 }
4211 4211
4212 void 4212 void