projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
392bf2a
)
(mbsnwidth): Don't loop endlessly when called with an
author
Jim Meyering
<jim@meyering.net>
Fri, 8 Dec 2000 18:31:38 +0000
(18:31 +0000)
committer
Jim Meyering
<jim@meyering.net>
Fri, 8 Dec 2000 18:31:38 +0000
(18:31 +0000)
invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
lib/mbswidth.c
patch
|
blob
|
history
diff --git
a/lib/mbswidth.c
b/lib/mbswidth.c
index f196ac18dc21e4c342fef6bd4ccb631a97fc719d..bb6aa1a6d8e83587591ca558483f212d371be947 100644
(file)
--- a/
lib/mbswidth.c
+++ b/
lib/mbswidth.c
@@
-153,7
+153,11
@@
mbsnwidth (const char *string, size_t nbytes, int flags)
/* An invalid multibyte sequence was encountered. */
{
if (flags & MBSW_ACCEPT_INVALID)
- break;
+ {
+ p++;
+ width++;
+ break;
+ }
else
return -1;
}
@@
-162,7
+166,11
@@
mbsnwidth (const char *string, size_t nbytes, int flags)
/* An incomplete multibyte character at the end. */
{
if (flags & MBSW_ACCEPT_INVALID)
- break;
+ {
+ p = plimit;
+ width++;
+ break;
+ }
else
return -1;
}