Mercurial > hg > octave-nkf > gnulib-hg
changeset 3043:f37a719abeac
(mbsnwidth): Don't loop endlessly when called with an
invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Fri, 08 Dec 2000 18:31:38 +0000 |
parents | a7d1b4f47708 |
children | 286243612b57 |
files | lib/mbswidth.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/mbswidth.c +++ b/lib/mbswidth.c @@ -153,7 +153,11 @@ /* An invalid multibyte sequence was encountered. */ { if (flags & MBSW_ACCEPT_INVALID) - break; + { + p++; + width++; + break; + } else return -1; } @@ -162,7 +166,11 @@ /* An incomplete multibyte character at the end. */ { if (flags & MBSW_ACCEPT_INVALID) - break; + { + p = plimit; + width++; + break; + } else return -1; }