summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-utf8/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-01-22 19:22:36 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2014-01-22 19:22:36 -0800
commit68f33d220bebea4096f9ccf512ea9b677e6de585 (patch)
tree143d39aa4784a3cd9d51076b3199d253332da90d /mrbgems/mruby-string-utf8/src
parent33dc9615d486d0663a9f5d06da0ca0735eab1532 (diff)
parent1717666662c484253c203e3596ddb0b561c90a21 (diff)
downloadmruby-68f33d220bebea4096f9ccf512ea9b677e6de585.tar.gz
mruby-68f33d220bebea4096f9ccf512ea9b677e6de585.zip
Merge pull request #1663 from h2so5/fix-utf8-codepage
fix utf8 codepage
Diffstat (limited to 'mrbgems/mruby-string-utf8/src')
-rw-r--r--mrbgems/mruby-string-utf8/src/string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mrbgems/mruby-string-utf8/src/string.c b/mrbgems/mruby-string-utf8/src/string.c
index 326d79e40..2dd848c86 100644
--- a/mrbgems/mruby-string-utf8/src/string.c
+++ b/mrbgems/mruby-string-utf8/src/string.c
@@ -7,7 +7,7 @@
/* TODO: duplicate definition in src/re.h */
#define REGEXP_CLASS "Regexp"
-static size_t utf8len_tab[256] =
+static const char utf8len_codepage[256] =
{
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -16,7 +16,7 @@ static size_t utf8len_tab[256] =
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,
};
static size_t
@@ -27,7 +27,7 @@ utf8len(unsigned char* p)
if (*p == 0)
return 1;
- len = utf8len_tab[*p];
+ len = utf8len_codepage[*p];
for (i = 1; i < len; ++i)
if ((p[i] & 0xc0) != 0x80)
return 1;