summaryrefslogtreecommitdiff
path: root/src/unicode.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-12-21 13:48:39 +0100
committerJörg Frings-Fürst <debian@jff.email>2018-12-21 13:48:39 +0100
commitdba488ef4af76742cde7f5b03ef6f5453146eda6 (patch)
tree11c318e8ebd9eaab67edb50af33d510092264b90 /src/unicode.c
parenteb5b295d37e9150e169cc95cbbc39f6ab7b88b2f (diff)
parent70de057dbb5ea79536834e156f534279347f96f3 (diff)
Update upstream source from tag 'upstream/6.9.1'
Update to upstream version '6.9.1' with Debian dir 30a97dee62f9f2b7c7a57e0e6622d9f503cf0256
Diffstat (limited to 'src/unicode.c')
-rw-r--r--src/unicode.c16
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;