diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-11-21 10:48:42 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-11-21 10:48:42 +0000 |
commit | c48ca85a9456be9a04cb0b92df853d6dac797414 (patch) | |
tree | b3bc521693c1cabe0b24ded1d6b21bc6420fc15a | |
parent | 7621a7a2aaf2c80118e6d43a3689f010f5d09b92 (diff) | |
download | pcre-c48ca85a9456be9a04cb0b92df853d6dac797414.tar.gz |
Apply Zoltan's big patch.
git-svn-id: svn://vcs.exim.org/pcre/code/branches/pcre16@756 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | pcre_compile.c | 352 | ||||
-rw-r--r-- | pcre_dfa_exec.c | 85 | ||||
-rw-r--r-- | pcre_exec.c | 102 | ||||
-rw-r--r-- | pcre_fullinfo.c | 6 | ||||
-rw-r--r-- | pcre_get.c | 16 | ||||
-rw-r--r-- | pcre_internal.h | 242 | ||||
-rw-r--r-- | pcre_jit_compile.c | 192 | ||||
-rw-r--r-- | pcre_newline.c | 6 | ||||
-rw-r--r-- | pcre_ord2utf8.c | 2 | ||||
-rw-r--r-- | pcre_printint.src | 8 | ||||
-rw-r--r-- | pcre_study.c | 36 | ||||
-rw-r--r-- | pcre_tables.c | 17 | ||||
-rw-r--r-- | pcre_ucd.c | 8 | ||||
-rw-r--r-- | pcre_valid_utf8.c | 4 | ||||
-rw-r--r-- | pcre_xclass.c | 2 | ||||
-rw-r--r-- | pcretest.c | 89 |
16 files changed, 587 insertions, 580 deletions
diff --git a/pcre_compile.c b/pcre_compile.c index 0252261..55d4226 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -231,7 +231,7 @@ static const char posix_names[] = STRING_graph0 STRING_print0 STRING_punct0 STRING_space0 STRING_word0 STRING_xdigit; -static const uschar posix_name_lengths[] = { +static const pcre_uint8 posix_name_lengths[] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 }; /* Table of class bit maps for each POSIX class. Each class is formed from a @@ -266,47 +266,67 @@ substitutes must be in the order of the names, defined above, and there are both positive and negative cases. NULL means no substitute. */ #ifdef SUPPORT_UCP -static const uschar *substitutes[] = { - (uschar *)"\\P{Nd}", /* \D */ - (uschar *)"\\p{Nd}", /* \d */ - (uschar *)"\\P{Xsp}", /* \S */ /* NOTE: Xsp is Perl space */ - (uschar *)"\\p{Xsp}", /* \s */ - (uschar *)"\\P{Xwd}", /* \W */ - (uschar *)"\\p{Xwd}" /* \w */ +static const pcre_uchar literal_PNd[] = { '\\', 'P', '{', 'N', 'd', '}', '\0' }; +static const pcre_uchar literal_pNd[] = { '\\', 'p', '{', 'N', 'd', '}', '\0' }; +static const pcre_uchar literal_PXsp[] = { '\\', 'P', '{', 'X', 's', 'p', '}', '\0' }; +static const pcre_uchar literal_pXsp[] = { '\\', 'p', '{', 'X', 's', 'p', '}', '\0' }; +static const pcre_uchar literal_PXwd[] = { '\\', 'P', '{', 'X', 'w', 'd', '}', '\0' }; +static const pcre_uchar literal_pXwd[] = { '\\', 'p', '{', 'X', 'w', 'd', '}', '\0' }; + +static const pcre_uchar *substitutes[] = { + literal_PNd, /* \D */ + literal_pNd, /* \d */ + literal_PXsp, /* \S */ /* NOTE: Xsp is Perl space */ + literal_pXsp, /* \s */ + literal_PXwd, /* \W */ + literal_pXwd /* \w */ }; -static const uschar *posix_substitutes[] = { - (uschar *)"\\p{L}", /* alpha */ - (uschar *)"\\p{Ll}", /* lower */ - (uschar *)"\\p{Lu}", /* upper */ - (uschar *)"\\p{Xan}", /* alnum */ - NULL, /* ascii */ - (uschar *)"\\h", /* blank */ - NULL, /* cntrl */ - (uschar *)"\\p{Nd}", /* digit */ - NULL, /* graph */ - NULL, /* print */ - NULL, /* punct */ - (uschar *)"\\p{Xps}", /* space */ /* NOTE: Xps is POSIX space */ - (uschar *)"\\p{Xwd}", /* word */ - NULL, /* xdigit */ +static const pcre_uchar literal_pL[] = { '\\', 'p', '{', 'L', '}', '\0' }; +static const pcre_uchar literal_pLl[] = { '\\', 'p', '{', 'L', 'l', '}', '\0' }; +static const pcre_uchar literal_pLu[] = { '\\', 'p', '{', 'L', 'u', '}', '\0' }; +static const pcre_uchar literal_pXan[] = { '\\', 'p', '{', 'X', 'a', 'n', '}', '\0' }; +static const pcre_uchar literal_h[] = { '\\', 'h', '\0' }; +static const pcre_uchar literal_pXps[] = { '\\', 'p', '{', 'X', 'p', 's', '}', '\0' }; +static const pcre_uchar literal_PL[] = { '\\', 'P', '{', 'L', '}', '\0' }; +static const pcre_uchar literal_PLl[] = { '\\', 'P', '{', 'L', 'l', '}', '\0' }; +static const pcre_uchar literal_PLu[] = { '\\', 'P', '{', 'L', 'u', '}', '\0' }; +static const pcre_uchar literal_PXan[] = { '\\', 'P', '{', 'X', 'a', 'n', '}', '\0' }; +static const pcre_uchar literal_H[] = { '\\', 'H', '\0' }; +static const pcre_uchar literal_PXps[] = { '\\', 'P', '{', 'X', 'p', 's', '}', '\0' }; + +static const pcre_uchar *posix_substitutes[] = { + literal_pL, /* alpha */ + literal_pLl, /* lower */ + literal_pLu, /* upper */ + literal_pXan, /* alnum */ + NULL, /* ascii */ + literal_h, /* blank */ + NULL, /* cntrl */ + literal_pNd, /* digit */ + NULL, /* graph */ + NULL, /* print */ + NULL, /* punct */ + literal_pXps, /* space */ /* NOTE: Xps is POSIX space */ + literal_pXwd, /* word */ + NULL, /* xdigit */ /* Negated cases */ - (uschar *)"\\P{L}", /* ^alpha */ - (uschar *)"\\P{Ll}", /* ^lower */ - (uschar *)"\\P{Lu}", /* ^upper */ - (uschar *)"\\P{Xan}", /* ^alnum */ - NULL, /* ^ascii */ - (uschar *)"\\H", /* ^blank */ - NULL, /* ^cntrl */ - (uschar *)"\\P{Nd}", /* ^digit */ - NULL, /* ^graph */ - NULL, /* ^print */ - NULL, /* ^punct */ - (uschar *)"\\P{Xps}", /* ^space */ /* NOTE: Xps is POSIX space */ - (uschar *)"\\P{Xwd}", /* ^word */ - NULL /* ^xdigit */ + literal_PL, /* ^alpha */ + literal_PLl, /* ^lower */ + literal_PLu, /* ^upper */ + literal_PXan, /* ^alnum */ + NULL, /* ^ascii */ + literal_H, /* ^blank */ + NULL, /* ^cntrl */ + literal_PNd, /* ^digit */ + NULL, /* ^graph */ + NULL, /* ^print */ + NULL, /* ^punct */ + literal_PXps, /* ^space */ /* NOTE: Xps is POSIX space */ + literal_PXwd, /* ^word */ + NULL /* ^xdigit */ }; -#define POSIX_SUBSIZE (sizeof(posix_substitutes)/sizeof(uschar *)) +#define POSIX_SUBSIZE (sizeof(posix_substitutes) / sizeof(pcre_uchar *)) #endif #define STRING(a) # a @@ -548,7 +568,7 @@ static const unsigned char ebcdic_chartab[] = { /* chartable partial dup */ /* Definition to allow mutual recursion */ static BOOL - compile_regex(int, uschar **, const uschar **, int *, BOOL, BOOL, int, int, + compile_regex(int, pcre_uchar **, const pcre_uchar **, int *, BOOL, BOOL, int, int, int *, int *, branch_chain *, compile_data *, int *); @@ -595,7 +615,7 @@ Returns: TRUE or FALSE */ static BOOL -is_counted_repeat(const uschar *p) +is_counted_repeat(const pcre_uchar *p) { if ((digitab[*p++] & ctype_digit) == 0) return FALSE; while ((digitab[*p] & ctype_digit) != 0) p++; @@ -637,11 +657,11 @@ Returns: zero or positive => a data character */ static int -check_escape(const uschar **ptrptr, int *errorcodeptr, int bracount, +check_escape(const pcre_uchar **ptrptr, int *errorcodeptr, int bracount, int options, BOOL isclass) { BOOL utf8 = (options & PCRE_UTF8) != 0; -const uschar *ptr = *ptrptr + 1; +const pcre_uchar *ptr = *ptrptr + 1; int c, i; GETCHARINCTEST(c, ptr); /* Get character value, increment pointer */ @@ -668,7 +688,7 @@ else if ((i = escapes[c - 0x48]) != 0) c = i; else { - const uschar *oldptr; + const pcre_uchar *oldptr; BOOL braced, negated; switch (c) @@ -741,7 +761,7 @@ else if (ptr[1] == CHAR_LEFT_CURLY_BRACKET) { - const uschar *p; + const pcre_uchar *p; for (p = ptr+2; *p != 0 && *p != CHAR_RIGHT_CURLY_BRACKET; p++) if (*p != CHAR_MINUS && (digitab[*p] & ctype_digit) == 0) break; if (*p != 0 && *p != CHAR_RIGHT_CURLY_BRACKET) @@ -883,7 +903,7 @@ else if (ptr[1] == CHAR_LEFT_CURLY_BRACKET) { - const uschar *pt = ptr + 2; + const pcre_uchar *pt = ptr + 2; int count = 0; c = 0; @@ -1014,10 +1034,10 @@ Returns: type value from ucp_type_table, or -1 for an invalid type */ static int -get_ucp(const uschar **ptrptr, BOOL *negptr, int *dptr, int *errorcodeptr) +get_ucp(const pcre_uchar **ptrptr, BOOL *negptr, int *dptr, int *errorcodeptr) { int c, i, bot, top; -const uschar *ptr = *ptrptr; +const pcre_uchar *ptr = *ptrptr; char name[32]; c = *(++ptr); @@ -1106,8 +1126,8 @@ Returns: pointer to '}' on success; current ptr on error, with errorcodeptr set non-zero */ -static const uschar * -read_repeat_counts(const uschar *p, int *minp, int *maxp, int *errorcodeptr) +static const pcre_uchar * +read_repeat_counts(const pcre_uchar *p, int *minp, int *maxp, int *errorcodeptr) { int min = 0; int max = -1; @@ -1192,10 +1212,10 @@ Returns: the number of the named subpattern, or -1 if not found */ static int -find_parens_sub(uschar **ptrptr, compile_data *cd, const uschar *name, int lorn, +find_parens_sub(pcre_uchar **ptrptr, compile_data *cd, const pcre_uchar *name, int lorn, BOOL xmode, BOOL utf8, int *count) { -uschar *ptr = *ptrptr; +pcre_uchar *ptr = *ptrptr; int start_count = *count; int hwm_count = start_count; BOOL dup_parens = FALSE; @@ -1262,7 +1282,7 @@ if (ptr[0] == CHAR_LEFT_PARENTHESIS) ptr[1] != CHAR_EQUALS_SIGN) || *ptr == CHAR_APOSTROPHE) { int term; - const uschar *thisname; + const pcre_uchar *thisname; *count += 1; if (name == NULL && *count == lorn) return *count; term = *ptr++; @@ -1425,10 +1445,10 @@ Returns: the number of the found subpattern, or -1 if not found */ static int -find_parens(compile_data *cd, const uschar *name, int lorn, BOOL xmode, +find_parens(compile_data *cd, const pcre_uchar *name, int lorn, BOOL xmode, BOOL utf8) { -uschar *ptr = (uschar *)cd->start_pattern; +pcre_uchar *ptr = (pcre_uchar *)cd->start_pattern; int count = 0; int rc; @@ -1466,8 +1486,8 @@ Arguments: Returns: pointer to the first significant opcode */ -static const uschar* -first_significant_code(const uschar *code, BOOL skipassert) +static const pcre_uchar* +first_significant_code(const pcre_uchar *code, BOOL skipassert) { for (;;) { @@ -1534,12 +1554,12 @@ Returns: the fixed length, */ static int -find_fixedlength(uschar *code, BOOL utf8, BOOL atend, compile_data *cd) +find_fixedlength(pcre_uchar *code, BOOL utf8, BOOL atend, compile_data *cd) { int length = -1; register int branchlength = 0; -register uschar *cc = code + 1 + LINK_SIZE; +register pcre_uchar *cc = code + 1 + LINK_SIZE; /* Scan along the opcodes for this branch. If we get to the end of the branch, check the length against that of the other branches. */ @@ -1547,7 +1567,7 @@ branch, check the length against that of the other branches. */ for (;;) { int d; - uschar *ce, *cs; + pcre_uchar *ce, *cs; register int op = *cc; switch (op) { @@ -1592,9 +1612,9 @@ for (;;) case OP_RECURSE: if (!atend) return -3; - cs = ce = (uschar *)cd->start_code + GET(cc, 1); /* Start subpattern */ - do ce += GET(ce, 1); while (*ce == OP_ALT); /* End subpattern */ - if (cc > cs && cc < ce) return -1; /* Recursion */ + cs = ce = (pcre_uchar *)cd->start_code + GET(cc, 1); /* Start subpattern */ + do ce += GET(ce, 1); while (*ce == OP_ALT); /* End subpattern */ + if (cc > cs && cc < ce) return -1; /* Recursion */ d = find_fixedlength(cs + 2, utf8, atend, cd); if (d < 0) return d; branchlength += d; @@ -1855,8 +1875,8 @@ Arguments: Returns: pointer to the opcode for the bracket, or NULL if not found */ -const uschar * -_pcre_find_bracket(const uschar *code, BOOL utf8, int number) +const pcre_uchar * +_pcre_find_bracket(const pcre_uchar *code, BOOL utf8, int number) { for (;;) { @@ -1874,7 +1894,7 @@ for (;;) else if (c == OP_REVERSE) { - if (number < 0) return (uschar *)code; + if (number < 0) return (pcre_uchar *)code; code += _pcre_OP_lengths[c]; } @@ -1884,7 +1904,7 @@ for (;;) c == OP_CBRAPOS || c == OP_SCBRAPOS) { int n = GET2(code, 1+LINK_SIZE); - if (n == number) return (uschar *)code; + if (n == number) return (pcre_uchar *)code; code += _pcre_OP_lengths[c]; } @@ -1992,8 +2012,8 @@ Arguments: Returns: pointer to the opcode for OP_RECURSE, or NULL if not found */ -static const uschar * -find_recurse(const uschar *code, BOOL utf8) +static const pcre_uchar * +find_recurse(const pcre_uchar *code, BOOL utf8) { for (;;) { @@ -2119,15 +2139,15 @@ Returns: TRUE if what is matched could be empty */ static BOOL -could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8, - compile_data *cd) +could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode, + BOOL utf8, compile_data *cd) { register int c; for (code = first_significant_code(code + _pcre_OP_lengths[*code], TRUE); code < endcode; code = first_significant_code(code + _pcre_OP_lengths[c], TRUE)) { - const uschar *ccode; + const pcre_uchar *ccode; c = *code; @@ -2150,7 +2170,7 @@ for (code = first_significant_code(code + _pcre_OP_lengths[*code], TRUE); if (c == OP_RECURSE) { - const uschar *scode; + const pcre_uchar *scode; BOOL empty_branch; /* Test for forward reference */ @@ -2417,8 +2437,8 @@ Returns: TRUE if what is matched could be empty */ static BOOL -could_be_empty(const uschar *code, const uschar *endcode, branch_chain *bcptr, - BOOL utf8, compile_data *cd) +could_be_empty(const pcre_uchar *code, const pcre_uchar *endcode, + branch_chain *bcptr, BOOL utf8, compile_data *cd) { while (bcptr != NULL && bcptr->current_branch >= code) { @@ -2474,7 +2494,7 @@ Returns: TRUE or FALSE */ static BOOL -check_posix_syntax(const uschar *ptr, const uschar **endptr) +check_posix_syntax(const pcre_uchar *ptr, const pcre_uchar **endptr) { int terminator; /* Don't combine these lines; the Solaris cc */ terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */ @@ -2518,7 +2538,7 @@ Returns: a value representing the name, or -1 if unknown */ static int -check_posix_name(const uschar *ptr, int len) +check_posix_name(const pcre_uchar *ptr, int len) { const char *pn = posix_names; register int yield = 0; @@ -2565,15 +2585,15 @@ Returns: nothing */ static void -adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd, - uschar *save_hwm) +adjust_recurse(pcre_uchar *group, int adjust, BOOL utf8, compile_data *cd, + pcre_uchar *save_hwm) { -uschar *ptr = group; +pcre_uchar *ptr = group; -while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL) +while ((ptr = (pcre_uchar *)find_recurse(ptr, utf8)) != NULL) { int offset; - uschar *hc; + pcre_uchar *hc; /* See if this recursion is on the forward reference list. If so, adjust the reference. */ @@ -2618,14 +2638,14 @@ Arguments: Returns: new code pointer */ -static uschar * -auto_callout(uschar *code, const uschar *ptr, compile_data *cd) +static pcre_uchar * +auto_callout(pcre_uchar *code, const pcre_uchar *ptr, compile_data *cd) { *code++ = OP_CALLOUT; *code++ = 255; PUT(code, 0, (int)(ptr - cd->start_pattern)); /* Pattern offset */ PUT(code, LINK_SIZE, 0); /* Default length */ -return code + 2*LINK_SIZE; +return code + 2 * LINK_SIZE; } @@ -2647,7 +2667,7 @@ Returns: nothing */ static void -complete_callout(uschar *previous_callout, const uschar *ptr, compile_data *cd) +complete_callout(pcre_uchar *previous_callout, const pcre_uchar *ptr, compile_data *cd) { int length = (int)(ptr - cd->start_pattern - GET(previous_callout, 2)); PUT(previous_callout, 2 + LINK_SIZE, length); @@ -2785,8 +2805,8 @@ Returns: TRUE if possessifying is wanted */ static BOOL -check_auto_possessive(const uschar *previous, BOOL utf8, const uschar *ptr, - int options, compile_data *cd) +check_auto_possessive(const pcre_uchar *previous, BOOL utf8, + const pcre_uchar *ptr, int options, compile_data *cd) { int c, next; int op_code = *previous++; @@ -3214,9 +3234,10 @@ Returns: TRUE on success */ static BOOL -compile_branch(int *optionsptr, uschar **codeptr, const uschar **ptrptr, - int *errorcodeptr, int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, - int cond_depth, compile_data *cd, int *lengthptr) +compile_branch(int *optionsptr, pcre_uchar **codeptr, + const pcre_uchar **ptrptr, int *errorcodeptr, int *firstbyteptr, + int *reqbyteptr, branch_chain *bcptr, int cond_depth, compile_data *cd, + int *lengthptr) { int repeat_type, op_type; int repeat_min = 0, repeat_max = 0; /* To please picky compilers */ @@ -3229,19 +3250,19 @@ int options = *optionsptr; /* May change dynamically */ int after_manual_callout = 0; int length_prevgroup = 0; register int c; -register uschar *code = *codeptr; -uschar *last_code = code; -uschar *orig_code = code; -uschar *tempcode; +register pcre_uchar *code = *codeptr; +pcre_uchar *last_code = code; +pcre_uchar *orig_code = code; +pcre_uchar *tempcode; BOOL inescq = FALSE; BOOL groupsetfirstbyte = FALSE; -const uschar *ptr = *ptrptr; -const uschar *tempptr; -const uschar *nestptr = NULL; -uschar *previous = NULL; -uschar *previous_callout = NULL; -uschar *save_hwm = NULL; -uschar classbits[32]; +const pcre_uchar *ptr = *ptrptr; +const pcre_uchar *tempptr; +const pcre_uchar *nestptr = NULL; +pcre_uchar *previous = NULL; +pcre_uchar *previous_callout = NULL; +pcre_uchar *save_hwm = NULL; +pcre_uchar classbits[32]; /* We can fish out the UTF-8 setting once and for all into a BOOL, but we must not do this for other options (e.g. PCRE_EXTENDED) because they may change @@ -3250,9 +3271,9 @@ dynamically as we process the pattern. */ #ifdef SUPPORT_UTF8 BOOL class_utf8; BOOL utf8 = (options & PCRE_UTF8) != 0; -uschar *class_utf8data; -uschar *class_utf8data_base; -uschar utf8_char[6]; +pcre_uint8 *class_utf8data; +pcre_uint8 *class_utf8data_base; +pcre_uint8 utf8_char[6]; #else BOOL utf8 = FALSE; #endif @@ -3306,7 +3327,7 @@ for (;; ptr++) int terminator; int mclength; int tempbracount; - uschar mcbuffer[8]; + pcre_uchar mcbuffer[8]; /* Get next byte in the pattern */ @@ -3605,7 +3626,7 @@ for (;; ptr++) than 256), because in that case the compiled code doesn't use the bit map. */ - memset(classbits, 0, 32 * sizeof(uschar)); + memset(classbits, 0, 32 * sizeof(pcre_uint8)); #ifdef SUPPORT_UTF8 class_utf8 = FALSE; /* No chars >= 256 */ @@ -3619,7 +3640,7 @@ for (;; ptr++) if (c != 0) do { - const uschar *oldptr; + const pcre_uchar *oldptr; #ifdef SUPPORT_UTF8 if (utf8 && c > 127) @@ -3665,8 +3686,8 @@ for (;; ptr++) { BOOL local_negate = FALSE; int posix_class, taboffset, tabopt; - register const uschar *cbits = cd->cbits; - uschar pbits[32]; + register const pcre_uint8 *cbits = cd->cbits; + pcre_uint8 pbits[32]; if (ptr[1] != CHAR_COLON) { @@ -3721,7 +3742,7 @@ for (;; ptr++) /* Copy in the first table (always present) */ memcpy(pbits, cbits + posix_class_maps[posix_class], - 32 * sizeof(uschar)); + 32 * sizeof(pcre_uint8)); /* If there is a second table, add or remove it as required. */ @@ -3783,7 +3804,7 @@ for (;; ptr++) if (c < 0) { - register const uschar *cbits = cd->cbits; + register const pcre_uint8 *cbits = cd->cbits; class_charcount += 2; /* Greater than 1 is what matters */ switch (-c) @@ -4468,7 +4489,7 @@ for (;; ptr++) #ifdef SUPPORT_UTF8 if (utf8 && (code[-1] & 0x80) != 0) { - uschar *lastchar = code - 1; + pcre_uchar *lastchar = code - 1; while((*lastchar & 0xc0) == 0x80) lastchar--; c = code - lastchar; /* Length of UTF-8 character */ memcpy(utf8_char, lastchar, c); /* Save the char */ @@ -4530,7 +4551,7 @@ for (;; ptr++) else if (*previous < OP_EODN) { - uschar *oldcode; + pcre_uchar *oldcode; int prop_type, prop_value; op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */ c = *previous; @@ -4752,8 +4773,8 @@ for (;; ptr++) { register int i; int len = (int)(code - previous); - uschar *bralink = NULL; - uschar *brazeroptr = NULL; + pcre_uchar *bralink = NULL; + pcre_uchar *brazeroptr = NULL; /* Repeating a DEFINE group is pointless, but Perl allows the syntax, so we just ignore the repeat. */ @@ -4884,8 +4905,8 @@ for (;; ptr++) if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte; for (i = 1; i < repeat_min; i++) { - uschar *hc; - uschar *this_hwm = cd->hwm; + pcre_uchar *hc; + pcre_uchar *this_hwm = cd->hwm; memcpy(code, previous, len); for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE) { @@ -4936,8 +4957,8 @@ for (;; ptr++) else for (i = repeat_max - 1; i >= 0; i--) { - uschar *hc; - uschar *this_hwm = cd->hwm; + pcre_uchar *hc; + pcre_uchar *this_hwm = cd->hwm; *code++ = OP_BRAZERO + repeat_type; @@ -4970,7 +4991,7 @@ for (;; ptr++) { int oldlinkoffset; int offset = (int)(code - bralink + 1); - uschar *bra = code - offset; + pcre_uchar *bra = code - offset; oldlinkoffset = GET(bra, 1); bralink = (oldlinkoffset == 0)? NULL : bralink - oldlinkoffset; *code++ = OP_KET; @@ -5006,8 +5027,8 @@ for (;; ptr++) else { - uschar *ketcode = code - 1 - LINK_SIZE; - uschar *bracode = ketcode - GET(ketcode, 1); + pcre_uchar *ketcode = code - 1 - LINK_SIZE; + pcre_uchar *bracode = ketcode - GET(ketcode, 1); /* Convert possessive ONCE brackets to non-capturing */ @@ -5029,7 +5050,7 @@ for (;; ptr++) if (lengthptr == NULL) { - uschar *scode = bracode; + pcre_uchar *scode = bracode; do { if (could_be_empty_branch(scode, ketcode, utf8, cd)) @@ -5212,8 +5233,8 @@ for (;; ptr++) int i, namelen; int arglen = 0; const char *vn = verbnames; - const uschar *name = ptr + 1; - const uschar *arg = NULL; + const pcre_uchar *name = ptr + 1; + const pcre_uchar *arg = NULL; previous = NULL; while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {}; namelen = (int)(ptr - name); @@ -5311,8 +5332,8 @@ for (;; ptr++) { int i, set, unset, namelen; int *optset; - const uschar *name; - uschar *slot; + const pcre_uchar *name; + pcre_uchar *slot; switch (*(++ptr)) { @@ -5738,7 +5759,7 @@ for (;; ptr++) if (!dupname) { - uschar *cslot = cd->name_table; + pcre_uchar *cslot = cd->name_table; for (i = 0; i < cd->names_found; i++) { if (cslot != slot) @@ -5794,7 +5815,7 @@ for (;; ptr++) if (lengthptr != NULL) { - const uschar *temp; + const pcre_uchar *temp; if (namelen == 0) { @@ -5876,7 +5897,7 @@ for (;; ptr++) case CHAR_0: case CHAR_1: case CHAR_2: case CHAR_3: case CHAR_4: case CHAR_5: case CHAR_6: case CHAR_7: case CHAR_8: case CHAR_9: { - const uschar *called; + const pcre_uchar *called; terminator = CHAR_RIGHT_PARENTHESIS; /* Come here from the \g<...> and \g'...' code (Oniguruma @@ -6164,7 +6185,7 @@ for (;; ptr++) if (bravalue == OP_COND && lengthptr == NULL) { - uschar *tc = code; + pcre_uchar *tc = code; int condcount = 0; do { @@ -6339,7 +6360,7 @@ for (;; ptr++) if (-c == ESC_g) { - const uschar *p; + const pcre_uchar *p; save_hwm = cd->hwm; /* Normally this is set when '(' is read */ terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)? CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE; @@ -6618,16 +6639,16 @@ Returns: TRUE on success */ static BOOL -compile_regex(int options, uschar **codeptr, const uschar **ptrptr, +compile_regex(int options, pcre_uchar **codeptr, const pcre_uchar **ptrptr, int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes, int cond_depth, int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd, int *lengthptr) { -const uschar *ptr = *ptrptr; -uschar *code = *codeptr; -uschar *last_branch = code; -uschar *start_bracket = code; -uschar *reverse_count = NULL; +const pcre_uchar *ptr = *ptrptr; +pcre_uchar *code = *codeptr; +pcre_uchar *last_branch = code; +pcre_uchar *start_bracket = code; +pcre_uchar *reverse_count = NULL; open_capitem capitem; int capnumber = 0; int firstbyte, reqbyte; @@ -6924,12 +6945,12 @@ Returns: TRUE or FALSE */ static BOOL -is_anchored(register const uschar *code, unsigned int bracket_map, +is_anchored(register const pcre_uchar *code, unsigned int bracket_map, unsigned int backref_map) { do { - const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code], - FALSE); + const pcre_uchar *scode = first_significant_code( + code + _pcre_OP_lengths[*code], FALSE); register int op = *scode; /* Non-capturing brackets */ @@ -7001,12 +7022,12 @@ Returns: TRUE or FALSE */ static BOOL -is_startline(const uschar *code, unsigned int bracket_map, +is_startline(const pcre_uchar *code, unsigned int bracket_map, unsigned int backref_map) { do { - const uschar *scode = first_significant_code(code + _pcre_OP_lengths[*code], - FALSE); + const pcre_uchar *scode = first_significant_code( + code + _pcre_OP_lengths[*code], FALSE); register int op = *scode; /* If we are at the start of a conditional assertion group, *both* the @@ -7104,14 +7125,15 @@ Returns: -1 or the fixed first char */ static int -find_firstassertedchar(const uschar *code, BOOL inassert) +find_firstassertedchar(const pcre_uchar *code, BOOL inassert) { register int c = -1; do { int d; int xl = (*code == OP_CBRA || *code == OP_SCBRA || *code == OP_CBRAPOS || *code == OP_SCBRAPOS)? 2:0; - const uschar *scode = first_significant_code(code + 1+LINK_SIZE + xl, TRUE); + const pcre_uchar *scode = first_significant_code(code + 1+LINK_SIZE + xl, + TRUE); register int op = *scode; switch(op) @@ -7210,9 +7232,9 @@ int errorcode = 0; int skipatstart = 0; BOOL utf8; size_t size; -uschar *code; -const uschar *codestart; -const uschar *ptr; +pcre_uchar *code; +const pcre_uchar *codestart; +const pcre_uchar *ptr; compile_data compile_block; compile_data *cd = &compile_block; @@ -7222,11 +7244,11 @@ as soon as possible, so that a fairly large buffer should be sufficient for this purpose. The same space is used in the second phase for remembering where to fill in forward references to subpatterns. */ -uschar cworkspace[COMPILE_WORK_SIZE]; +pcre_uchar cworkspace[COMPILE_WORK_SIZE]; /* Set this early so that early errors get offset 0. */ -ptr = (const uschar *)pattern; +ptr = (const pcre_uchar *)pattern; /* We can't pass back an error message if errorptr is NULL; I guess the best we can do is just return NULL, but we can set a code value if there is a code @@ -7315,7 +7337,7 @@ not used here. */ #ifdef SUPPORT_UTF8 if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0 && - (errorcode = _pcre_valid_utf8((USPTR)pattern, -1, erroroffset)) != 0) + (errorcode = _pcre_valid_utf8((PCRE_PUCHAR)pattern, -1, erroroffset)) != 0) { errorcode = ERR44; goto PCRE_EARLY_ERROR_RETURN2; @@ -7413,8 +7435,8 @@ cd->name_table = NULL; cd->start_workspace = cworkspace; cd->start_code = cworkspace; cd->hwm = cworkspace; -cd->start_pattern = (const uschar *)pattern; -cd->end_pattern = (const uschar *)(pattern + strlen(pattern)); +cd->start_pattern = (const pcre_uchar *)pattern; +cd->end_pattern = (const pcre_uchar *)(pattern + strlen(pattern)); cd->req_varyopt = 0; cd->external_options = options; cd->external_flags = 0; @@ -7487,7 +7509,7 @@ cd->final_bracount = cd->bracount; /* Save for checking forward references */ cd->assert_depth = 0; cd->bracount = 0; cd->names_found = 0; -cd->name_table = (uschar *)re + re->name_table_offset; +cd->name_table = (pcre_uchar *)re + re->name_table_offset; codestart = cd->name_table + re->name_entry_size * re->name_count; cd->start_code = codestart; cd->hwm = cworkspace; @@ -7500,8 +7522,8 @@ cd->open_caps = NULL; error, errorcode will be set non-zero, so we don't need to look at the result of the function here. */ -ptr = (const uschar *)pattern + skipatstart; -code = (uschar *)codestart; +ptr = (const pcre_uchar *)pattern + skipatstart; +code = (pcre_uchar *)codestart; *code = OP_BRA; (void)compile_regex(re->options, &code, &ptr, &errorcode, FALSE, FALSE, 0, 0, &firstbyte, &reqbyte, NULL, cd, NULL); @@ -7529,13 +7551,13 @@ if (code - codestart > length) errorcode = ERR23; while (errorcode == 0 && cd->hwm > cworkspace) { int offset, recno; - const uschar *groupptr; + const pcre_uchar *groupptr; cd->hwm -= LINK_SIZE; offset = GET(cd->hwm, 0); recno = GET(codestart, offset); groupptr = _pcre_find_bracket(codestart, utf8, recno); if (groupptr == NULL) errorcode = ERR53; - else PUT(((uschar *)codestart), offset, (int)(groupptr - codestart)); + else PUT(((pcre_uchar *)codestart), offset, (int)(groupptr - codestart)); } /* Give an error if there's back reference to a non-existent capturing @@ -7553,21 +7575,21 @@ length, and set their lengths. */ if (cd->check_lookbehind) { - uschar *cc = (uschar *)codestart; + pcre_uchar *cc = (pcre_uchar *)codestart; /* Loop, searching for OP_REVERSE items, and process those that do not have their length set. (Actually, it will also re-process any that have a length of zero, but that is a pathological case, and it does no harm.) When we find one, we temporarily terminate the branch it is in while we scan it. */ - for (cc = (uschar *)_pcre_find_bracket(codestart, utf8, -1); + for (cc = (pcre_uchar *)_pcre_find_bracket(codestart, utf8, -1); cc != NULL; - cc = (uschar *)_pcre_find_bracket(cc, utf8, -1)) + cc = (pcre_uchar *)_pcre_find_bracket(cc, utf8, -1)) { if (GET(cc, 1) == 0) { int fixed_length; - uschar *be = cc - 1 - LINK_SIZE + GET(cc, -LINK_SIZE); + pcre_uchar *be = cc - 1 - LINK_SIZE + GET(cc, -LINK_SIZE); int end_op = *be; *be = OP_END; fixed_length = find_fixedlength(cc, (re->options & PCRE_UTF8) != 0, TRUE, @@ -7592,7 +7614,7 @@ if (errorcode != 0) { (pcre_free)(re); PCRE_EARLY_ERROR_RETURN: - *erroroffset = (int)(ptr - (const uschar *)pattern); + *erroroffset = (int)(ptr - (const pcre_uchar *)pattern); PCRE_EARLY_ERROR_RETURN2: *errorptr = find_error_text(errorcode); if (errorcodeptr != NULL) *errorcodeptr = errorcode; @@ -7678,7 +7700,7 @@ if (code - codestart > length) { (pcre_free)(re); *errorptr = find_error_text(ERR23); - *erroroffset = ptr - (uschar *)pattern; + *erroroffset = ptr - (pcre_uchar *)pattern; if (errorcodeptr != NULL) *errorcodeptr = ERR23; return NULL; } diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c index 047c82d..d94cead 100644 --- a/pcre_dfa_exec.c +++ b/pcre_dfa_exec.c @@ -113,7 +113,7 @@ small value. Non-zero values in the table are the offsets from the opcode where the character is to be found. ***NOTE*** If the start of this table is modified, the three tables that follow must also be modified. */ -static const uschar coptable[] = { +static const pcre_uint8 coptable[] = { 0, /* End */ 0, 0, 0, 0, 0, /* \A, \G, \K, \B, \b */ 0, 0, 0, 0, 0, 0, /* \D, \d, \S, \s, \W, \w */ @@ -182,7 +182,7 @@ remember the fact that a character could have been inspected when the end of the subject is reached. ***NOTE*** If the start of this table is modified, the two tables that follow must also be modified. */ -static const uschar poptable[] = { +static const pcre_uint8 poptable[] = { 0, /* End */ 0, 0, 0, 1, 1, /* \A, \G, \K, \B, \b */ 1, 1, 1, 1, 1, 1, /* \D, \d, \S, \s, \W, \w */ @@ -249,7 +249,7 @@ static const uschar poptable[] = { /* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W, and \w */ -static const uschar toptable1[] = { +static const pcre_uint8 toptable1[] = { 0, 0, 0, 0, 0, 0, ctype_digit, ctype_digit, ctype_space, ctype_space, @@ -257,7 +257,7 @@ static const uschar toptable1[] = { 0, 0 /* OP_ANY, OP_ALLANY */ }; -static const uschar toptable2[] = { +static const pcre_uint8 toptable2[] = { 0, 0, 0, 0, 0, 0, ctype_digit, 0, ctype_space, 0, @@ -386,8 +386,8 @@ for the current character, one for the following character). */ static int internal_dfa_exec( dfa_match_data *md, - const uschar *this_start_code, - const uschar *current_subject, + const pcre_uchar *this_start_code, + const pcre_uchar *current_subject, int start_offset, int *offsets, int offsetcount, @@ -398,9 +398,9 @@ internal_dfa_exec( stateblock *active_states, *new_states, *temp_states; stateblock *next_active_state, *next_new_state; -const uschar *ctypes, *lcc, *fcc; -const uschar *ptr; -const uschar *end_code, *first_op; +const pcre_uint8 *ctypes, *lcc, *fcc; +const pcre_uchar *ptr; +const pcre_uchar *end_code, *first_op; dfa_recursion_info new_recursive; @@ -409,9 +409,9 @@ int active_count, new_count, match_count; /* Some fields in the md block are frequently referenced, so we load them into independent variables in the hope that this will perform better. */ -const uschar *start_subject = md->start_subject; -const uschar *end_subject = md->end_subject; -const uschar *start_code = md->start_code; +const pcre_uchar *start_subject = md->start_subject; +const pcre_uchar *end_subject = md->end_subject; +const pcre_uchar *start_code = md->start_code; #ifdef SUPPORT_UTF8 BOOL utf8 = (md->poptions & PCRE_UTF8) != 0; @@ -583,7 +583,7 @@ for (;;) #ifdef PCRE_DEBUG printf("%.*sNext character: rest of subject = \"", rlevel*2-2, SP); - pchars((uschar *)ptr, strlen((char *)ptr), stdout); + pchars((pcre_uchar *)ptr, strlen((char *)ptr), stdout); printf("\"\n"); printf("%.*sActive states: ", rlevel*2-2, SP); @@ -624,7 +624,7 @@ for (;;) { stateblock *current_state = active_states + i; BOOL caseless = FALSE; - const uschar *code; + const pcre_uchar *code; int state_offset = current_state->offset; int count, codevalue, rrc; @@ -956,7 +956,7 @@ for (;;) if (ptr > start_subject) { - const uschar *temp = ptr - 1; + const pcre_uchar *temp = ptr - 1; if (temp < md->start_used_ptr) md->start_used_ptr = temp; #ifdef SUPPORT_UTF8 if (utf8) BACKCHAR(temp); @@ -1281,7 +1281,7 @@ for (;;) if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); } if (clen > 0 && UCD_CATEGORY(c) != ucp_M) { - const uschar *nptr = ptr + clen; + const pcre_uchar *nptr = ptr + clen; int ncount = 0; if (count > 0 && codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS) { @@ -1537,7 +1537,7 @@ for (;;) ADD_ACTIVE(state_offset + 2, 0); if (clen > 0 && UCD_CATEGORY(c) != ucp_M) { - const uschar *nptr = ptr + clen; + const pcre_uchar *nptr = ptr + clen; int ncount = 0; if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR || codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY) @@ -1804,7 +1804,7 @@ for (;;) count = current_state->count; /* Number already matched */ if (clen > 0 && UCD_CATEGORY(c) != ucp_M) { - const uschar *nptr = ptr + clen; + const pcre_uchar *nptr = ptr + clen; int ncount = 0; if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO) { @@ -2023,7 +2023,7 @@ for (;;) case OP_EXTUNI: if (clen > 0 && UCD_CATEGORY(c) != ucp_M) { - const uschar *nptr = ptr + clen; + const pcre_uchar *nptr = ptr + clen; int ncount = 0; while (nptr < end_subject) { @@ -2418,7 +2418,7 @@ for (;;) { BOOL isinclass = FALSE; int next_state_offset; - const uschar *ecode; + const pcre_uchar *ecode; /* For a simple class, there is always just a 32-byte table, and we can set isinclass from it. */ @@ -2510,7 +2510,7 @@ for (;;) int rc; int local_offsets[2]; int local_workspace[1000]; - const uschar *endasscode = code + GET(code, 1); + const pcre_uchar *endasscode = code + GET(code, 1); while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1); @@ -2599,8 +2599,8 @@ for (;;) else { int rc; - const uschar *asscode = code + LINK_SIZE + 1; - const uschar *endasscode = asscode + GET(asscode, 1); + const pcre_uchar *asscode = code + LINK_SIZE + 1; + const pcre_uchar *endasscode = asscode + GET(asscode, 1); while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1); @@ -2631,7 +2631,7 @@ for (;;) dfa_recursion_info *ri; int local_offsets[1000]; int local_workspace[1000]; - const uschar *callpat = start_code + GET(code, 1); + const pcre_uchar *callpat = start_code + GET(code, 1); int recno = (callpat == md->start_code)? 0 : GET2(callpat, 1 + LINK_SIZE); int rc; @@ -2682,8 +2682,8 @@ for (;;) { for (rc = rc*2 - 2; rc >= 0; rc -= 2) { - const uschar *p = start_subject + local_offsets[rc]; - const uschar *pp = start_subject + local_offsets[rc+1]; + const pcre_uchar *p = start_subject + local_offsets[rc]; + const pcre_uchar *pp = start_subject + local_offsets[rc+1]; int charcount = local_offsets[rc+1] - local_offsets[rc]; while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--; if (charcount > 0) @@ -2708,7 +2708,7 @@ for (;;) case OP_BRAPOSZERO: { int charcount, matched_count; - const uschar *local_ptr = ptr; + const pcre_uchar *local_ptr = ptr; BOOL allow_zero; if (codevalue == OP_BRAPOSZERO) @@ -2758,7 +2758,7 @@ for (;;) if (matched_count > 0 || allow_zero) { - const uschar *end_subpattern = code; + const pcre_uchar *end_subpattern = code; int next_state_offset; do { end_subpattern += GET(end_subpattern, 1); } @@ -2779,8 +2779,8 @@ for (;;) } else { - const uschar *p = ptr; - const uschar *pp = local_ptr; + const pcre_uchar *p = ptr; + const pcre_uchar *pp = local_ptr; charcount = pp - p; while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--; ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); @@ -2809,7 +2809,7 @@ for (;;) if (rc >= 0) { - const uschar *end_subpattern = code; + const pcre_uchar *end_subpattern = code; int charcount = local_offsets[1] - local_offsets[0]; int next_state_offset, repeat_state_offset; @@ -2862,8 +2862,8 @@ for (;;) } else { - const uschar *p = start_subject + local_offsets[0]; - const uschar *pp = start_subject + local_offsets[1]; + const pcre_uchar *p = start_subject + local_offsets[0]; + const pcre_uchar *pp = start_subject + local_offsets[1]; while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--; ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); if (repeat_state_offset >= 0) @@ -3005,14 +3005,15 @@ real_pcre *re = (real_pcre *)argument_re; dfa_match_data match_block; dfa_match_data *md = &match_block; BOOL utf8, anchored, startline, firstline; -const uschar *current_subject, *end_subject, *lcc; +const pcre_uchar *current_subject, *end_subject; +const pcre_uint8 *lcc; pcre_study_data internal_study; const pcre_study_data *study = NULL; real_pcre internal_re; -const uschar *req_byte_ptr; -const uschar *start_bits = NULL; +const pcre_uint8 *req_byte_ptr; +const pcre_uint8 *start_bits = NULL; BOOL first_byte_caseless = FALSE; BOOL req_byte_caseless = FALSE; int first_byte = -1; @@ -3080,7 +3081,7 @@ anchored = (options & (PCRE_ANCHORED|PCRE_DFA_RESTART)) != 0 || /* The remaining fixed data for passing around. */ -md->start_code = (const uschar *)argument_re + +md->start_code = (const pcre_uchar *)argument_re + re->name_table_offset + re->name_count * re->name_entry_size; md->start_subject = (const unsigned char *)subject; md->end_subject = end_subject; @@ -3147,7 +3148,7 @@ back the character offset. */ if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) { int erroroffset; - int errorcode = _pcre_valid_utf8((uschar *)subject, length, &erroroffset); + int errorcode = _pcre_valid_utf8((pcre_uchar *)subject, length, &erroroffset); if (errorcode != 0) { if (offsetcount >= 2) @@ -3159,7 +3160,7 @@ if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; } if (start_offset > 0 && start_offset < length && - (((USPTR)subject)[start_offset] & 0xc0) == 0x80) + (((PCRE_PUCHAR)subject)[start_offset] & 0xc0) == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; } #endif @@ -3219,7 +3220,7 @@ for (;;) if ((options & PCRE_DFA_RESTART) == 0) { - const uschar *save_end_subject = end_subject; + const pcre_uchar *save_end_subject = end_subject; /* If firstline is TRUE, the start of the match is constrained to the first line of a multiline string. Implement this by temporarily adjusting @@ -3228,7 +3229,7 @@ for (;;) if (firstline) { - USPTR t = current_subject; + PCRE_PUCHAR t = current_subject; #ifdef SUPPORT_UTF8 if (utf8) { @@ -3357,7 +3358,7 @@ for (;;) if (req_byte >= 0 && end_subject - current_subject < REQ_BYTE_MAX) { - register const uschar *p = current_subject + ((first_byte >= 0)? 1 : 0); + register const pcre_uchar *p = current_subject + ((first_byte >= 0)? 1 : 0); /* We don't need to repeat the search if we haven't yet reached the place we found it at last time. */ diff --git a/pcre_exec.c b/pcre_exec.c index 9f31567..60cc4d9 100644 --- a/pcre_exec.c +++ b/pcre_exec.c @@ -121,7 +121,7 @@ Returns: nothing */ static void -pchars(const uschar *p, int length, BOOL is_subject, match_data *md) +pchars(const pcre_uchar *p, int length, BOOL is_subject, match_data *md) { unsigned int c; if (is_subject && length > md->end_subject - p) length = md->end_subject - p; @@ -152,11 +152,11 @@ Returns: < 0 if not matched, otherwise the number of subject bytes matched */ static int -match_ref(int offset, register USPTR eptr, int length, match_data *md, +match_ref(int offset, register PCRE_PUCHAR eptr, int length, match_data *md, BOOL caseless) { -USPTR eptr_start = eptr; -register USPTR p = md->start_subject + md->offset_vector[offset]; +PCRE_PUCHAR eptr_start = eptr; +register PCRE_PUCHAR p = md->start_subject + md->offset_vector[offset]; #ifdef PCRE_DEBUG if (eptr >= md->end_subject) @@ -193,7 +193,7 @@ if (caseless) the latter. It is important, therefore, to check the length along the reference, not along the subject (earlier code did this wrong). */ - USPTR endptr = p + length; + PCRE_PUCHAR endptr = p + length; while (p < endptr) { int c, d; @@ -354,25 +354,25 @@ typedef struct heapframe { /* Function arguments that may change */ - USPTR Xeptr; - const uschar *Xecode; - USPTR Xmstart; - USPTR Xmarkptr; + PCRE_PUCHAR Xeptr; + const pcre_uchar *Xecode; + PCRE_PUCHAR Xmstart; + PCRE_PUCHAR Xmarkptr; int Xoffset_top; eptrblock *Xeptrb; unsigned int Xrdepth; /* Function local variables */ - USPTR Xcallpat; + PCRE_PUCHAR Xcallpat; #ifdef SUPPORT_UTF8 - USPTR Xcharptr; + PCRE_PUCHAR Xcharptr; #endif - USPTR Xdata; - USPTR Xnext; - USPTR Xpp; - USPTR Xprev; - USPTR Xsaved_eptr; + PCRE_PUCHAR Xdata; + PCRE_PUCHAR Xnext; + PCRE_PUCHAR Xpp; + PCRE_PUCHAR Xprev; + PCRE_PUCHAR Xsaved_eptr; recursion_info Xnew_recursive; @@ -385,7 +385,7 @@ typedef struct heapframe { int Xprop_value; int Xprop_fail_result; int Xoclength; - uschar Xocchars[8]; + pcre_uint8 Xocchars[8]; #endif int Xcodelink; @@ -474,9 +474,9 @@ Returns: MATCH_MATCH if matched ) these values are >= 0 */ static int -match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, - const uschar *markptr, int offset_top, match_data *md, eptrblock *eptrb, - unsigned int rdepth) +match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode, + PCRE_PUCHAR mstart, const pcre_uchar *markptr, int offset_top, + match_data *md, eptrblock *eptrb, unsigned int rdepth) { /* These variables do not need to be preserved over recursion in this function, so they can be ordinary variables in all cases. Mark some of them with @@ -586,14 +586,14 @@ below are for variables that do not have to be preserved over a recursive call to RMATCH(). */ #ifdef SUPPORT_UTF8 -const uschar *charptr; +const pcre_uchar *charptr; #endif -const uschar *callpat; -const uschar *data; -const uschar *next; -USPTR pp; -const uschar *prev; -USPTR saved_eptr; +const pcre_uchar *callpat; +const pcre_uchar *data; +const pcre_uchar *next; +PCRE_PUCHAR pp; +const pcre_uchar *prev; +PCRE_PUCHAR saved_eptr; recursion_info new_recursive; @@ -606,7 +606,7 @@ int prop_type; int prop_value; int prop_fail_result; int oclength; -uschar occhars[8]; +pcre_uint8 occhars[8]; #endif int codelink; @@ -1028,7 +1028,7 @@ for (;;) { if (rrc == MATCH_ONCE) { - const uschar *scode = ecode; + const pcre_uchar *scode = ecode; if (*scode != OP_ONCE) /* If not at start, find it */ { while (*scode == OP_ALT) scode += GET(scode, 1); @@ -1262,7 +1262,7 @@ for (;;) if (!condition && condcode == OP_NRREF) { - uschar *slotA = md->name_table; + pcre_uchar *slotA = md->name_table; for (i = 0; i < md->name_count; i++) { if (GET2(slotA, 0) == recno) break; @@ -1275,7 +1275,7 @@ for (;;) if (i < md->name_count) { - uschar *slotB = slotA; + pcre_uchar *slotB = slotA; while (slotB > md->name_table) { slotB -= md->name_entry_size; @@ -1325,7 +1325,7 @@ for (;;) if (!condition && condcode == OP_NCREF) { int refno = offset >> 1; - uschar *slotA = md->name_table; + pcre_uchar *slotA = md->name_table; for (i = 0; i < md->name_count; i++) { @@ -1339,7 +1339,7 @@ for (;;) if (i < md->name_count) { - uschar *slotB = slotA; + pcre_uchar *slotB = slotA; while (slotB > md->name_table) { slotB -= md->name_entry_size; @@ -2076,7 +2076,7 @@ for (;;) if (eptr == md->start_subject) prev_is_word = FALSE; else { - USPTR lastptr = eptr - 1; + PCRE_PUCHAR lastptr = eptr - 1; while((*lastptr & 0xc0) == 0x80) lastptr--; if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; GETCHAR(c, lastptr); @@ -5945,12 +5945,12 @@ BOOL req_byte_caseless = FALSE; BOOL utf8; match_data match_block; match_data *md = &match_block; -const uschar *tables; -const uschar *start_bits = NULL; -USPTR start_match = (USPTR)subject + start_offset; -USPTR end_subject; -USPTR start_partial = NULL; -USPTR req_byte_ptr = start_match - 1; +const pcre_uint8 *tables; +const pcre_uint8 *start_bits = NULL; +PCRE_PUCHAR start_match = (PCRE_PUCHAR)subject + start_offset; +PCRE_PUCHAR end_subject; +PCRE_PUCHAR start_partial = NULL; +PCRE_PUCHAR req_byte_ptr = start_match - 1; pcre_study_data internal_study; const pcre_study_data *study; @@ -5983,7 +5983,7 @@ code for an invalid string if a results vector is available. */ if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) { int erroroffset; - int errorcode = _pcre_valid_utf8((USPTR)subject, length, &erroroffset); + int errorcode = _pcre_valid_utf8((PCRE_PUCHAR)subject, length, &erroroffset); if (errorcode != 0) { if (offsetcount >= 2) @@ -5997,7 +5997,7 @@ if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) /* Check that a start_offset points to the start of a UTF-8 character. */ if (start_offset > 0 && start_offset < length && - (((USPTR)subject)[start_offset] & 0xc0) == 0x80) + (((PCRE_PUCHAR)subject)[start_offset] & 0xc0) == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; } #endif @@ -6023,7 +6023,7 @@ if (extra_data != NULL /* Carry on with non-JIT matching. This information is for finding all the numbers associated with a given name, for condition testing. */ -md->name_table = (uschar *)re + re->name_table_offset; +md->name_table = (pcre_uchar *)re + re->name_table_offset; md->name_count = re->name_count; md->name_entry_size = re->name_entry_size; @@ -6079,10 +6079,10 @@ firstline = (re->options & PCRE_FIRSTLINE) != 0; /* The code starts after the real_pcre block and the capture name table. */ -md->start_code = (const uschar *)external_re + re->name_table_offset + +md->start_code = (const pcre_uchar *)external_re + re->name_table_offset + re->name_count * re->name_entry_size; -md->start_subject = (USPTR)subject; +md->start_subject = (PCRE_PUCHAR)subject; md->start_offset = start_offset; md->end_subject = md->start_subject + length; end_subject = md->end_subject; @@ -6259,8 +6259,8 @@ the loop runs just once. */ for(;;) { - USPTR save_end_subject = end_subject; - USPTR new_start_match; + PCRE_PUCHAR save_end_subject = end_subject; + PCRE_PUCHAR new_start_match; /* If firstline is TRUE, the start of the match is constrained to the first line of a multiline string. That is, the match must be before or at the first @@ -6270,7 +6270,7 @@ for(;;) if (firstline) { - USPTR t = start_match; + PCRE_PUCHAR t = start_match; #ifdef SUPPORT_UTF8 if (utf8) { @@ -6397,7 +6397,7 @@ for(;;) if (req_byte >= 0 && end_subject - start_match < REQ_BYTE_MAX) { - register USPTR p = start_match + ((first_byte >= 0)? 1 : 0); + register PCRE_PUCHAR p = start_match + ((first_byte >= 0)? 1 : 0); /* We don't need to repeat the search if we haven't yet reached the place we found it at last time. */ @@ -6637,8 +6637,8 @@ if (start_partial != NULL) md->mark = NULL; if (offsetcount > 1) { - offsets[0] = (int)(start_partial - (USPTR)subject); - offsets[1] = (int)(end_subject - (USPTR)subject); + offsets[0] = (int)(start_partial - (PCRE_PUCHAR)subject); + offsets[1] = (int)(end_subject - (PCRE_PUCHAR)subject); } rc = PCRE_ERROR_PARTIAL; } diff --git a/pcre_fullinfo.c b/pcre_fullinfo.c index 57971a8..bfb3156 100644 --- a/pcre_fullinfo.c +++ b/pcre_fullinfo.c @@ -118,7 +118,7 @@ switch (what) block, not the internal copy (with flipped integer fields). */ case PCRE_INFO_FIRSTTABLE: - *((const uschar **)where) = + *((const pcre_uint8 **)where) = (study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)? ((const pcre_study_data *)extra_data->study_data)->start_bits : NULL; break; @@ -149,11 +149,11 @@ switch (what) break; case PCRE_INFO_NAMETABLE: - *((const uschar **)where) = (const uschar *)re + re->name_table_offset; + *((const pcre_uchar **)where) = (const pcre_uchar *)re + re->name_table_offset; break; case PCRE_INFO_DEFAULT_TABLES: - *((const uschar **)where) = (const uschar *)(_pcre_default_tables); + *((const pcre_uint8 **)where) = (const pcre_uint8 *)(_pcre_default_tables); break; /* From release 8.00 this will always return TRUE because NOPARTIAL is @@ -71,7 +71,7 @@ pcre_get_stringnumber(const pcre *code, const char *stringname) int rc; int entrysize; int top, bot; -uschar *nametable; +pcre_uchar *nametable; if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; @@ -86,7 +86,7 @@ bot = 0; while (top > bot) { int mid = (top + bot) / 2; - uschar *entry = nametable + entrysize*mid; + pcre_uchar *entry = nametable + entrysize*mid; int c = strcmp(stringname, (char *)(entry + 2)); if (c == 0) return (entry[0] << 8) + entry[1]; if (c > 0) bot = mid + 1; else top = mid; @@ -121,7 +121,7 @@ pcre_get_stringtable_entries(const pcre *code, const char *stringname, int rc; int entrysize; int top, bot; -uschar *nametable, *lastentry; +pcre_uchar *nametable, *lastentry; if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; @@ -137,12 +137,12 @@ bot = 0; while (top > bot) { int mid = (top + bot) / 2; - uschar *entry = nametable + entrysize*mid; + pcre_uchar *entry = nametable + entrysize*mid; int c = strcmp(stringname, (char *)(entry + 2)); if (c == 0) { - uschar *first = entry; - uschar *last = entry; + pcre_uchar *first = entry; + pcre_uchar *last = entry; while (first > nametable) { if (strcmp(stringname, (char *)(first - entrysize + 2)) != 0) break; @@ -188,12 +188,12 @@ get_first_set(const pcre *code, const char *stringname, int *ovector) const real_pcre *re = (const real_pcre *)code; int entrysize; char *first, *last; -uschar *entry; +pcre_uchar *entry; if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) return pcre_get_stringnumber(code, stringname); entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last); if (entrysize <= 0) return entrysize; -for (entry = (uschar *)first; entry <= (uschar *)last; entry += entrysize) +for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize) { int n = (entry[0] << 8) + entry[1]; if (ovector[n*2] >= 0) return n; diff --git a/pcre_internal.h b/pcre_internal.h index 0c5d676..46ff701 100644 --- a/pcre_internal.h +++ b/pcre_internal.h @@ -158,12 +158,14 @@ set, we ensure here that it has no effect. */ #define PCRE_CALL_CONVENTION #endif -/* We need to have types that specify unsigned 16-bit and 32-bit integers. We +/* We need to have types that specify unsigned 8, 16 and 32-bit integers. We cannot determine these outside the compilation (e.g. by running a program as part of "configure") because PCRE is often cross-compiled for use on other systems. Instead we make use of the maximum sizes that are available at preprocessor time in standard C environments. */ +typedef unsigned char pcre_uint8; + #if USHRT_MAX == 65535 typedef unsigned short pcre_uint16; typedef short pcre_int16; @@ -207,11 +209,9 @@ by "configure". */ /* All character handling must be done as unsigned characters. Otherwise there are problems with top-bit-set characters and functions such as isspace(). However, we leave the interface to the outside world as char *, because that -should make things easier for callers. We define a short type for unsigned char -to save lots of typing. I tried "uchar", but it causes problems on Digital -Unix, where it is defined in sys/types, so use "uschar" instead. */ +should make things easier for callers. */ -typedef unsigned char uschar; +typedef unsigned char pcre_uchar; /* This is an unsigned int value that no character can ever have. UTF-8 characters only go up to 0x7fffffff (though Unicode doesn't go beyond @@ -267,11 +267,9 @@ used for the external interface and appears in pcre.h, which is why its name must begin with PCRE_. */ #ifdef CUSTOM_SUBJECT_PTR -#define PCRE_SPTR CUSTOM_SUBJECT_PTR -#define USPTR CUSTOM_SUBJECT_PTR +#define PCRE_PUCHAR CUSTOM_SUBJECT_PTR #else -#define PCRE_SPTR const char * -#define USPTR const unsigned char * +#define PCRE_PUCHAR const pcre_uchar * #endif @@ -1699,8 +1697,8 @@ typedef struct real_pcre { pcre_uint16 name_count; /* Number of name items */ pcre_uint16 ref_count; /* Reference count */ - const unsigned char *tables; /* Pointer to tables or NULL for std */ - const unsigned char *nullpad; /* NULL padding */ + const pcre_uint8 *tables; /* Pointer to tables or NULL for std */ + const pcre_uint8 *nullpad; /* NULL padding */ } real_pcre; /* The format of the block used to store data from pcre_study(). The same @@ -1709,7 +1707,7 @@ remark (see NOTE above) about extending this structure applies. */ typedef struct pcre_study_data { pcre_uint32 size; /* Total that was malloced */ pcre_uint32 flags; /* Private flags */ - uschar start_bits[32]; /* Starting char bits */ + pcre_uint8 start_bits[32]; /* Starting char bits */ pcre_uint32 minlength; /* Minimum subject length */ } pcre_study_data; @@ -1728,32 +1726,32 @@ typedef struct open_capitem { doing the compiling, so that they are thread-safe. */ typedef struct compile_data { - const uschar *lcc; /* Points to lower casing table */ - const uschar *fcc; /* Points to case-flipping table */ - const uschar *cbits; /* Points to character type table */ - const uschar *ctypes; /* Points to table of type maps */ - const uschar *start_workspace;/* The start of working space */ - const uschar *start_code; /* The start of the compiled code */ - const uschar *start_pattern; /* The start of the pattern */ - const uschar *end_pattern; /* The end of the pattern */ - open_capitem *open_caps; /* Chain of open capture items */ - uschar *hwm; /* High watermark of workspace */ - uschar *name_table; /* The name/number table */ - int names_found; /* Number of entries so far */ - int name_entry_size; /* Size of each entry */ - int bracount; /* Count of capturing parens as we compile */ - int final_bracount; /* Saved value after first pass */ - int top_backref; /* Maximum back reference */ - unsigned int backref_map; /* Bitmap of low back refs */ - int assert_depth; /* Depth of nested assertions */ - int external_options; /* External (initial) options */ - int external_flags; /* External flag bits to be set */ - int req_varyopt; /* "After variable item" flag for reqbyte */ - BOOL had_accept; /* (*ACCEPT) encountered */ - BOOL check_lookbehind; /* Lookbehinds need later checking */ - int nltype; /* Newline type */ - int nllen; /* Newline string length */ - uschar nl[4]; /* Newline string when fixed length */ + const pcre_uint8 *lcc; /* Points to lower casing table */ + const pcre_uint8 *fcc; /* Points to case-flipping table */ + const pcre_uint8 *cbits; /* Points to character type table */ + const pcre_uint8 *ctypes; /* Points to table of type maps */ + const pcre_uchar *start_workspace;/* The start of working space */ + const pcre_uchar *start_code; /* The start of the compiled code */ + const pcre_uchar *start_pattern; /* The start of the pattern */ + const pcre_uchar *end_pattern; /* The end of the pattern */ + open_capitem *open_caps; /* Chain of open capture items */ + pcre_uchar *hwm; /* High watermark of workspace */ + pcre_uchar *name_table; /* The name/number table */ + int names_found; /* Number of entries so far */ + int name_entry_size; /* Size of each entry */ + int bracount; /* Count of capturing parens as we compile */ + int final_bracount; /* Saved value after first pass */ + int top_backref; /* Maximum back reference */ + unsigned int backref_map; /* Bitmap of low back refs */ + int assert_depth; /* Depth of nested assertions */ + int external_options; /* External (initial) options */ + int external_flags; /* External flag bits to be set */ + int req_varyopt; /* "After variable item" flag for reqbyte */ + BOOL had_accept; /* (*ACCEPT) encountered */ + BOOL check_lookbehind; /* Lookbehinds need later checking */ + int nltype; /* Newline type */ + int nllen; /* Newline string length */ + pcre_uchar nl[4]; /* Newline string when fixed length */ } compile_data; /* Structure for maintaining a chain of pointers to the currently incomplete @@ -1761,7 +1759,7 @@ branches, for testing for left recursion while compiling. */ typedef struct branch_chain { struct branch_chain *outer; - uschar *current_branch; + pcre_uchar *current_branch; } branch_chain; /* Structure for items in a linked list that represents an explicit recursive @@ -1772,7 +1770,7 @@ typedef struct recursion_info { int group_num; /* Number of group that was called */ int *offset_save; /* Pointer to start of saved offsets */ int saved_max; /* Number of saved offsets */ - USPTR subject_position; /* Position at start of recursion */ + PCRE_PUCHAR subject_position; /* Position at start of recursion */ } recursion_info; /* A similar structure for pcre_dfa_exec(). */ @@ -1780,7 +1778,7 @@ typedef struct recursion_info { typedef struct dfa_recursion_info { struct dfa_recursion_info *prevrec; int group_num; - USPTR subject_position; + PCRE_PUCHAR subject_position; } dfa_recursion_info; /* Structure for building a chain of data for holding the values of the subject @@ -1790,7 +1788,7 @@ pcre_exec(). */ typedef struct eptrblock { struct eptrblock *epb_prev; - USPTR epb_saved_eptr; + PCRE_PUCHAR epb_saved_eptr; } eptrblock; @@ -1801,65 +1799,65 @@ typedef struct match_data { unsigned long int match_call_count; /* As it says */ unsigned long int match_limit; /* As it says */ unsigned long int match_limit_recursion; /* As it says */ - int *offset_vector; /* Offset vector */ - int offset_end; /* One past the end */ - int offset_max; /* The maximum usable for return data */ - int nltype; /* Newline type */ - int nllen; /* Newline string length */ - int name_count; /* Number of names in name table */ - int name_entry_size; /* Size of entry in names table */ - uschar *name_table; /* Table of names */ - uschar nl[4]; /* Newline string when fixed */ - const uschar *lcc; /* Points to lower casing table */ - const uschar *ctypes; /* Points to table of type maps */ - BOOL offset_overflow; /* Set if too many extractions */ - BOOL notbol; /* NOTBOL flag */ - BOOL noteol; /* NOTEOL flag */ - BOOL utf8; /* UTF8 flag */ - BOOL jscript_compat; /* JAVASCRIPT_COMPAT flag */ - BOOL use_ucp; /* PCRE_UCP flag */ - BOOL endonly; /* Dollar not before final \n */ - BOOL notempty; /* Empty string match not wanted */ - BOOL notempty_atstart; /* Empty string match at start not wanted */ - BOOL hitend; /* Hit the end of the subject at some point */ - BOOL bsr_anycrlf; /* \R is just any CRLF, not full Unicode */ - BOOL hasthen; /* Pattern contains (*THEN) */ - const uschar *start_code; /* For use when recursing */ - USPTR start_subject; /* Start of the subject string */ - USPTR end_subject; /* End of the subject string */ - USPTR start_match_ptr; /* Start of matched string */ - USPTR end_match_ptr; /* Subject position at end match */ - USPTR start_used_ptr; /* Earliest consulted character */ - int partial; /* PARTIAL options */ - int end_offset_top; /* Highwater mark at end of match */ - int capture_last; /* Most recent capture number */ - int start_offset; /* The start offset value */ - int match_function_type; /* Set for certain special calls of MATCH() */ - eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */ - int eptrn; /* Next free eptrblock */ - recursion_info *recursive; /* Linked list of recursion data */ - void *callout_data; /* To pass back to callouts */ - const uschar *mark; /* Mark pointer to pass back */ - const uschar *once_target; /* Where to back up to for atomic groups */ + int *offset_vector; /* Offset vector */ + int offset_end; /* One past the end */ + int offset_max; /* The maximum usable for return data */ + int nltype; /* Newline type */ + int nllen; /* Newline string length */ + int name_count; /* Number of names in name table */ + int name_entry_size; /* Size of entry in names table */ + pcre_uchar *name_table; /* Table of names */ + pcre_uchar nl[4]; /* Newline string when fixed */ + const pcre_uint8 *lcc; /* Points to lower casing table */ + const pcre_uint8 *ctypes; /* Points to table of type maps */ + BOOL offset_overflow; /* Set if too many extractions */ + BOOL notbol; /* NOTBOL flag */ + BOOL noteol; /* NOTEOL flag */ + BOOL utf8; /* UTF8 flag */ + BOOL jscript_compat; /* JAVASCRIPT_COMPAT flag */ + BOOL use_ucp; /* PCRE_UCP flag */ + BOOL endonly; /* Dollar not before final \n */ + BOOL notempty; /* Empty string match not wanted */ + BOOL notempty_atstart; /* Empty string match at start not wanted */ + BOOL hitend; /* Hit the end of the subject at some point */ + BOOL bsr_anycrlf; /* \R is just any CRLF, not full Unicode */ + BOOL hasthen; /* Pattern contains (*THEN) */ + const pcre_uchar *start_code; /* For use when recursing */ + PCRE_PUCHAR start_subject; /* Start of the subject string */ + PCRE_PUCHAR end_subject; /* End of the subject string */ + PCRE_PUCHAR start_match_ptr; /* Start of matched string */ + PCRE_PUCHAR end_match_ptr; /* Subject position at end match */ + PCRE_PUCHAR start_used_ptr; /* Earliest consulted character */ + int partial; /* PARTIAL options */ + int end_offset_top; /* Highwater mark at end of match */ + int capture_last; /* Most recent capture number */ + int start_offset; /* The start offset value */ + int match_function_type; /* Set for certain special calls of MATCH() */ + eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */ + int eptrn; /* Next free eptrblock */ + recursion_info *recursive; /* Linked list of recursion data */ + void *callout_data; /* To pass back to callouts */ + const pcre_uchar *mark; /* Mark pointer to pass back */ + const pcre_uchar *once_target; /* Where to back up to for atomic groups */ } match_data; /* A similar structure is used for the same purpose by the DFA matching functions. */ typedef struct dfa_match_data { - const uschar *start_code; /* Start of the compiled pattern */ - const uschar *start_subject; /* Start of the subject string */ - const uschar *end_subject; /* End of subject string */ - const uschar *start_used_ptr; /* Earliest consulted character */ - const uschar *tables; /* Character tables */ - int start_offset; /* The start offset value */ - int moptions; /* Match options */ - int poptions; /* Pattern options */ - int nltype; /* Newline type */ - int nllen; /* Newline string length */ - uschar nl[4]; /* Newline string when fixed */ - void *callout_data; /* To pass back to callouts */ - dfa_recursion_info *recursive; /* Linked list of recursion data */ + const pcre_uchar *start_code; /* Start of the compiled pattern */ + const pcre_uchar *start_subject ; /* Start of the subject string */ + const pcre_uchar *end_subject; /* End of subject string */ + const pcre_uchar *start_used_ptr; /* Earliest consulted character */ + const pcre_uint8 *tables; /* Character tables */ + int start_offset; /* The start offset value */ + int moptions; /* Match options */ + int poptions; /* Pattern options */ + int nltype; /* Newline type */ + int nllen; /* Newline string length */ + pcre_uchar nl[4]; /* Newline string when fixed */ + void *callout_data; /* To pass back to callouts */ + dfa_recursion_info *recursive; /* Linked list of recursion data */ } dfa_match_data; /* Bit definitions for entries in the pcre_ctypes table. */ @@ -1912,56 +1910,54 @@ of the exported public functions. They have to be "external" in the C sense, but are not part of the PCRE public API. The data for these tables is in the pcre_tables.c module. */ -extern const int _pcre_utf8_table1[]; -extern const int _pcre_utf8_table2[]; -extern const int _pcre_utf8_table3[]; -extern const uschar _pcre_utf8_table4[]; - -#ifdef SUPPORT_JIT -extern const uschar _pcre_utf8_char_sizes[]; -#endif +extern const int _pcre_utf8_table1[]; +extern const int _pcre_utf8_table2[]; +extern const int _pcre_utf8_table3[]; +extern const pcre_uint8 _pcre_utf8_table4[]; -extern const int _pcre_utf8_table1_size; +extern const int _pcre_utf8_table1_size; -extern const char _pcre_utt_names[]; +extern const char _pcre_utt_names[]; extern const ucp_type_table _pcre_utt[]; -extern const int _pcre_utt_size; +extern const int _pcre_utt_size; -extern const uschar _pcre_default_tables[]; +extern const pcre_uint8 _pcre_default_tables[]; -extern const uschar _pcre_OP_lengths[]; +extern const pcre_uint8 _pcre_OP_lengths[]; /* Internal shared functions. These are functions that are used by more than one of the exported public functions. They have to be "external" in the C sense, but are not part of the PCRE public API. */ -extern const uschar *_pcre_find_bracket(const uschar *, BOOL, int); -extern BOOL _pcre_is_newline(USPTR, int, USPTR, int *, BOOL); -extern int _pcre_ord2utf8(int, uschar *); -extern real_pcre *_pcre_try_flipped(const real_pcre *, real_pcre *, - const pcre_study_data *, pcre_study_data *); -extern int _pcre_valid_utf8(USPTR, int, int *); -extern BOOL _pcre_was_newline(USPTR, int, USPTR, int *, BOOL); -extern BOOL _pcre_xclass(int, const uschar *); +extern const pcre_uchar *_pcre_find_bracket(const pcre_uchar *, BOOL, int); +extern BOOL _pcre_is_newline(PCRE_PUCHAR, int, PCRE_PUCHAR, + int *, BOOL); +extern int _pcre_ord2utf8(int, pcre_uint8 *); +extern real_pcre *_pcre_try_flipped(const real_pcre *, real_pcre *, + const pcre_study_data *, pcre_study_data *); +extern int _pcre_valid_utf8(PCRE_PUCHAR, int, int *); +extern BOOL _pcre_was_newline(PCRE_PUCHAR, int, PCRE_PUCHAR, + int *, BOOL); +extern BOOL _pcre_xclass(int, const pcre_uchar *); #ifdef SUPPORT_JIT -extern void _pcre_jit_compile(const real_pcre *, pcre_extra *); -extern int _pcre_jit_exec(const real_pcre *, void *, PCRE_SPTR, - int, int, int, int, int *, int); -extern void _pcre_jit_free(void *); +extern void _pcre_jit_compile(const real_pcre *, pcre_extra *); +extern int _pcre_jit_exec(const real_pcre *, void *, PCRE_SPTR, + int, int, int, int, int *, int); +extern void _pcre_jit_free(void *); #endif /* Unicode character database (UCD) */ typedef struct { - uschar script; - uschar chartype; + pcre_uint8 script; + pcre_uint8 chartype; pcre_int32 other_case; } ucd_record; extern const ucd_record _pcre_ucd_records[]; -extern const uschar _pcre_ucd_stage1[]; +extern const pcre_uint8 _pcre_ucd_stage1[]; extern const pcre_uint16 _pcre_ucd_stage2[]; extern const int _pcre_ucp_gentype[]; #ifdef SUPPORT_JIT diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c index 3f8259d..6e944df 100644 --- a/pcre_jit_compile.c +++ b/pcre_jit_compile.c @@ -152,14 +152,14 @@ typedef struct jit_arguments { PCRE_SPTR begin; PCRE_SPTR end; int *offsets; - uschar *ptr; + pcre_uchar *ptr; /* Everything else after. */ int offsetcount; int calllimit; - uschar notbol; - uschar noteol; - uschar notempty; - uschar notempty_atstart; + pcre_uint8 notbol; + pcre_uint8 noteol; + pcre_uint8 notempty; + pcre_uint8 notempty_atstart; } jit_arguments; typedef struct executable_function { @@ -197,7 +197,7 @@ typedef struct fallback_common { struct fallback_common *top; jump_list *topfallbacks; /* Opcode pointer. */ - uschar *cc; + pcre_uchar *cc; } fallback_common; typedef struct assert_fallback { @@ -268,10 +268,10 @@ typedef struct recurse_fallback { typedef struct compiler_common { struct sljit_compiler *compiler; - uschar *start; + pcre_uchar *start; int localsize; int *localptrs; - const uschar *fcc; + const pcre_uint8 *fcc; sljit_w lcc; int cbraptr; int nltype; @@ -397,7 +397,7 @@ the start pointers when the end of the capturing group has not yet reached. */ #define COND_VALUE(op, dst, dstw, type) \ sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type)) -static uschar* bracketend(uschar* cc) +static pcre_uchar* bracketend(pcre_uchar* cc) { SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND)); do cc += GET(cc, 1); while (*cc == OP_ALT); @@ -418,7 +418,7 @@ return cc; compile_fallbackpath */ -static uschar *next_opcode(compiler_common *common, uschar *cc) +static pcre_uchar *next_opcode(compiler_common *common, pcre_uchar *cc) { SLJIT_UNUSED_ARG(common); switch(*cc) @@ -609,10 +609,10 @@ switch(*cc) } } -static int get_localspace(compiler_common *common, uschar *cc, uschar *ccend) +static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend) { int localspace = 0; -uschar *alternative; +pcre_uchar *alternative; /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */ while (cc < ccend) { @@ -656,10 +656,10 @@ while (cc < ccend) return localspace; } -static void set_localptrs(compiler_common *common, int localptr, uschar *ccend) +static void set_localptrs(compiler_common *common, int localptr, pcre_uchar *ccend) { -uschar *cc = common->start; -uschar *alternative; +pcre_uchar *cc = common->start; +pcre_uchar *alternative; while (cc < ccend) { switch(*cc) @@ -706,9 +706,9 @@ while (cc < ccend) } /* Returns with -1 if no need for frame. */ -static int get_framesize(compiler_common *common, uschar *cc, BOOL recursive) +static int get_framesize(compiler_common *common, pcre_uchar *cc, BOOL recursive) { -uschar *ccend = bracketend(cc); +pcre_uchar *ccend = bracketend(cc); int length = 0; BOOL possessive = FALSE; BOOL setsom_found = FALSE; @@ -757,10 +757,10 @@ if (length > 0) return -1; } -static void init_frame(compiler_common *common, uschar *cc, int stackpos, int stacktop, BOOL recursive) +static void init_frame(compiler_common *common, pcre_uchar *cc, int stackpos, int stacktop, BOOL recursive) { DEFINE_COMPILER; -uschar *ccend = bracketend(cc); +pcre_uchar *ccend = bracketend(cc); BOOL setsom_found = FALSE; int offset; @@ -815,10 +815,10 @@ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_end); SLJIT_ASSERT(stackpos == STACK(stacktop)); } -static SLJIT_INLINE int get_localsize(compiler_common *common, uschar *cc, uschar *ccend) +static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend) { int localsize = 2; -uschar *alternative; +pcre_uchar *alternative; /* Calculate the sum of the local variables. */ while (cc < ccend) { @@ -868,7 +868,7 @@ SLJIT_ASSERT(cc == ccend); return localsize; } -static void copy_locals(compiler_common *common, uschar *cc, uschar *ccend, +static void copy_locals(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL save, int stackptr, int stacktop) { DEFINE_COMPILER; @@ -877,7 +877,7 @@ int count; BOOL tmp1next = TRUE; BOOL tmp1empty = TRUE; BOOL tmp2empty = TRUE; -uschar *alternative; +pcre_uchar *alternative; enum { start, loop, @@ -1233,7 +1233,7 @@ else OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1); } -static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, uschar* cc) +static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc) { /* Detects if the character has an othercase. */ unsigned int c; @@ -1273,7 +1273,7 @@ if (common->utf8 && c > 127) return common->fcc[c]; } -static unsigned int char_get_othercase_bit(compiler_common *common, uschar* cc) +static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc) { /* Detects if the character and its othercase has only 1 bit difference. */ unsigned int c, oc, bit; @@ -1565,7 +1565,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); JUMPHERE(jump); /* We only have types for characters less than 256. */ -OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_char_sizes - 0xc0); +OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0); sljit_emit_fast_return(compiler, RETURN_ADDR, 0); @@ -1687,7 +1687,7 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1); if (common->utf8) { singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0); - OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0); + OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); JUMPHERE(singlebyte); } @@ -1748,7 +1748,7 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1); if (common->utf8) { CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start); - OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0); + OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); } #endif @@ -1875,7 +1875,7 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1); if (common->utf8) { CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start); - OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0); + OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); } #endif @@ -2231,12 +2231,12 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); #ifdef SUPPORT_UTF8 #ifdef SUPPORT_UCP -static uschar * SLJIT_CALL do_utf8caselesscmp(uschar *src1, jit_arguments *args, uschar *end1) +static const pcre_uchar *SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1) { /* This function would be ineffective to do in JIT level. */ int c1, c2; -uschar *src2 = args->ptr; -uschar *end2 = (uschar*)args->end; +const pcre_uchar *src2 = args->ptr; +const pcre_uchar *end2 = (pcre_uchar *)args->end; while (src1 < end1) { @@ -2252,12 +2252,12 @@ return src2; #endif #endif -static uschar *byte_sequence_compare(compiler_common *common, BOOL caseless, uschar *cc, +static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc, compare_context* context, jump_list **fallbacks) { DEFINE_COMPILER; unsigned int othercasebit = 0; -uschar *othercasebyte = NULL; +pcre_uint8 *othercasebyte = NULL; #ifdef SUPPORT_UTF8 int utf8length; #endif @@ -2395,7 +2395,7 @@ return cc; } \ charoffset = (value); -static void compile_xclass_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks) +static void compile_xclass_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks) { DEFINE_COMPILER; jump_list *found = NULL; @@ -2403,7 +2403,7 @@ jump_list **list = (*cc & XCL_NOT) == 0 ? &found : fallbacks; unsigned int c; int compares; struct sljit_jump *jump = NULL; -uschar *ccbegin; +pcre_uchar *ccbegin; #ifdef SUPPORT_UCP BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE; BOOL charsaved = FALSE; @@ -2724,7 +2724,7 @@ if (found != NULL) #endif -static uschar *compile_char1_hotpath(compiler_common *common, uschar type, uschar *cc, jump_list **fallbacks) +static pcre_uchar *compile_char1_hotpath(compiler_common *common, pcre_uchar type, pcre_uchar *cc, jump_list **fallbacks) { DEFINE_COMPILER; int length; @@ -2734,7 +2734,7 @@ struct sljit_jump *jump[4]; #ifdef SUPPORT_UTF8 struct sljit_label *label; #ifdef SUPPORT_UCP -uschar propdata[5]; +pcre_uchar propdata[5]; #endif #endif @@ -2806,7 +2806,7 @@ switch(type) OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1); jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0); - OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0); + OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); JUMPHERE(jump[0]); return cc; @@ -3077,7 +3077,7 @@ switch(type) /* Skip the variable-length character. */ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1); jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0); - OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0); + OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); JUMPHERE(jump[0]); return cc + length; @@ -3172,12 +3172,12 @@ SLJIT_ASSERT_STOP(); return cc; } -static SLJIT_INLINE uschar *compile_charn_hotpath(compiler_common *common, uschar *cc, uschar *ccend, jump_list **fallbacks) +static SLJIT_INLINE pcre_uchar *compile_charn_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, jump_list **fallbacks) { /* This function consumes at least one input character. */ /* To decrease the number of length checks, we try to concatenate the fixed length character sequences. */ DEFINE_COMPILER; -uschar *ccbegin = cc; +pcre_uchar *ccbegin = cc; compare_context context; int size; @@ -3238,7 +3238,7 @@ if (context.length > 0) return compile_char1_hotpath(common, *cc, cc + 1, fallbacks); } -static struct sljit_jump *compile_ref_checks(compiler_common *common, uschar *cc, jump_list **fallbacks) +static struct sljit_jump *compile_ref_checks(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks) { DEFINE_COMPILER; int offset = GET2(cc, 1) << 1; @@ -3260,7 +3260,7 @@ return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset } /* Forward definitions. */ -static void compile_hotpath(compiler_common *, uschar *, uschar *, fallback_common *); +static void compile_hotpath(compiler_common *, pcre_uchar *, pcre_uchar *, fallback_common *); static void compile_fallbackpath(compiler_common *, struct fallback_common *); #define PUSH_FALLBACK(size, ccstart, error) \ @@ -3291,7 +3291,7 @@ static void compile_fallbackpath(compiler_common *, struct fallback_common *); #define FALLBACK_AS(type) ((type*)fallback) -static uschar *compile_ref_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail) +static pcre_uchar *compile_ref_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail) { DEFINE_COMPILER; int offset = GET2(cc, 1) << 1; @@ -3314,7 +3314,7 @@ if (common->utf8 && *cc == OP_REFI) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0); OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, ptr), STR_PTR, 0); - sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf8caselesscmp)); + sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp)); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0)); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0); @@ -3343,15 +3343,15 @@ if (jump != NULL) return cc + 3; } -static SLJIT_INLINE uschar *compile_ref_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static SLJIT_INLINE pcre_uchar *compile_ref_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; -uschar type; +pcre_uchar type; struct sljit_label *label; struct sljit_jump *zerolength; struct sljit_jump *jump = NULL; -uschar *ccbegin = cc; +pcre_uchar *ccbegin = cc; int min = 0, max = 0; BOOL minimize; @@ -3487,7 +3487,7 @@ decrease_call_count(common); return cc; } -static SLJIT_INLINE uschar *compile_recurse_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static SLJIT_INLINE pcre_uchar *compile_recurse_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; @@ -3533,15 +3533,15 @@ add_jump(compiler, &fallback->topfallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IM return cc + 1 + LINK_SIZE; } -static uschar *compile_assert_hotpath(compiler_common *common, uschar *cc, assert_fallback *fallback, BOOL conditional) +static pcre_uchar *compile_assert_hotpath(compiler_common *common, pcre_uchar *cc, assert_fallback *fallback, BOOL conditional) { DEFINE_COMPILER; int framesize; int localptr; fallback_common altfallback; -uschar *ccbegin; -uschar opcode; -uschar bra = OP_BRA; +pcre_uchar *ccbegin; +pcre_uchar opcode; +pcre_uchar bra = OP_BRA; jump_list *tmp = NULL; jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks; jump_list **found; @@ -3803,11 +3803,11 @@ common->accept = save_accept; return cc + 1 + LINK_SIZE; } -static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, uschar *name_table) +static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, pcre_uchar *name_table) { int condition = FALSE; -uschar *slotA = name_table; -uschar *slotB; +pcre_uchar *slotA = name_table; +pcre_uchar *slotB; sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)]; sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)]; sljit_w no_capture; @@ -3859,11 +3859,11 @@ if (i < name_count) return condition; } -static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, uschar *name_table) +static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, pcre_uchar *name_table) { int condition = FALSE; -uschar *slotA = name_table; -uschar *slotB; +pcre_uchar *slotA = name_table; +pcre_uchar *slotB; sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)]; sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)]; sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)]; @@ -3966,18 +3966,18 @@ return condition; Or nothing, if trace is unnecessary */ -static uschar *compile_bracket_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static pcre_uchar *compile_bracket_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; -uschar opcode; +pcre_uchar opcode; int localptr = 0; int offset = 0; int stacksize; -uschar *ccbegin; -uschar *hotpath; -uschar bra = OP_BRA; -uschar ket; +pcre_uchar *ccbegin; +pcre_uchar *hotpath; +pcre_uchar bra = OP_BRA; +pcre_uchar ket; assert_fallback *assert; BOOL has_alternatives; struct sljit_jump *jump; @@ -4405,18 +4405,18 @@ cc += 1 + LINK_SIZE; return cc; } -static uschar *compile_bracketpos_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static pcre_uchar *compile_bracketpos_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; -uschar opcode; +pcre_uchar opcode; int localptr; int cbraprivptr = 0; int framesize; int stacksize; int offset = 0; BOOL zero = FALSE; -uschar *ccbegin = NULL; +pcre_uchar *ccbegin = NULL; int stack; struct sljit_label *loop = NULL; struct jump_list *emptymatch = NULL; @@ -4623,7 +4623,7 @@ decrease_call_count(common); return cc + 1 + LINK_SIZE; } -static SLJIT_INLINE uschar *get_iterator_parameters(compiler_common *common, uschar *cc, uschar *opcode, uschar *type, int *arg1, int *arg2, uschar **end) +static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *arg1, int *arg2, pcre_uchar **end) { int class_len; @@ -4715,14 +4715,14 @@ if (end != NULL) return cc; } -static uschar *compile_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static pcre_uchar *compile_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; -uschar opcode; -uschar type; +pcre_uchar opcode; +pcre_uchar type; int arg1 = -1, arg2 = -1; -uschar* end; +pcre_uchar* end; jump_list *nomatch = NULL; struct sljit_jump *jump = NULL; struct sljit_label *label; @@ -4884,7 +4884,7 @@ decrease_call_count(common); return end; } -static SLJIT_INLINE uschar *compile_fail_accept_hotpath(compiler_common *common, uschar *cc, fallback_common *parent) +static SLJIT_INLINE pcre_uchar *compile_fail_accept_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; @@ -4928,7 +4928,7 @@ add_jump(compiler, &fallback->topfallbacks, JUMP(SLJIT_JUMP)); return cc + 1; } -static SLJIT_INLINE uschar *compile_close_hotpath(compiler_common *common, uschar *cc) +static SLJIT_INLINE pcre_uchar *compile_close_hotpath(compiler_common *common, pcre_uchar *cc) { DEFINE_COMPILER; int offset = GET2(cc, 1); @@ -4944,7 +4944,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); return cc + 3; } -static void compile_hotpath(compiler_common *common, uschar *cc, uschar *ccend, fallback_common *parent) +static void compile_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, fallback_common *parent) { DEFINE_COMPILER; fallback_common *fallback; @@ -5195,9 +5195,9 @@ SLJIT_ASSERT(cc == ccend); static void compile_iterator_fallbackpath(compiler_common *common, struct fallback_common *current) { DEFINE_COMPILER; -uschar *cc = current->cc; -uschar opcode; -uschar type; +pcre_uchar *cc = current->cc; +pcre_uchar opcode; +pcre_uchar type; int arg1 = -1, arg2 = -1; struct sljit_label *label = NULL; struct sljit_jump *jump = NULL; @@ -5322,8 +5322,8 @@ switch(opcode) static void compile_ref_iterator_fallbackpath(compiler_common *common, struct fallback_common *current) { DEFINE_COMPILER; -uschar *cc = current->cc; -uschar type; +pcre_uchar *cc = current->cc; +pcre_uchar type; type = cc[3]; if ((type & 0x1) == 0) @@ -5354,8 +5354,8 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP2, 0); static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current) { DEFINE_COMPILER; -uschar *cc = current->cc; -uschar bra = OP_BRA; +pcre_uchar *cc = current->cc; +pcre_uchar bra = OP_BRA; struct sljit_jump *brajump = NULL; SLJIT_ASSERT(*cc != OP_BRAMINZERO); @@ -5426,13 +5426,13 @@ int offset = 0; int localptr = CURRENT_AS(bracket_fallback)->localptr; int stacksize; int count; -uschar *cc = current->cc; -uschar *ccbegin; -uschar *ccprev; +pcre_uchar *cc = current->cc; +pcre_uchar *ccbegin; +pcre_uchar *ccprev; jump_list *jumplist = NULL; jump_list *jumplistitem = NULL; -uschar bra = OP_BRA; -uschar ket; +pcre_uchar bra = OP_BRA; +pcre_uchar ket; assert_fallback *assert; BOOL has_alternatives; struct sljit_jump *brazero = NULL; @@ -5998,9 +5998,9 @@ while (current) static SLJIT_INLINE void compile_recurse(compiler_common *common) { DEFINE_COMPILER; -uschar *cc = common->start + common->currententry->start; -uschar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : 2); -uschar *ccend = bracketend(cc); +pcre_uchar *cc = common->start + common->currententry->start; +pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : 2); +pcre_uchar *ccend = bracketend(cc); int localsize = get_localsize(common, ccbegin, ccend); int framesize = get_framesize(common, cc, TRUE); int alternativesize; @@ -6094,9 +6094,9 @@ struct sljit_compiler *compiler; fallback_common rootfallback; compiler_common common_data; compiler_common *common = &common_data; -const uschar *tables = re->tables; +const pcre_uint8 *tables = re->tables; pcre_study_data *study; -uschar *ccend; +pcre_uchar *ccend; executable_function *function; void *executable_func; struct sljit_label *leave; @@ -6114,7 +6114,7 @@ if (!tables) tables = _pcre_default_tables; memset(&rootfallback, 0, sizeof(fallback_common)); -rootfallback.cc = (uschar *)re + re->name_table_offset + re->name_count * re->name_entry_size; +rootfallback.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size; common->compiler = NULL; common->start = rootfallback.cc; @@ -6454,7 +6454,7 @@ union { void* executable_func; jit_function call_executable_func; } convert_executable_func; -uschar local_area[LOCAL_SPACE_SIZE]; +pcre_uint8 local_area[LOCAL_SPACE_SIZE]; struct sljit_stack local_stack; local_stack.top = (sljit_w)&local_area; diff --git a/pcre_newline.c b/pcre_newline.c index 38cf7f7..804a2fd 100644 --- a/pcre_newline.c +++ b/pcre_newline.c @@ -73,7 +73,8 @@ Returns: TRUE or FALSE */ BOOL -_pcre_is_newline(USPTR ptr, int type, USPTR endptr, int *lenptr, BOOL utf8) +_pcre_is_newline(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr, + BOOL utf8) { int c; if (utf8) { GETCHAR(c, ptr); } else c = *ptr; @@ -122,7 +123,8 @@ Returns: TRUE or FALSE */ BOOL -_pcre_was_newline(USPTR ptr, int type, USPTR startptr, int *lenptr, BOOL utf8) +_pcre_was_newline(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr, + BOOL utf8) { int c; ptr--; diff --git a/pcre_ord2utf8.c b/pcre_ord2utf8.c index 6f4eb9e..5ae60b8 100644 --- a/pcre_ord2utf8.c +++ b/pcre_ord2utf8.c @@ -63,7 +63,7 @@ Returns: number of characters placed in the buffer */ int -_pcre_ord2utf8(int cvalue, uschar *buffer) +_pcre_ord2utf8(int cvalue, pcre_uint8 *buffer) { #ifdef SUPPORT_UTF8 register int i, j; diff --git a/pcre_printint.src b/pcre_printint.src index 5074cd5..3182ecd 100644 --- a/pcre_printint.src +++ b/pcre_printint.src @@ -72,7 +72,7 @@ static const char *OP_names[] = { OP_NAME_LIST }; *************************************************/ static int -print_char(FILE *f, uschar *ptr, BOOL utf8) +print_char(FILE *f, pcre_uchar *ptr, BOOL utf8) { int c = *ptr; @@ -155,7 +155,7 @@ static void pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths) { real_pcre *re = (real_pcre *)external_re; -uschar *codestart, *code; +pcre_uchar *codestart, *code; BOOL utf8; unsigned int options = re->options; @@ -174,12 +174,12 @@ if (re->magic_number != MAGIC_NUMBER) ((options >> 24) & 0x000000ff); } -code = codestart = (uschar *)re + offset + count * size; +code = codestart = (pcre_uchar *)re + offset + count * size; utf8 = (options & PCRE_UTF8) != 0; for(;;) { - uschar *ccode; + pcre_uchar *ccode; const char *flag = " "; int c; int extra = 0; diff --git a/pcre_study.c b/pcre_study.c index 9da92bf..cc515ac 100644 --- a/pcre_study.c +++ b/pcre_study.c @@ -78,14 +78,14 @@ Returns: the minimum length */ static int -find_minlength(const uschar *code, const uschar *startcode, int options, +find_minlength(const pcre_uchar *code, const pcre_uchar *startcode, int options, int recurse_depth) { int length = -1; BOOL utf8 = (options & PCRE_UTF8) != 0; BOOL had_recurse = FALSE; register int branchlength = 0; -register uschar *cc = (uschar *)code + 1 + LINK_SIZE; +register pcre_uchar *cc = (pcre_uchar *)code + 1 + LINK_SIZE; if (*code == OP_CBRA || *code == OP_SCBRA || *code == OP_CBRAPOS || *code == OP_SCBRAPOS) cc += 2; @@ -96,7 +96,7 @@ branch, check the length against that of the other branches. */ for (;;) { int d, min; - uschar *cs, *ce; + pcre_uchar *cs, *ce; register int op = *cc; switch (op) @@ -372,7 +372,7 @@ for (;;) case OP_REFI: if ((options & PCRE_JAVASCRIPT_COMPAT) == 0) { - ce = cs = (uschar *)_pcre_find_bracket(startcode, utf8, GET2(cc, 1)); + ce = cs = (pcre_uchar *)_pcre_find_bracket(startcode, utf8, GET2(cc, 1)); if (cs == NULL) return -2; do ce += GET(ce, 1); while (*ce == OP_ALT); if (cc > cs && cc < ce) @@ -424,7 +424,7 @@ for (;;) caught by a recursion depth count. */ case OP_RECURSE: - cs = ce = (uschar *)startcode + GET(cc, 1); + cs = ce = (pcre_uchar *)startcode + GET(cc, 1); do ce += GET(ce, 1); while (*ce == OP_ALT); if ((cc > cs && cc < ce) || recurse_depth > 10) had_recurse = TRUE; @@ -540,8 +540,8 @@ Arguments: Returns: pointer after the character */ -static const uschar * -set_table_bit(uschar *start_bits, const uschar *p, BOOL caseless, +static const pcre_uchar * +set_table_bit(pcre_uint8 *start_bits, const pcre_uchar *p, BOOL caseless, compile_data *cd, BOOL utf8) { unsigned int c = *p; @@ -555,7 +555,7 @@ if (utf8 && c > 127) #ifdef SUPPORT_UCP if (caseless) { - uschar buff[8]; + pcre_uint8 buff[8]; c = UCD_OTHERCASE(c); (void)_pcre_ord2utf8(c, buff); SET_BIT(buff[0]); @@ -594,7 +594,7 @@ Returns: nothing */ static void -set_type_bits(uschar *start_bits, int cbit_type, int table_limit, +set_type_bits(pcre_uint8 *start_bits, int cbit_type, int table_limit, compile_data *cd) { register int c; @@ -604,7 +604,7 @@ for (c = 128; c < 256; c++) { if ((cd->cbits[c/8] & (1 << (c&7))) != 0) { - uschar buff[8]; + pcre_uint8 buff[8]; (void)_pcre_ord2utf8(c, buff); SET_BIT(buff[0]); } @@ -634,7 +634,7 @@ Returns: nothing */ static void -set_nottype_bits(uschar *start_bits, int cbit_type, int table_limit, +set_nottype_bits(pcre_uint8 *start_bits, int cbit_type, int table_limit, compile_data *cd) { register int c; @@ -669,7 +669,7 @@ Returns: SSB_FAIL => Failed to find any starting bytes */ static int -set_start_bits(const uschar *code, uschar *start_bits, BOOL utf8, +set_start_bits(const pcre_uchar *code, pcre_uint8 *start_bits, BOOL utf8, compile_data *cd) { register int c; @@ -696,7 +696,7 @@ volatile int dummy; do { BOOL try_next = TRUE; - const uschar *tcode = code + 1 + LINK_SIZE; + const pcre_uchar *tcode = code + 1 + LINK_SIZE; if (*code == OP_CBRA || *code == OP_SCBRA || *code == OP_CBRAPOS || *code == OP_SCBRAPOS) tcode += 2; @@ -1224,11 +1224,11 @@ pcre_study(const pcre *external_re, int options, const char **errorptr) { int min; BOOL bits_set = FALSE; -uschar start_bits[32]; +pcre_uint8 start_bits[32]; pcre_extra *extra = NULL; pcre_study_data *study; -const uschar *tables; -uschar *code; +const pcre_uint8 *tables; +pcre_uchar *code; compile_data compile_block; const real_pcre *re = (const real_pcre *)external_re; @@ -1246,7 +1246,7 @@ if ((options & ~PUBLIC_STUDY_OPTIONS) != 0) return NULL; } -code = (uschar *)re + re->name_table_offset + +code = (pcre_uchar *)re + re->name_table_offset + (re->name_count * re->name_entry_size); /* For an anchored pattern, or an unanchored pattern that has a first char, or @@ -1272,7 +1272,7 @@ if ((re->options & PCRE_ANCHORED) == 0 && /* See if we can find a fixed set of initial characters for the pattern. */ - memset(start_bits, 0, 32 * sizeof(uschar)); + memset(start_bits, 0, 32 * sizeof(pcre_uint8)); rc = set_start_bits(code, start_bits, (re->options & PCRE_UTF8) != 0, &compile_block); bits_set = rc == SSB_DONE; diff --git a/pcre_tables.c b/pcre_tables.c index 45c2211..1d48c5d 100644 --- a/pcre_tables.c +++ b/pcre_tables.c @@ -54,7 +54,7 @@ clashes with the library. */ /* Table of sizes for the fixed-length opcodes. It's defined in a macro so that the definition is next to the definition of the opcodes in pcre_internal.h. */ -const uschar _pcre_OP_lengths[] = { OP_LENGTHS }; +const pcre_uint8 _pcre_OP_lengths[] = { OP_LENGTHS }; @@ -81,25 +81,12 @@ const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01}; /* Table of the number of extra bytes, indexed by the first byte masked with 0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */ -const uschar _pcre_utf8_table4[] = { +const pcre_uint8 _pcre_utf8_table4[] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; -#ifdef SUPPORT_JIT -/* Full table of the number of extra bytes when the -character code is greater or equal than 0xc0. -See _pcre_utf8_table4 above. */ - -const uschar _pcre_utf8_char_sizes[] = { - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4, -}; -#endif - /* Table to translate from particular type value to the general value. */ const int _pcre_ucp_gentype[] = { @@ -19,15 +19,15 @@ #ifndef SUPPORT_UCP const ucd_record _pcre_ucd_records[] = {{0,0,0 }}; -const uschar _pcre_ucd_stage1[] = {0}; +const pcre_uint8 _pcre_ucd_stage1[] = {0}; const pcre_uint16 _pcre_ucd_stage2[] = {0}; #else /* When recompiling tables with a new Unicode version, please check types in the structure definition from pcre_internal.h: typedef struct { -uschar property_0; -uschar property_1; +pcre_uint8 property_0; +pcre_uint8 property_1; pcre_int32 property_2; } ucd_record; */ @@ -575,7 +575,7 @@ const ucd_record _pcre_ucd_records[] = { /* 4320 bytes, record size 8 */ { 26, 26, 0, }, /* 539 */ }; -const uschar _pcre_ucd_stage1[] = { /* 8704 bytes */ +const pcre_uint8 _pcre_ucd_stage1[] = { /* 8704 bytes */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* U+0000 */ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* U+0800 */ 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 40, 40, 41, 42, 43, 44, /* U+1000 */ diff --git a/pcre_valid_utf8.c b/pcre_valid_utf8.c index fef6538..1861a4b 100644 --- a/pcre_valid_utf8.c +++ b/pcre_valid_utf8.c @@ -103,10 +103,10 @@ Returns: = 0 if the string is a valid UTF-8 string */ int -_pcre_valid_utf8(USPTR string, int length, int *erroroffset) +_pcre_valid_utf8(PCRE_PUCHAR string, int length, int *erroroffset) { #ifdef SUPPORT_UTF8 -register USPTR p; +register PCRE_PUCHAR p; if (length < 0) { diff --git a/pcre_xclass.c b/pcre_xclass.c index 64c1b00..76c1767 100644 --- a/pcre_xclass.c +++ b/pcre_xclass.c @@ -64,7 +64,7 @@ Returns: TRUE if character matches, else FALSE */ BOOL -_pcre_xclass(int c, const uschar *data) +_pcre_xclass(int c, const pcre_uchar *data) { int t; BOOL negated = (*data & XCL_NOT) != 0; @@ -118,7 +118,6 @@ external symbols to prevent clashes. */ #define _pcre_utf8_table2 utf8_table2 #define _pcre_utf8_table3 utf8_table3 #define _pcre_utf8_table4 utf8_table4 -#define _pcre_utf8_char_sizes utf8_char_sizes #define _pcre_utt utt #define _pcre_utt_size utt_size #define _pcre_utt_names utt_names @@ -196,9 +195,9 @@ static const unsigned char *last_callout_mark = NULL; /* The buffers grow automatically if very long input lines are encountered. */ static int buffer_size = 50000; -static uschar *buffer = NULL; -static uschar *dbuffer = NULL; -static uschar *pbuffer = NULL; +static pcre_uint8 *buffer = NULL; +static pcre_uint8 *dbuffer = NULL; +static pcre_uint8 *pbuffer = NULL; /* Textual explanations for runtime error codes */ @@ -615,10 +614,10 @@ Returns: pointer to the start of new data NULL if no data read and EOF reached */ -static uschar * -extend_inputline(FILE *f, uschar *start, const char *prompt) +static pcre_uint8 * +extend_inputline(FILE *f, pcre_uint8 *start, const char *prompt) { -uschar *here = start; +pcre_uint8 *here = start; for (;;) { @@ -665,9 +664,9 @@ for (;;) else { int new_buffer_size = 2*buffer_size; - uschar *new_buffer = (unsigned char *)malloc(new_buffer_size); - uschar *new_dbuffer = (unsigned char *)malloc(new_buffer_size); - uschar *new_pbuffer = (unsigned char *)malloc(new_buffer_size); + pcre_uint8 *new_buffer = (unsigned char *)malloc(new_buffer_size); + pcre_uint8 *new_dbuffer = (unsigned char *)malloc(new_buffer_size); + pcre_uint8 *new_pbuffer = (unsigned char *)malloc(new_buffer_size); if (new_buffer == NULL || new_dbuffer == NULL || new_pbuffer == NULL) { @@ -809,7 +808,7 @@ Returns: number of characters placed in the buffer #if !defined NOUTF8 static int -ord2utf8(int cvalue, uschar *utf8bytes) +ord2utf8(int cvalue, pcre_uint8 *utf8bytes) { register int i, j; for (i = 0; i < utf8_table1_size; i++) @@ -1072,7 +1071,7 @@ return ((value & 0x000000ff) << 24) | *************************************************/ static int -check_match_limit(pcre *re, pcre_extra *extra, uschar *bptr, int len, +check_match_limit(pcre *re, pcre_extra *extra, pcre_uint8 *bptr, int len, int start_offset, int options, int *use_offsets, int use_size_offsets, int flag, unsigned long int *limit, int errnumber, const char *msg) { @@ -1132,7 +1131,7 @@ Returns: < 0, = 0, or > 0, according to the comparison */ static int -strncmpic(uschar *s, uschar *t, int n) +strncmpic(pcre_uint8 *s, pcre_uint8 *t, int n) { while (n--) { @@ -1159,15 +1158,15 @@ Returns: appropriate PCRE_NEWLINE_xxx flags, or 0 */ static int -check_newline(uschar *p, FILE *f) +check_newline(pcre_uint8 *p, FILE *f) { -if (strncmpic(p, (uschar *)"cr>", 3) == 0) return PCRE_NEWLINE_CR; -if (strncmpic(p, (uschar *)"lf>", 3) == 0) return PCRE_NEWLINE_LF; -if (strncmpic(p, (uschar *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF; -if (strncmpic(p, (uschar *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF; -if (strncmpic(p, (uschar *)"any>", 4) == 0) return PCRE_NEWLINE_ANY; -if (strncmpic(p, (uschar *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF; -if (strncmpic(p, (uschar *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE; +if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR; +if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF; +if (strncmpic(p, (pcre_uint8 *)"crlf>", 5) == 0) return PCRE_NEWLINE_CRLF; +if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF; +if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY; +if (strncmpic(p, (pcre_uint8 *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF; +if (strncmpic(p, (pcre_uint8 *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE; fprintf(f, "Unknown newline type at: <%s\n", p); return 0; } @@ -1255,18 +1254,18 @@ pcre_jit_stack *jit_stack = NULL; /* These vectors store, end-to-end, a list of captured substring names. Assume that 1024 is plenty long enough for the few names we'll be testing. */ -uschar copynames[1024]; -uschar getnames[1024]; +pcre_uchar copynames[1024]; +pcre_uchar getnames[1024]; -uschar *copynamesptr; -uschar *getnamesptr; +pcre_uchar *copynamesptr; +pcre_uchar *getnamesptr; /* Get buffers from malloc() so that Electric Fence will check their misuse when I am debugging. They grow automatically when very long lines are read. */ -buffer = (unsigned char *)malloc(buffer_size); -dbuffer = (unsigned char *)malloc(buffer_size); -pbuffer = (unsigned char *)malloc(buffer_size); +buffer = (pcre_uint8 *)malloc(buffer_size); +dbuffer = (pcre_uint8 *)malloc(buffer_size); +pbuffer = (pcre_uint8 *)malloc(buffer_size); /* The outfile variable is static so that new_malloc can use it. */ @@ -1497,7 +1496,7 @@ while (!done) if (*p == '<' && strchr((char *)(p+1), '<') == NULL) { unsigned long int magic, get_options; - uschar sbuf[8]; + pcre_uint8 sbuf[8]; FILE *f; p++; @@ -1733,7 +1732,7 @@ while (!done) case '<': { - if (strncmpic(pp, (uschar *)"JS>", 3) == 0) + if (strncmpic(pp, (pcre_uint8 *)"JS>", 3) == 0) { options |= PCRE_JAVASCRIPT_COMPAT; pp += 3; @@ -1962,7 +1961,7 @@ while (!done) int count, backrefmax, first_char, need_char, okpartial, jchanged, hascrorlf; int nameentrysize, namecount; - const uschar *nametable; + const pcre_uchar *nametable; new_info(re, NULL, PCRE_INFO_SIZE, &size); new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count); @@ -2118,7 +2117,7 @@ while (!done) fprintf(outfile, "Study returned NULL\n"); else { - uschar *start_bits = NULL; + pcre_uint8 *start_bits = NULL; int minlength; new_info(re, extra, PCRE_INFO_MINLENGTH, &minlength); @@ -2188,16 +2187,16 @@ while (!done) } else { - uschar sbuf[8]; - sbuf[0] = (uschar)((true_size >> 24) & 255); - sbuf[1] = (uschar)((true_size >> 16) & 255); - sbuf[2] = (uschar)((true_size >> 8) & 255); - sbuf[3] = (uschar)((true_size) & 255); + pcre_uint8 sbuf[8]; + sbuf[0] = (pcre_uint8)((true_size >> 24) & 255); + sbuf[1] = (pcre_uint8)((true_size >> 16) & 255); + sbuf[2] = (pcre_uint8)((true_size >> 8) & 255); + sbuf[3] = (pcre_uint8)((true_size) & 255); - sbuf[4] = (uschar)((true_study_size >> 24) & 255); - sbuf[5] = (uschar)((true_study_size >> 16) & 255); - sbuf[6] = (uschar)((true_study_size >> 8) & 255); - sbuf[7] = (uschar)((true_study_size) & 255); + sbuf[4] = (pcre_uint8)((true_study_size >> 24) & 255); + sbuf[5] = (pcre_uint8)((true_study_size >> 16) & 255); + sbuf[6] = (pcre_uint8)((true_study_size >> 8) & 255); + sbuf[7] = (pcre_uint8)((true_study_size) & 255); if (fwrite(sbuf, 1, 8, f) < 8 || fwrite(re, 1, true_size, f) < true_size) @@ -2240,8 +2239,8 @@ while (!done) for (;;) { - uschar *q; - uschar *bptr; + pcre_uint8 *q; + pcre_uint8 *bptr; int *use_offsets = offsets; int use_size_offsets = size_offsets; int callout_data = 0; @@ -2418,7 +2417,7 @@ while (!done) } else if (isalnum(*p)) { - uschar *npp = copynamesptr; + pcre_uchar *npp = copynamesptr; while (isalnum(*p)) *npp++ = *p++; *npp++ = 0; *npp = 0; @@ -2488,7 +2487,7 @@ while (!done) } else if (isalnum(*p)) { - uschar *npp = getnamesptr; + pcre_uchar *npp = getnamesptr; while (isalnum(*p)) *npp++ = *p++; *npp++ = 0; *npp = 0; |