/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1065 by chpe, Tue Oct 16 15:54:16 2012 UTC revision 1073 by chpe, Tue Oct 16 15:54:43 2012 UTC
# Line 1311  int max = -1; Line 1311  int max = -1;
1311  /* Read the minimum value and do a paranoid check: a negative value indicates  /* Read the minimum value and do a paranoid check: a negative value indicates
1312  an integer overflow. */  an integer overflow. */
1313    
1314  while (IS_DIGIT(*p)) min = min * 10 + *p++ - CHAR_0;  while (IS_DIGIT(*p)) min = min * 10 + (int)(*p++ - CHAR_0);
1315  if (min < 0 || min > 65535)  if (min < 0 || min > 65535)
1316    {    {
1317    *errorcodeptr = ERR5;    *errorcodeptr = ERR5;
# Line 1326  if (*p == CHAR_RIGHT_CURLY_BRACKET) max Line 1326  if (*p == CHAR_RIGHT_CURLY_BRACKET) max
1326    if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)    if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)
1327      {      {
1328      max = 0;      max = 0;
1329      while(IS_DIGIT(*p)) max = max * 10 + *p++ - CHAR_0;      while(IS_DIGIT(*p)) max = max * 10 + (int)(*p++ - CHAR_0);
1330      if (max < 0 || max > 65535)      if (max < 0 || max > 65535)
1331        {        {
1332        *errorcodeptr = ERR5;        *errorcodeptr = ERR5;
# Line 1457  if (ptr[0] == CHAR_LEFT_PARENTHESIS) Line 1457  if (ptr[0] == CHAR_LEFT_PARENTHESIS)
1457      if ((*ptr == CHAR_LESS_THAN_SIGN && ptr[1] != CHAR_EXCLAMATION_MARK &&      if ((*ptr == CHAR_LESS_THAN_SIGN && ptr[1] != CHAR_EXCLAMATION_MARK &&
1458          ptr[1] != CHAR_EQUALS_SIGN) || *ptr == CHAR_APOSTROPHE)          ptr[1] != CHAR_EQUALS_SIGN) || *ptr == CHAR_APOSTROPHE)
1459        {        {
1460        int term;        pcre_uchar term;
1461        const pcre_uchar *thisname;        const pcre_uchar *thisname;
1462        *count += 1;        *count += 1;
1463        if (name == NULL && *count == lorn) return *count;        if (name == NULL && *count == lorn) return *count;
# Line 1465  if (ptr[0] == CHAR_LEFT_PARENTHESIS) Line 1465  if (ptr[0] == CHAR_LEFT_PARENTHESIS)
1465        if (term == CHAR_LESS_THAN_SIGN) term = CHAR_GREATER_THAN_SIGN;        if (term == CHAR_LESS_THAN_SIGN) term = CHAR_GREATER_THAN_SIGN;
1466        thisname = ptr;        thisname = ptr;
1467        while (*ptr != term) ptr++;        while (*ptr != term) ptr++;
1468        if (name != NULL && lorn == ptr - thisname &&        if (name != NULL && lorn == (int)(ptr - thisname) &&
1469            STRNCMP_UC_UC(name, thisname, lorn) == 0)            STRNCMP_UC_UC(name, thisname, (unsigned int)lorn) == 0)
1470          return *count;          return *count;
1471        term++;        term++;
1472        }        }
# Line 1744  for (;;) Line 1744  for (;;)
1744    {    {
1745    int d;    int d;
1746    pcre_uchar *ce, *cs;    pcre_uchar *ce, *cs;
1747    register int op = *cc;    register pcre_uchar op = *cc;
1748    
1749    switch (op)    switch (op)
1750      {      {
# Line 1864  for (;;) Line 1864  for (;;)
1864      case OP_EXACTI:      case OP_EXACTI:
1865      case OP_NOTEXACT:      case OP_NOTEXACT:
1866      case OP_NOTEXACTI:      case OP_NOTEXACTI:
1867      branchlength += GET2(cc,1);      branchlength += (int)GET2(cc,1);
1868      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
1869  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
1870      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
# Line 1932  for (;;) Line 1932  for (;;)
1932        case OP_CRRANGE:        case OP_CRRANGE:
1933        case OP_CRMINRANGE:        case OP_CRMINRANGE:
1934        if (GET2(cc,1) != GET2(cc,1+IMM2_SIZE)) return -1;        if (GET2(cc,1) != GET2(cc,1+IMM2_SIZE)) return -1;
1935        branchlength += GET2(cc,1);        branchlength += (int)GET2(cc,1);
1936        cc += 1 + 2 * IMM2_SIZE;        cc += 1 + 2 * IMM2_SIZE;
1937        break;        break;
1938    
# Line 2059  PRIV(find_bracket)(const pcre_uchar *cod Line 2059  PRIV(find_bracket)(const pcre_uchar *cod
2059  {  {
2060  for (;;)  for (;;)
2061    {    {
2062    register int c = *code;    register pcre_uchar c = *code;
2063    
2064    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
2065    
# Line 2082  for (;;) Line 2082  for (;;)
2082    else if (c == OP_CBRA || c == OP_SCBRA ||    else if (c == OP_CBRA || c == OP_SCBRA ||
2083             c == OP_CBRAPOS || c == OP_SCBRAPOS)             c == OP_CBRAPOS || c == OP_SCBRAPOS)
2084      {      {
2085      int n = GET2(code, 1+LINK_SIZE);      int n = (int)GET2(code, 1+LINK_SIZE);
2086      if (n == number) return (pcre_uchar *)code;      if (n == number) return (pcre_uchar *)code;
2087      code += PRIV(OP_lengths)[c];      code += PRIV(OP_lengths)[c];
2088      }      }
# Line 2197  find_recurse(const pcre_uchar *code, BOO Line 2197  find_recurse(const pcre_uchar *code, BOO
2197  {  {
2198  for (;;)  for (;;)
2199    {    {
2200    register int c = *code;    register pcre_uchar c = *code;
2201    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
2202    if (c == OP_RECURSE) return code;    if (c == OP_RECURSE) return code;
2203    
# Line 2351  static BOOL Line 2351  static BOOL
2351  could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,  could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,
2352    BOOL utf, compile_data *cd)    BOOL utf, compile_data *cd)
2353  {  {
2354  register int c;  register pcre_uchar c;
2355  for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);  for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
2356       code < endcode;       code < endcode;
2357       code = first_significant_code(code + PRIV(OP_lengths)[c], TRUE))       code = first_significant_code(code + PRIV(OP_lengths)[c], TRUE))
# Line 2385  for (code = first_significant_code(code Line 2385  for (code = first_significant_code(code
2385      /* Test for forward reference */      /* Test for forward reference */
2386    
2387      for (scode = cd->start_workspace; scode < cd->hwm; scode += LINK_SIZE)      for (scode = cd->start_workspace; scode < cd->hwm; scode += LINK_SIZE)
2388        if (GET(scode, 0) == code + 1 - cd->start_code) return TRUE;        if ((int)GET(scode, 0) == (int)(code + 1 - cd->start_code)) return TRUE;
2389    
2390      /* Not a forward reference, test for completed backward reference */      /* Not a forward reference, test for completed backward reference */
2391    
# Line 2706  Returns:   TRUE or FALSE Line 2706  Returns:   TRUE or FALSE
2706  static BOOL  static BOOL
2707  check_posix_syntax(const pcre_uchar *ptr, const pcre_uchar **endptr)  check_posix_syntax(const pcre_uchar *ptr, const pcre_uchar **endptr)
2708  {  {
2709  int terminator;          /* Don't combine these lines; the Solaris cc */  pcre_uchar terminator;          /* Don't combine these lines; the Solaris cc */
2710  terminator = *(++ptr);   /* compiler warns about "non-constant" initializer. */  terminator = *(++ptr);   /* compiler warns about "non-constant" initializer. */
2711  for (++ptr; *ptr != 0; ptr++)  for (++ptr; *ptr != 0; ptr++)
2712    {    {
# Line 2810  while ((ptr = (pcre_uchar *)find_recurse Line 2810  while ((ptr = (pcre_uchar *)find_recurse
2810    
2811    for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)    for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)
2812      {      {
2813      offset = GET(hc, 0);      offset = (int)GET(hc, 0);
2814      if (cd->start_code + offset == ptr + 1)      if (cd->start_code + offset == ptr + 1)
2815        {        {
2816        PUT(hc, 0, offset + adjust);        PUT(hc, 0, offset + adjust);
# Line 2823  while ((ptr = (pcre_uchar *)find_recurse Line 2823  while ((ptr = (pcre_uchar *)find_recurse
2823    
2824    if (hc >= cd->hwm)    if (hc >= cd->hwm)
2825      {      {
2826      offset = GET(ptr, 1);      offset = (int)GET(ptr, 1);
2827      if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);      if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
2828      }      }
2829    

Legend:
Removed from v.1065  
changed lines
  Added in v.1073

  ViewVC Help
Powered by ViewVC 1.1.5