summaryrefslogtreecommitdiff
path: root/src/unicode.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-12-21 20:06:28 +0100
committerJörg Frings-Fürst <debian@jff.email>2018-12-21 20:06:28 +0100
commitf883fa5bd37b6420f5dc25027a68289c64028063 (patch)
tree80452d3b1840e553402538830e903ed9fecdb3a8 /src/unicode.c
parent66dfd6613394a8903701840bbc9d67de537e597e (diff)
parentf1aff0cc17934fa45d9520dae6986562e033cb8f (diff)
Merge branch 'release/debian/6.9.1-1'debian/6.9.1-1
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;