# HG changeset patch # User Kenichi Handa # Date 958781022 0 # Node ID 4c02859dda278fba9e5e001bae5e319bf306875e # Parent b9565b4bcdf828fe52b9f89e74707e43a18292da (read1): On reading multibyte string, be sure to make all 8-bit chararacters in valid multibyte form. (readchar): Use FETCH_STRING_CHAR_ADVANCE unconditionally. diff -r b9565b4bcdf8 -r 4c02859dda27 src/lread.c --- a/src/lread.c Sat May 20 00:03:16 2000 +0000 +++ b/src/lread.c Sat May 20 00:03:42 2000 +0000 @@ -296,12 +296,10 @@ { if (read_from_string_index >= read_from_string_limit) c = -1; - else if (STRING_MULTIBYTE (readcharfun)) + else FETCH_STRING_CHAR_ADVANCE (c, readcharfun, read_from_string_index, read_from_string_index_byte); - else - c = XSTRING (readcharfun)->data[read_from_string_index++]; return c; } @@ -2124,13 +2122,15 @@ return make_number (0); if (force_multibyte) - nchars = multibyte_chars_in_text (read_buffer, p - read_buffer); + p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer, + p - read_buffer, &nchars); else if (force_singlebyte) nchars = p - read_buffer; else if (load_convert_to_unibyte) { Lisp_Object string; - nchars = multibyte_chars_in_text (read_buffer, p - read_buffer); + p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer, + p - read_buffer, &nchars); if (p - read_buffer != nchars) { string = make_multibyte_string (read_buffer, nchars, @@ -2140,12 +2140,13 @@ } else if (EQ (readcharfun, Qget_file_char) || EQ (readcharfun, Qlambda)) - /* Nowadays, reading directly from a file - is used only for compiled Emacs Lisp files, - and those always use the Emacs internal encoding. - Meanwhile, Qlambda is used for reading dynamic byte code - (compiled with byte-compile-dynamic = t). */ - nchars = multibyte_chars_in_text (read_buffer, p - read_buffer); + /* Nowadays, reading directly from a file is used only for + compiled Emacs Lisp files, and those always use the + Emacs internal encoding. Meanwhile, Qlambda is used + for reading dynamic byte code (compiled with + byte-compile-dynamic = t). */ + p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer, + p - read_buffer, &nchars); else /* In all other cases, if we read these bytes as separate characters, treat them as separate characters now. */