diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-12-21 13:48:35 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-12-21 13:48:35 +0100 |
commit | 70de057dbb5ea79536834e156f534279347f96f3 (patch) | |
tree | e7fc439a3c893ffe8358d3d0c26a112d4b4cf89d /src/unicode.c | |
parent | c9b3c26db59d89e320a6eb86d9558051ecba0900 (diff) |
New upstream version 6.9.1upstream/6.9.1
Diffstat (limited to 'src/unicode.c')
-rw-r--r-- | src/unicode.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/unicode.c b/src/unicode.c index 63bc65c..04944b9 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -657,8 +657,7 @@ onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev, #ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER if (! ONIGENC_IS_UNICODE_ENCODING(enc)) { - if (from == 0x000d && to == 0x000a) return 0; - else return 1; + return from != 0x000d || to != 0x000a; } btype = unicode_egcb_is_break_2code(from, to); @@ -701,8 +700,7 @@ onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev, return 1; #else - if (from == 0x000d && to == 0x000a) return 0; - else return 1; + return from != 0x000d || to != 0x000a; #endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */ } @@ -729,6 +727,7 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges) int len; int c; char* s; + UChar* uname; if (UserDefinedPropertyNum >= USER_DEFINED_PROPERTY_MAX_NUM) return ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS; @@ -741,10 +740,11 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges) if (s == 0) return ONIGERR_MEMORY; + uname = (UChar* )name; n = 0; for (i = 0; i < len; i++) { - c = name[i]; - if (c <= 0 || c >= 0x80) { + c = uname[i]; + if (c < 0x20 || c >= 0x80) { xfree(s); return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } @@ -758,6 +758,10 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges) if (UserDefinedPropertyTable == 0) { UserDefinedPropertyTable = onig_st_init_strend_table_with_size(10); + if (IS_NULL(UserDefinedPropertyTable)) { + xfree(s); + return ONIGERR_MEMORY; + } } e = UserDefinedPropertyRanges + UserDefinedPropertyNum; |