Mercurial > emacs
comparison src/data.c @ 89526:58eb89f2fdfc
(Faset): Check newelt by CHECK_CHARACTER. Don't change
multibyteness of the result when newelt is an 8-bit character.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Fri, 26 Sep 2003 11:20:13 +0000 |
| parents | 2f877ed80fa6 |
| children | 68c22ea6027c |
comparison
equal
deleted
inserted
replaced
| 89525:1b757cdb6144 | 89526:58eb89f2fdfc |
|---|---|
| 1927 int idxval_byte, prev_bytes, new_bytes, nbytes; | 1927 int idxval_byte, prev_bytes, new_bytes, nbytes; |
| 1928 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; | 1928 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; |
| 1929 | 1929 |
| 1930 if (idxval < 0 || idxval >= SCHARS (array)) | 1930 if (idxval < 0 || idxval >= SCHARS (array)) |
| 1931 args_out_of_range (array, idx); | 1931 args_out_of_range (array, idx); |
| 1932 CHECK_NUMBER (newelt); | 1932 CHECK_CHARACTER (newelt); |
| 1933 | 1933 |
| 1934 nbytes = SBYTES (array); | 1934 nbytes = SBYTES (array); |
| 1935 | 1935 |
| 1936 idxval_byte = string_char_to_byte (array, idxval); | 1936 idxval_byte = string_char_to_byte (array, idxval); |
| 1937 p1 = SDATA (array) + idxval_byte; | 1937 p1 = SDATA (array) + idxval_byte; |
| 1964 { | 1964 { |
| 1965 if (idxval < 0 || idxval >= SCHARS (array)) | 1965 if (idxval < 0 || idxval >= SCHARS (array)) |
| 1966 args_out_of_range (array, idx); | 1966 args_out_of_range (array, idx); |
| 1967 CHECK_NUMBER (newelt); | 1967 CHECK_NUMBER (newelt); |
| 1968 | 1968 |
| 1969 if (XINT (newelt) < 0 || ASCII_CHAR_P (XINT (newelt))) | 1969 if (XINT (newelt) < 0 || ASCII_CHAR_P (XINT (newelt)) |
| 1970 || CHAR_BYTE8_P (XINT (newelt))) | |
| 1970 SSET (array, idxval, XINT (newelt)); | 1971 SSET (array, idxval, XINT (newelt)); |
| 1971 else | 1972 else |
| 1972 { | 1973 { |
| 1973 /* We must relocate the string data while converting it to | 1974 /* We must relocate the string data while converting it to |
| 1974 multibyte. */ | 1975 multibyte. */ |
