Mercurial > emacs
changeset 35950:d2c753cf5c34
(parse_str_to_multibyte): New function.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 07 Feb 2001 04:24:49 +0000 |
parents | 6f52e8c1039f |
children | c5792fd59359 |
files | src/charset.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/charset.c Wed Feb 07 04:24:28 2001 +0000 +++ b/src/charset.c Wed Feb 07 04:24:49 2001 +0000 @@ -1535,6 +1535,23 @@ return (to - str); } +/* Parse unibyte string at STR of LEN bytes, and return the number of + bytes it may ocupy when converted to multibyte string by + `str_to_multibyte'. */ + +int +parse_str_to_multibyte (str, len) + unsigned char *str; + int len; +{ + unsigned char *endp = str + len; + int bytes; + + for (bytes = 0; str < endp; str++) + bytes += (*str < 0x80 || *str >= 0xA0) ? 1 : 2; + return bytes; +} + /* Convert unibyte text at STR of NBYTES bytes to multibyte text that contains the same single-byte characters. It actually converts all 8-bit characters to multibyte forms. It is assured