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

Diff of /code/trunk/pcretest.c

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

revision 558 by ph10, Tue Oct 26 15:26:45 2010 UTC revision 566 by ph10, Wed Nov 3 18:32:55 2010 UTC
# Line 2791  while (!done) Line 2791  while (!done)
2791        to advance the start offset, and continue. We won't be at the end of the        to advance the start offset, and continue. We won't be at the end of the
2792        string - that was checked before setting g_notempty.        string - that was checked before setting g_notempty.
2793    
2794        Complication arises in the case when the newline option is "any" or        Complication arises in the case when the newline convention is "any",
2795        "anycrlf". If the previous match was at the end of a line terminated by        "crlf", or "anycrlf". If the previous match was at the end of a line
2796        CRLF, an advance of one character just passes the \r, whereas we should        terminated by CRLF, an advance of one character just passes the \r,
2797        prefer the longer newline sequence, as does the code in pcre_exec().        whereas we should prefer the longer newline sequence, as does the code in
2798        Fudge the offset value to achieve this.        pcre_exec(). Fudge the offset value to achieve this. We check for a
2799          newline setting in the pattern; if none was set, use pcre_config() to
2800          find the default.
2801    
2802        Otherwise, in the case of UTF-8 matching, the advance must be one        Otherwise, in the case of UTF-8 matching, the advance must be one
2803        character, not one byte. */        character, not one byte. */
# Line 2820  while (!done) Line 2822  while (!done)
2822                      (d == -1)? PCRE_NEWLINE_ANY : 0;                      (d == -1)? PCRE_NEWLINE_ANY : 0;
2823              }              }
2824            if (((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY ||            if (((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY ||
2825                   (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_CRLF ||
2826                 (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)                 (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)
2827                &&                &&
2828                start_offset < len - 1 &&                start_offset < len - 1 &&
# Line 2830  while (!done) Line 2833  while (!done)
2833              {              {
2834              while (start_offset + onechar < len)              while (start_offset + onechar < len)
2835                {                {
2836                int tb = bptr[start_offset+onechar];                if ((bptr[start_offset+onechar] & 0xc0) != 0x80) break;
2837                if (tb <= 127) break;                onechar++;
               tb &= 0xc0;  
               if (tb != 0 && tb != 0xc0) onechar++;  
2838                }                }
2839              }              }
2840            use_offsets[1] = start_offset + onechar;            use_offsets[1] = start_offset + onechar;

Legend:
Removed from v.558  
changed lines
  Added in v.566

  ViewVC Help
Powered by ViewVC 1.1.5