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

Diff of /code/trunk/pcre_exec.c

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

revision 604 by ph10, Thu Jun 2 19:04:54 2011 UTC revision 606 by ph10, Mon Jun 6 17:46:22 2011 UTC
# Line 5999  if (md->partial && (re->flags & PCRE_NOP Line 5999  if (md->partial && (re->flags & PCRE_NOP
5999    return PCRE_ERROR_BADPARTIAL;    return PCRE_ERROR_BADPARTIAL;
6000    
6001  /* Check a UTF-8 string if required. Pass back the character offset and error  /* Check a UTF-8 string if required. Pass back the character offset and error
6002  code if a results vector is available. */  code for an invalid string if a results vector is available. */
6003    
6004  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
6005  if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)  if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
6006    {    {
6007    int errorcode;    int erroroffset;
6008    int tb = _pcre_valid_utf8((USPTR)subject, length, &errorcode);    int errorcode = _pcre_valid_utf8((USPTR)subject, length, &erroroffset);
6009    if (tb >= 0)    if (errorcode != 0)
6010      {      {
6011      if (offsetcount >= 2)      if (offsetcount >= 2)
6012        {        {
6013        offsets[0] = tb;        offsets[0] = erroroffset;
6014        offsets[1] = errorcode;        offsets[1] = errorcode;
6015        }        }
6016      return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)?      return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)?
6017        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;
6018      }      }
6019    if (start_offset > 0 && start_offset < length)  
6020      {    /* Check that a start_offset points to the start of a UTF-8 character. */
6021      tb = ((USPTR)subject)[start_offset] & 0xc0;  
6022      if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET;    if (start_offset > 0 && start_offset < length &&
6023      }        (((USPTR)subject)[start_offset] & 0xc0) == 0x80)
6024        return PCRE_ERROR_BADUTF8_OFFSET;
6025    }    }
6026  #endif  #endif
6027    

Legend:
Removed from v.604  
changed lines
  Added in v.606

  ViewVC Help
Powered by ViewVC 1.1.5