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

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

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

revision 786 by zherczeg, Tue Dec 6 11:33:41 2011 UTC revision 794 by zherczeg, Thu Dec 8 07:36:41 2011 UTC
# Line 4202  for (;; ptr++) Line 4202  for (;; ptr++)
4202    
4203  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
4204          if (utf && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))          if (utf && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))
4205  #endif  #elif !(defined COMPILE_PCRE8)
 #ifndef COMPILE_PCRE8  
4206          if (d > 255)          if (d > 255)
4207  #endif  #endif
4208  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || !(defined COMPILE_PCRE8)
4209            {            {
4210            xclass = TRUE;            xclass = TRUE;
4211    
# Line 4608  for (;; ptr++) Line 4607  for (;; ptr++)
4607        it's a length rather than a small character. */        it's a length rather than a small character. */
4608    
4609  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
4610  #ifdef COMPILE_PCRE8        if (utf && NOT_FIRSTCHAR(code[-1]))
       if (utf && (code[-1] & 0x80) != 0)  
 #endif /* COMPILE_PCRE8 */  
 #ifdef COMPILE_PCRE16  
       if (utf && (code[-1] & 0xfc00) == 0xdc00)  
 #endif /* COMPILE_PCRE8 */  
4611          {          {
4612          pcre_uchar *lastchar = code - 1;          pcre_uchar *lastchar = code - 1;
4613          BACKCHAR(lastchar);          BACKCHAR(lastchar);
# Line 4626  for (;; ptr++) Line 4620  for (;; ptr++)
4620    
4621        /* Handle the case of a single charater - either with no UTF support, or        /* Handle the case of a single charater - either with no UTF support, or
4622        with UTF disabled, or for a single character UTF character. */        with UTF disabled, or for a single character UTF character. */
   
4623          {          {
4624          c = code[-1];          c = code[-1];
4625          if (repeat_min > 1) reqchar = c | req_caseopt | cd->req_varyopt;          if (repeat_min > 1) reqchar = c | req_caseopt | cd->req_varyopt;
# Line 5817  for (;; ptr++) Line 5810  for (;; ptr++)
5810                *errorcodeptr = ERR49;                *errorcodeptr = ERR49;
5811                goto FAILED;                goto FAILED;
5812                }                }
5813              if (namelen + 3 > cd->name_entry_size)              if (namelen + IMM2_SIZE + 1 > cd->name_entry_size)
5814                {                {
5815                cd->name_entry_size = namelen + 3;                cd->name_entry_size = namelen + IMM2_SIZE + 1;
5816                if (namelen > MAX_NAME_SIZE)                if (namelen > MAX_NAME_SIZE)
5817                  {                  {
5818                  *errorcodeptr = ERR48;                  *errorcodeptr = ERR48;
# Line 5848  for (;; ptr++) Line 5841  for (;; ptr++)
5841    
5842              for (i = 0; i < cd->names_found; i++)              for (i = 0; i < cd->names_found; i++)
5843                {                {
5844                int crc = memcmp(name, slot+2, IN_UCHARS(namelen));                int crc = memcmp(name, slot+IMM2_SIZE, IN_UCHARS(namelen));
5845                if (crc == 0)                if (crc == 0)
5846                  {                  {
5847                  if (slot[2+namelen] == 0)                  if (slot[IMM2_SIZE+namelen] == 0)
5848                    {                    {
5849                    if (GET2(slot, 0) != cd->bracount + 1 &&                    if (GET2(slot, 0) != cd->bracount + 1 &&
5850                        (options & PCRE_DUPNAMES) == 0)                        (options & PCRE_DUPNAMES) == 0)
# Line 5903  for (;; ptr++) Line 5896  for (;; ptr++)
5896                }                }
5897    
5898              PUT2(slot, 0, cd->bracount + 1);              PUT2(slot, 0, cd->bracount + 1);
5899              memcpy(slot + 2, name, IN_UCHARS(namelen));              memcpy(slot + IMM2_SIZE, name, IN_UCHARS(namelen));
5900              slot[2 + namelen] = 0;              slot[IMM2_SIZE + namelen] = 0;
5901              }              }
5902            }            }
5903    
# Line 5988  for (;; ptr++) Line 5981  for (;; ptr++)
5981            for (i = 0; i < cd->names_found; i++)            for (i = 0; i < cd->names_found; i++)
5982              {              {
5983              if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0 &&              if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0 &&
5984                  slot[2+namelen] == 0)                  slot[IMM2_SIZE+namelen] == 0)
5985                break;                break;
5986              slot += cd->name_entry_size;              slot += cd->name_entry_size;
5987              }              }
# Line 7439  while (ptr[skipatstart] == CHAR_LEFT_PAR Line 7432  while (ptr[skipatstart] == CHAR_LEFT_PAR
7432    int newnl = 0;    int newnl = 0;
7433    int newbsr = 0;    int newbsr = 0;
7434    
7435    #ifdef COMPILE_PCRE8
7436    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 5) == 0)    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 5) == 0)
7437      { skipatstart += 7; options |= PCRE_UTF8; continue; }      { skipatstart += 7; options |= PCRE_UTF8; continue; }
7438    #endif
7439    #ifdef COMPILE_PCRE16
7440      if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 6) == 0)
7441        { skipatstart += 8; options |= PCRE_UTF16; continue; }
7442    #endif
7443    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)
7444      { skipatstart += 6; options |= PCRE_UCP; continue; }      { skipatstart += 6; options |= PCRE_UCP; continue; }
7445    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)
# Line 7614  externally provided function. Integer ov Line 7613  externally provided function. Integer ov
7613  because nowadays we limit the maximum value of cd->names_found and  because nowadays we limit the maximum value of cd->names_found and
7614  cd->name_entry_size. */  cd->name_entry_size. */
7615    
7616  size = sizeof(real_pcre) + (length + cd->names_found * (cd->name_entry_size + 3)) * sizeof(pcre_uchar);  size = sizeof(real_pcre) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
7617  re = (real_pcre *)(pcre_malloc)(size);  re = (real_pcre *)(pcre_malloc)(size);
7618    
7619  if (re == NULL)  if (re == NULL)

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

  ViewVC Help
Powered by ViewVC 1.1.5