version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2013/07/22 08:25:55
|
Line 76 BOOL
|
Line 76 BOOL
|
PRIV(is_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr, |
PRIV(is_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr, |
BOOL utf) |
BOOL utf) |
{ |
{ |
int c; | pcre_uint32 c; |
(void)utf; |
(void)utf; |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
if (utf) |
if (utf) |
Line 87 else
|
Line 87 else
|
#endif /* SUPPORT_UTF */ |
#endif /* SUPPORT_UTF */ |
c = *ptr; |
c = *ptr; |
|
|
|
/* Note that this function is called only for ANY or ANYCRLF. */ |
|
|
if (type == NLTYPE_ANYCRLF) switch(c) |
if (type == NLTYPE_ANYCRLF) switch(c) |
{ |
{ |
case 0x000a: *lenptr = 1; return TRUE; /* LF */ | case CHAR_LF: *lenptr = 1; return TRUE; |
case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1; | case CHAR_CR: *lenptr = (ptr < endptr - 1 && ptr[1] == CHAR_LF)? 2 : 1; |
return TRUE; /* CR */ | return TRUE; |
default: return FALSE; |
default: return FALSE; |
} |
} |
|
|
Line 99 if (type == NLTYPE_ANYCRLF) switch(c)
|
Line 101 if (type == NLTYPE_ANYCRLF) switch(c)
|
|
|
else switch(c) |
else switch(c) |
{ |
{ |
case 0x000a: /* LF */ | #ifdef EBCDIC |
case 0x000b: /* VT */ | case CHAR_NEL: |
case 0x000c: *lenptr = 1; return TRUE; /* FF */ | #endif |
case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1; | case CHAR_LF: |
return TRUE; /* CR */ | case CHAR_VT: |
| case CHAR_FF: *lenptr = 1; return TRUE; |
| |
| case CHAR_CR: |
| *lenptr = (ptr < endptr - 1 && ptr[1] == CHAR_LF)? 2 : 1; |
| return TRUE; |
| |
| #ifndef EBCDIC |
#ifdef COMPILE_PCRE8 |
#ifdef COMPILE_PCRE8 |
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */ | case CHAR_NEL: *lenptr = utf? 2 : 1; return TRUE; |
case 0x2028: /* LS */ |
case 0x2028: /* LS */ |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
#else | #else /* COMPILE_PCRE16 || COMPILE_PCRE32 */ |
case 0x0085: /* NEL */ | case CHAR_NEL: |
case 0x2028: /* LS */ |
case 0x2028: /* LS */ |
case 0x2029: *lenptr = 1; return TRUE; /* PS */ |
case 0x2029: *lenptr = 1; return TRUE; /* PS */ |
#endif /* COMPILE_PCRE8 */ | #endif /* COMPILE_PCRE8 */ |
| #endif /* Not EBCDIC */ |
| |
default: return FALSE; |
default: return FALSE; |
} |
} |
} |
} |
Line 140 BOOL
|
Line 151 BOOL
|
PRIV(was_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr, |
PRIV(was_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr, |
BOOL utf) |
BOOL utf) |
{ |
{ |
int c; | pcre_uint32 c; |
(void)utf; |
(void)utf; |
ptr--; |
ptr--; |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
Line 153 else
|
Line 164 else
|
#endif /* SUPPORT_UTF */ |
#endif /* SUPPORT_UTF */ |
c = *ptr; |
c = *ptr; |
|
|
|
/* Note that this function is called only for ANY or ANYCRLF. */ |
|
|
if (type == NLTYPE_ANYCRLF) switch(c) |
if (type == NLTYPE_ANYCRLF) switch(c) |
{ |
{ |
case 0x000a: *lenptr = (ptr > startptr && ptr[-1] == 0x0d)? 2 : 1; | case CHAR_LF: |
return TRUE; /* LF */ | *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1; |
case 0x000d: *lenptr = 1; return TRUE; /* CR */ | return TRUE; |
| |
| case CHAR_CR: *lenptr = 1; return TRUE; |
default: return FALSE; |
default: return FALSE; |
} |
} |
|
|
|
/* NLTYPE_ANY */ |
|
|
else switch(c) |
else switch(c) |
{ |
{ |
case 0x000a: *lenptr = (ptr > startptr && ptr[-1] == 0x0d)? 2 : 1; | case CHAR_LF: |
return TRUE; /* LF */ | *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1; |
case 0x000b: /* VT */ | return TRUE; |
case 0x000c: /* FF */ | |
case 0x000d: *lenptr = 1; return TRUE; /* CR */ | #ifdef EBCDIC |
| case CHAR_NEL: |
| #endif |
| case CHAR_VT: |
| case CHAR_FF: |
| case CHAR_CR: *lenptr = 1; return TRUE; |
| |
| #ifndef EBCDIC |
#ifdef COMPILE_PCRE8 |
#ifdef COMPILE_PCRE8 |
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */ | case CHAR_NEL: *lenptr = utf? 2 : 1; return TRUE; |
case 0x2028: /* LS */ | |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ | |
#else | |
case 0x0085: /* NEL */ | |
case 0x2028: /* LS */ |
case 0x2028: /* LS */ |
|
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
|
#else /* COMPILE_PCRE16 || COMPILE_PCRE32 */ |
|
case CHAR_NEL: |
|
case 0x2028: /* LS */ |
case 0x2029: *lenptr = 1; return TRUE; /* PS */ |
case 0x2029: *lenptr = 1; return TRUE; /* PS */ |
#endif /* COMPILE_PCRE8 */ | #endif /* COMPILE_PCRE8 */ |
| #endif /* NotEBCDIC */ |
| |
default: return FALSE; |
default: return FALSE; |
} |
} |
} |
} |