diff options
| author | Kenichi Handa | 1998-05-22 09:44:27 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-05-22 09:44:27 +0000 |
| commit | 872a36d2e63595326598eb4d1b2f91f9f008c0e8 (patch) | |
| tree | 7be89a2d874f1d3089f5be480cb9114e5b29efb9 /src | |
| parent | af57e0fa0d6b924f15979fcc430782c44bba2aef (diff) | |
| download | emacs-872a36d2e63595326598eb4d1b2f91f9f008c0e8.tar.gz emacs-872a36d2e63595326598eb4d1b2f91f9f008c0e8.zip | |
(print_string): Don't ignore garbage bytes following a
multibyte characters.
(print): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/print.c b/src/print.c index 49a0610860e..2b1e046336d 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -589,8 +589,8 @@ print_string (string, printcharfun) | |||
| 589 | /* Here, we must convert each multi-byte form to the | 589 | /* Here, we must convert each multi-byte form to the |
| 590 | corresponding character code before handing it to PRINTCHAR. */ | 590 | corresponding character code before handing it to PRINTCHAR. */ |
| 591 | int len; | 591 | int len; |
| 592 | int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i, | 592 | int ch = STRING_CHAR_AND_CHAR_LENGTH (XSTRING (string)->data + i, |
| 593 | size_byte - i, len); | 593 | size_byte - i, len); |
| 594 | 594 | ||
| 595 | PRINTCHAR (ch); | 595 | PRINTCHAR (ch); |
| 596 | i += len; | 596 | i += len; |
| @@ -1188,6 +1188,7 @@ print (obj, printcharfun, escapeflag) | |||
| 1188 | register int i, i_byte; | 1188 | register int i, i_byte; |
| 1189 | register unsigned char c; | 1189 | register unsigned char c; |
| 1190 | struct gcpro gcpro1; | 1190 | struct gcpro gcpro1; |
| 1191 | unsigned char *str; | ||
| 1191 | int size_byte; | 1192 | int size_byte; |
| 1192 | /* 1 means we must ensure that the next character we output | 1193 | /* 1 means we must ensure that the next character we output |
| 1193 | cannot be taken as part of a hex character escape. */ | 1194 | cannot be taken as part of a hex character escape. */ |
| @@ -1204,6 +1205,7 @@ print (obj, printcharfun, escapeflag) | |||
| 1204 | #endif | 1205 | #endif |
| 1205 | 1206 | ||
| 1206 | PRINTCHAR ('\"'); | 1207 | PRINTCHAR ('\"'); |
| 1208 | str = XSTRING (obj)->data; | ||
| 1207 | size_byte = STRING_BYTES (XSTRING (obj)); | 1209 | size_byte = STRING_BYTES (XSTRING (obj)); |
| 1208 | 1210 | ||
| 1209 | for (i = 0, i_byte = 0; i_byte < size_byte;) | 1211 | for (i = 0, i_byte = 0; i_byte < size_byte;) |
| @@ -1214,9 +1216,13 @@ print (obj, printcharfun, escapeflag) | |||
| 1214 | int c; | 1216 | int c; |
| 1215 | 1217 | ||
| 1216 | if (STRING_MULTIBYTE (obj)) | 1218 | if (STRING_MULTIBYTE (obj)) |
| 1217 | FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte); | 1219 | { |
| 1220 | c = STRING_CHAR_AND_CHAR_LENGTH (str + i_byte, | ||
| 1221 | size_byte - i_byte, len); | ||
| 1222 | i_byte += len; | ||
| 1223 | } | ||
| 1218 | else | 1224 | else |
| 1219 | c = XSTRING (obj)->data[i_byte++]; | 1225 | c = str[i_byte++]; |
| 1220 | 1226 | ||
| 1221 | QUIT; | 1227 | QUIT; |
| 1222 | 1228 | ||