Mercurial > emacs
diff src/charset.c @ 21063:44845df088bc
(strwidth): Make it work for invalid bytes sequence.
(Fstring_width): Give byte length of STR to strwidth.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Wed, 04 Mar 1998 07:41:41 +0000 |
| parents | f3128abaf8aa |
| children | 50929073a0ba |
line wrap: on
line diff
--- a/src/charset.c Wed Mar 04 07:41:41 1998 +0000 +++ b/src/charset.c Wed Mar 04 07:41:41 1998 +0000 @@ -997,8 +997,8 @@ else { Lisp_Object disp; - int thiswidth; - int c = STRING_CHAR (str, endp - str); + int thislen; + int c = STRING_CHAR_AND_LENGTH (str, endp - str, thislen); /* Get the way the display table would display it. */ if (dp) @@ -1007,12 +1007,11 @@ disp = Qnil; if (VECTORP (disp)) - thiswidth = XVECTOR (disp)->size; + width += XVECTOR (disp)->size; else - thiswidth = ONE_BYTE_CHAR_WIDTH (*str); + width += ONE_BYTE_CHAR_WIDTH (*str); - width += thiswidth; - str += BYTES_BY_CHAR_HEAD (*str); + str += thislen; } } return width; @@ -1030,7 +1029,7 @@ Lisp_Object val; CHECK_STRING (str, 0); - XSETFASTINT (val, strwidth (XSTRING (str)->data, XSTRING (str)->size)); + XSETFASTINT (val, strwidth (XSTRING (str)->data, XSTRING (str)->size_byte)); return val; }
