projects
/
m17n
/
m17n-lib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0d31df
)
(count_utf_16_chars): Count each code of invalid
author
handa
<handa>
Wed, 22 Sep 2004 00:07:43 +0000
(
00:07
+0000)
committer
handa
<handa>
Wed, 22 Sep 2004 00:07:43 +0000
(
00:07
+0000)
surrogates as one.
src/mtext.c
patch
|
blob
|
history
diff --git
a/src/mtext.c
b/src/mtext.c
index
f34586f
..
7f17852
100644
(file)
--- a/
src/mtext.c
+++ b/
src/mtext.c
@@
-449,22
+449,18
@@
count_utf_16_chars (const void *data, int nitems, int swap)
if (prev_surrogate)
{
if (c < 0xDC00 || c >= 0xE000)
- return -1;
- prev_surrogate = 0;
+ /* Invalid surrogate */
+ nchars++;
}
else
{
- if (c < 0xD800)
- ;
- else if (c < 0xDC00)
+ if (c >= 0xD800 && c < 0xDC00)
prev_surrogate = 1;
- else if (c < 0xE000)
- return -1;
nchars++;
}
}
if (prev_surrogate)
- return -1;
+ nchars++;
return nchars;
}