comparison src/fileio.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 788c38f20376
comparison
equal deleted inserted replaced
4994:76af7fc13e81 5000:44d7bde26046
616 and its creation. See `make-temp-file' for a function which avoids this 616 and its creation. See `make-temp-file' for a function which avoids this
617 race condition by specifying the appropriate flags to `write-region'. 617 race condition by specifying the appropriate flags to `write-region'.
618 */ 618 */
619 (prefix)) 619 (prefix))
620 { 620 {
621 static const char tbl[64] = 621 static const Ascbyte tbl[64] =
622 { 622 {
623 'A','B','C','D','E','F','G','H', 623 'A','B','C','D','E','F','G','H',
624 'I','J','K','L','M','N','O','P', 624 'I','J','K','L','M','N','O','P',
625 'Q','R','S','T','U','V','W','X', 625 'Q','R','S','T','U','V','W','X',
626 'Y','Z','a','b','c','d','e','f', 626 'Y','Z','a','b','c','d','e','f',
1801 */ 1801 */
1802 (filename, newname, ok_if_already_exists, keep_time)) 1802 (filename, newname, ok_if_already_exists, keep_time))
1803 { 1803 {
1804 /* This function can call Lisp. GC checked 2000-07-28 ben */ 1804 /* This function can call Lisp. GC checked 2000-07-28 ben */
1805 int ifd, ofd, n; 1805 int ifd, ofd, n;
1806 char buf[16 * 1024]; 1806 Rawbyte buf[16 * 1024];
1807 struct stat st, out_st; 1807 struct stat st, out_st;
1808 Lisp_Object handler; 1808 Lisp_Object handler;
1809 int speccount = specpdl_depth (); 1809 int speccount = specpdl_depth ();
1810 struct gcpro gcpro1, gcpro2; 1810 struct gcpro gcpro1, gcpro2;
1811 /* Lisp_Object args[6]; */ 1811 /* Lisp_Object args[6]; */
3043 if (!do_speedy_insert) 3043 if (!do_speedy_insert)
3044 buffer_delete_range (buf, BUF_BEG (buf), BUF_Z (buf), 3044 buffer_delete_range (buf, BUF_BEG (buf), BUF_Z (buf),
3045 !NILP (visit) ? INSDEL_NO_LOCKING : 0); 3045 !NILP (visit) ? INSDEL_NO_LOCKING : 0);
3046 else 3046 else
3047 { 3047 {
3048 char buffer[1 << 14]; 3048 Rawbyte buffer[1 << 14];
3049 Charbpos same_at_start = BUF_BEGV (buf); 3049 Charbpos same_at_start = BUF_BEGV (buf);
3050 Charbpos same_at_end = BUF_ZV (buf); 3050 Charbpos same_at_end = BUF_ZV (buf);
3051 int overlap; 3051 int overlap;
3052 3052
3053 /* Count how many chars at the start of the file 3053 /* Count how many chars at the start of the file
3741 a_write (Lisp_Object outstream, Lisp_Object instream, int pos, 3741 a_write (Lisp_Object outstream, Lisp_Object instream, int pos,
3742 Lisp_Object *annot) 3742 Lisp_Object *annot)
3743 { 3743 {
3744 Lisp_Object tem; 3744 Lisp_Object tem;
3745 int nextpos; 3745 int nextpos;
3746 unsigned char largebuf[A_WRITE_BATCH_SIZE]; 3746 Ibyte largebuf[A_WRITE_BATCH_SIZE];
3747 Lstream *instr = XLSTREAM (instream); 3747 Lstream *instr = XLSTREAM (instream);
3748 Lstream *outstr = XLSTREAM (outstream); 3748 Lstream *outstr = XLSTREAM (outstream);
3749 3749
3750 while (LISTP (*annot)) 3750 while (LISTP (*annot))
3751 { 3751 {