/[pcre]/code/branches/pcre16/pcre_dfa_exec.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_dfa_exec.c

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

revision 793 by zherczeg, Tue Dec 6 11:33:41 2011 UTC revision 794 by zherczeg, Thu Dec 8 07:36:41 2011 UTC
# Line 2683  for (;;) Line 2683  for (;;)
2683              const pcre_uchar *p = start_subject + local_offsets[rc];              const pcre_uchar *p = start_subject + local_offsets[rc];
2684              const pcre_uchar *pp = start_subject + local_offsets[rc+1];              const pcre_uchar *pp = start_subject + local_offsets[rc+1];
2685              int charcount = local_offsets[rc+1] - local_offsets[rc];              int charcount = local_offsets[rc+1] - local_offsets[rc];
2686              while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--;              while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--;
2687              if (charcount > 0)              if (charcount > 0)
2688                {                {
2689                ADD_NEW_DATA(-(state_offset + LINK_SIZE + 1), 0, (charcount - 1));                ADD_NEW_DATA(-(state_offset + LINK_SIZE + 1), 0, (charcount - 1));
# Line 2780  for (;;) Line 2780  for (;;)
2780              const pcre_uchar *p = ptr;              const pcre_uchar *p = ptr;
2781              const pcre_uchar *pp = local_ptr;              const pcre_uchar *pp = local_ptr;
2782              charcount = pp - p;              charcount = pp - p;
2783              while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--;              while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--;
2784              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
2785              }              }
2786            }            }
# Line 2862  for (;;) Line 2862  for (;;)
2862              {              {
2863              const pcre_uchar *p = start_subject + local_offsets[0];              const pcre_uchar *p = start_subject + local_offsets[0];
2864              const pcre_uchar *pp = start_subject + local_offsets[1];              const pcre_uchar *pp = start_subject + local_offsets[1];
2865              while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--;              while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--;
2866              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
2867              if (repeat_state_offset >= 0)              if (repeat_state_offset >= 0)
2868                { ADD_NEW_DATA(-repeat_state_offset, 0, (charcount - 1)); }                { ADD_NEW_DATA(-repeat_state_offset, 0, (charcount - 1)); }
# Line 3144  else Line 3144  else
3144  /* Check a UTF-8 string if required. Unfortunately there's no way of passing  /* Check a UTF-8 string if required. Unfortunately there's no way of passing
3145  back the character offset. */  back the character offset. */
3146    
3147  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3148  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0)  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0)
3149    {    {
3150    int erroroffset;    int erroroffset;
# Line 3159  if (utf && (options & PCRE_NO_UTF8_CHECK Line 3159  if (utf && (options & PCRE_NO_UTF8_CHECK
3159      return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0)?      return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0)?
3160        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;
3161      }      }
 #ifdef COMPILE_PCRE8  
   if (start_offset > 0 && start_offset < length &&  
         (((PCRE_PUCHAR)subject)[start_offset] & 0xc0) == 0x80)  
     return PCRE_ERROR_BADUTF8_OFFSET;  
 #else  
 #ifdef COMPILE_PCRE16  
3162    if (start_offset > 0 && start_offset < length &&    if (start_offset > 0 && start_offset < length &&
3163          (((PCRE_PUCHAR)subject)[start_offset] & 0xfc00) == 0xdc00)          NOT_FIRSTCHAR(((PCRE_PUCHAR)subject)[start_offset]))
3164      return PCRE_ERROR_BADUTF8_OFFSET;      return PCRE_ERROR_BADUTF8_OFFSET;
 #endif /* COMPILE_PCRE16 */  
 #endif /* COMPILE_PCRE8 */  
3165    }    }
3166  #endif  #endif
3167    

Legend:
Removed from v.793  
changed lines
  Added in v.794

  ViewVC Help
Powered by ViewVC 1.1.5