Mercurial > hg > xemacs-beta
diff src/fileio.c @ 1333:1b0339b048ce
[xemacs-hg @ 2003-03-02 09:38:37 by ben]
To: xemacs-patches@xemacs.org
PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental
linking badness.
cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2.
Use if-fboundp in wid-edit.el.
New file newcomment.el from FSF.
internals/internals.texi: Fix typo.
(Build-Time Dependencies): New node.
PROBLEMS: Delete.
config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place.
No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it
can cause nasty crashes in pdump. Put warnings about this in
config.inc.samp. Report the full compile flags used for src
and lib-src in the Installation output.
alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation.
Also fix subtle problem with REL_ALLOC() -- any call to malloc()
(direct or indirect) may relocate rel-alloced data, causing
buffer text to shift. After any such call, regex must update
all its pointers to such data. Add a system, when
ERROR_CHECK_MALLOC, whereby regex.c indicates all the places
it is prepared to handle malloc()/realloc()/free(), and any
calls anywhere in XEmacs outside of this will trigger an abort.
alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not
a string. Factor out code to issue warnings, add flag to
call_trapping_problems() to postpone warning issue, and make
*run_hook*_trapping_problems issue their own warnings tailored
to the hook, postponed in the case of safe_run_hook_trapping_problems()
so that the appropriate message can be issued about resetting to
nil only when not `quit'. Make record_unwind_protect_restoring_int()
non-static.
dumper.c: Issue notes about incremental linking problems under Windows.
fileio.c: Mule-ize encrypt/decrypt-string code.
text.h: Spacing changes.
author | ben |
---|---|
date | Sun, 02 Mar 2003 09:38:54 +0000 |
parents | 70921960b980 |
children | a8d8f419b459 |
line wrap: on
line diff
--- a/src/fileio.c Sun Mar 02 02:18:12 2003 +0000 +++ b/src/fileio.c Sun Mar 02 09:38:54 2003 +0000 @@ -1,6 +1,6 @@ /* File IO for XEmacs. Copyright (C) 1985-1988, 1992-1995 Free Software Foundation, Inc. - Copyright (C) 1996, 2001, 2002 Ben Wing. + Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. This file is part of XEmacs. @@ -25,6 +25,7 @@ incomplete synching, so beware.) */ /* Mule-ized completely except for the #if 0-code including decrypt-string and encrypt-string. --ben 7-2-00 */ +/* #if 0-code Mule-ized, 2-22-03. --ben */ #include <config.h> @@ -1698,7 +1699,7 @@ If the file does not exist, STATPTR->st_mode is set to 0. */ static void -barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring, +barf_or_query_if_file_exists (Lisp_Object absname, const CIbyte *querystring, int interactive, struct stat *statptr) { /* This function can call Lisp. GC checked 2000-07-28 ben */ @@ -2193,8 +2194,8 @@ (path, login)) { int netresult; - const char *path_ext; - const char *login_ext; + const Extbyte *path_ext; + const Extbyte *login_ext; CHECK_STRING (path); CHECK_STRING (login); @@ -3667,28 +3668,31 @@ */ (string, key)) { - char *encrypted_string, *raw_key; - int rounded_size, extra, key_size; - - /* !!#### May produce bogus data under Mule. */ + Extbyte *encrypted_string, *raw_key; + Extbyte *string_ext, *key_ext; + Bytecount string_size_ext, key_size_ext, rounded_size, extra, key_size; + CHECK_STRING (string); CHECK_STRING (key); - extra = XSTRING_LENGTH (string) % CRYPT_BLOCK_SIZE; - rounded_size = XSTRING_LENGTH (string) + extra; + LISP_STRING_TO_SIZED_EXTERNAL (string, string_ext, string_size_ext, Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (key, key_ext, key_size_ext, Qbinary); + + extra = string_size_ext % CRYPT_BLOCK_SIZE; + rounded_size = string_size_ext + extra; encrypted_string = ALLOCA (rounded_size + 1); - memcpy (encrypted_string, XSTRING_DATA (string), XSTRING_LENGTH (string)); + memcpy (encrypted_string, string_ext, string_size_ext); memset (encrypted_string + rounded_size - extra, 0, extra + 1); - key_size = min (CRYPT_KEY_SIZE, XSTRING_LENGTH (key)) + key_size = min (CRYPT_KEY_SIZE, key_size_ext); raw_key = ALLOCA (CRYPT_KEY_SIZE + 1); - memcpy (raw_key, XSTRING_DATA (key), key_size); + memcpy (raw_key, key_ext, key_size); memset (raw_key + key_size, 0, (CRYPT_KEY_SIZE + 1) - key_size); ecb_crypt (raw_key, encrypted_string, rounded_size, DES_ENCRYPT | DES_SW); - return make_string (encrypted_string, rounded_size); + return make_ext_string (encrypted_string, rounded_size, Qbinary); } DEFUN ("decrypt-string", Fdecrypt_string, 2, 2, 0, /* @@ -3696,27 +3700,30 @@ */ (string, key)) { - /* !!#### May produce bogus data under Mule. */ - char *decrypted_string, *raw_key; - int string_size, key_size; + Extbyte *decrypted_string, *raw_key; + Extbyte *string_ext, *key_ext; + Bytecount string_size_ext, key_size_ext, string_size, key_size; CHECK_STRING (string); CHECK_STRING (key); - string_size = XSTRING_LENGTH (string) + 1; + LISP_STRING_TO_SIZED_EXTERNAL (string, string_ext, string_size_ext, Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (key, key_ext, key_size_ext, Qbinary); + + string_size = string_size_ext + 1; decrypted_string = ALLOCA (string_size); - memcpy (decrypted_string, XSTRING_DATA (string), string_size); + memcpy (decrypted_string, string_ext, string_size); decrypted_string[string_size - 1] = '\0'; - key_size = min (CRYPT_KEY_SIZE, XSTRING_LENGTH (key)) + key_size = min (CRYPT_KEY_SIZE, key_size_ext); raw_key = ALLOCA (CRYPT_KEY_SIZE + 1); - memcpy (raw_key, XSTRING_DATA (key), key_size); + memcpy (raw_key, key_ext, key_size); memset (raw_key + key_size, 0, (CRYPT_KEY_SIZE + 1) - key_size); ecb_crypt (raw_key, decrypted_string, string_size, D | DES_SW); - return make_string (decrypted_string, string_size - 1); + return make_ext_string (decrypted_string, string_size - 1, Qbinary); } #endif /* 0 */ @@ -4040,10 +4047,9 @@ set_buffer_internal (b); if (!auto_saved && NILP (no_message)) { - static const unsigned char *msg - = (const unsigned char *) "Auto-saving..."; + static const Ibyte *msg = (const Ibyte *) "Auto-saving..."; echo_area_message (selected_frame (), msg, Qnil, - 0, strlen ((const char *) msg), + 0, qxestrlen (msg), Qauto_saving); } @@ -4150,10 +4156,9 @@ if (auto_saved && NILP (no_message) && NILP (clear_echo_area (selected_frame (), Qauto_saving, 0))) { - static const unsigned char *msg - = (const unsigned char *)"Auto-saving...done"; + static const Ibyte *msg = (const Ibyte *)"Auto-saving...done"; echo_area_message (selected_frame (), msg, Qnil, 0, - strlen ((const char *) msg), Qauto_saving); + qxestrlen (msg), Qauto_saving); } Vquit_flag = oquit;