| 5999 |
return PCRE_ERROR_BADPARTIAL; |
return PCRE_ERROR_BADPARTIAL; |
| 6000 |
|
|
| 6001 |
/* Check a UTF-8 string if required. Pass back the character offset and error |
/* Check a UTF-8 string if required. Pass back the character offset and error |
| 6002 |
code if a results vector is available. */ |
code for an invalid string if a results vector is available. */ |
| 6003 |
|
|
| 6004 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 6005 |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
| 6006 |
{ |
{ |
| 6007 |
int errorcode; |
int erroroffset; |
| 6008 |
int tb = _pcre_valid_utf8((USPTR)subject, length, &errorcode); |
int errorcode = _pcre_valid_utf8((USPTR)subject, length, &erroroffset); |
| 6009 |
if (tb >= 0) |
if (errorcode != 0) |
| 6010 |
{ |
{ |
| 6011 |
if (offsetcount >= 2) |
if (offsetcount >= 2) |
| 6012 |
{ |
{ |
| 6013 |
offsets[0] = tb; |
offsets[0] = erroroffset; |
| 6014 |
offsets[1] = errorcode; |
offsets[1] = errorcode; |
| 6015 |
} |
} |
| 6016 |
return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)? |
return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)? |
| 6017 |
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
| 6018 |
} |
} |
| 6019 |
if (start_offset > 0 && start_offset < length) |
|
| 6020 |
{ |
/* Check that a start_offset points to the start of a UTF-8 character. */ |
| 6021 |
tb = ((USPTR)subject)[start_offset] & 0xc0; |
|
| 6022 |
if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; |
if (start_offset > 0 && start_offset < length && |
| 6023 |
} |
(((USPTR)subject)[start_offset] & 0xc0) == 0x80) |
| 6024 |
|
return PCRE_ERROR_BADUTF8_OFFSET; |
| 6025 |
} |
} |
| 6026 |
#endif |
#endif |
| 6027 |
|
|