#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
+#define ONIGENC_IS_CODE_DIGIT_ASCII(enc, code) \
+ ((code) < 128 && ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT))
+
#define DIGITVAL(code) ((code) - '0')
#define ODIGITVAL(code) DIGITVAL(code)
#define XDIGITVAL(enc,code) \
- (ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
+ (ONIGENC_IS_CODE_DIGIT_ASCII(enc,code) ? DIGITVAL(code) \
: (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
#define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
num = 0;
while (! PEND) {
PFETCH(c);
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) {
val = (unsigned int )DIGITVAL(c);
if ((INT_MAX_LIMIT - val) / 10UL < num)
return -1; /* overflow */
num = 0;
while (! PEND && maxlen-- != 0) {
PFETCH(c);
- if (ONIGENC_IS_CODE_DIGIT(enc, c) && c < '8') {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c) && c < '8') {
val = ODIGITVAL(c);
if ((INT_MAX_LIMIT - val) / 8UL < num)
return -1; /* overflow */
if (c == end_code)
return ONIGERR_EMPTY_GROUP_NAME;
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) {
*num_type = IS_ABS_NUM;
digit_count++;
}
}
if (*num_type != IS_NOT_NUM) {
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) {
digit_count++;
}
else {
goto end;
}
PFETCH(c);
- if (! ONIGENC_IS_CODE_DIGIT(enc, c)) goto err;
+ if (! ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) goto err;
PUNFETCH;
level = onig_scan_unsigned_number(&p, end, enc);
if (level < 0) return ONIGERR_TOO_BIG_NUMBER;
if (c == end_code)
return ONIGERR_EMPTY_GROUP_NAME;
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) {
if (ref == 1)
*num_type = IS_ABS_NUM;
else {
}
if (*num_type != IS_NOT_NUM) {
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)) {
digit_count++;
}
else {
if (num < 0) return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
if (!PEND) {
c2 = PPEEK;
- if (ONIGENC_IS_CODE_DIGIT(enc, c2))
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c2))
return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE;
}
num = scan_unsigned_octal_number(&p, end, 11, enc);
if (num < 0) return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
if (!PEND) {
- if (ONIGENC_IS_CODE_DIGIT(enc, PPEEK))
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, PPEEK))
return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE;
}
PFETCH(c);
if (PEND) return ONIGERR_END_PATTERN_IN_GROUP;
- if (ONIGENC_IS_CODE_DIGIT(enc, c)
+ if (ONIGENC_IS_CODE_DIGIT_ASCII(enc, c)
|| c == '-' || c == '+' || c == '<' || c == '\'') {
UChar* name_end;
int back_num;