/[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 1085 by chpe, Tue Oct 16 15:55:32 2012 UTC revision 1086 by chpe, Tue Oct 16 15:55:35 2012 UTC
# Line 1357  Returns:      >  0 => the number of byte Line 1357  Returns:      >  0 => the number of byte
1357  */  */
1358    
1359  static int  static int
1360  utf82ord(pcre_uint8 *utf8bytes, int *vptr)  utf82ord(pcre_uint8 *utf8bytes, pcre_uint32 *vptr)
1361  {  {
1362  int c = *utf8bytes++;  pcre_uint32 c = *utf8bytes++;
1363  int d = c;  pcre_uint32 d = c;
1364  int i, j, s;  int i, j, s;
1365    
1366  for (i = -1; i < 6; i++)               /* i is number of additional bytes */  for (i = -1; i < 6; i++)               /* i is number of additional bytes */
# Line 1416  Returns:     number of characters placed Line 1416  Returns:     number of characters placed
1416  */  */
1417    
1418  static int  static int
1419  ord2utf8(int cvalue, pcre_uint8 *utf8bytes)  ord2utf8(pcre_uint32 cvalue, pcre_uint8 *utf8bytes)
1420  {  {
1421  register int i, j;  register int i, j;
1422    if (cvalue > 0x7fffffffu)
1423      return -1;
1424  for (i = 0; i < utf8_table1_size; i++)  for (i = 0; i < utf8_table1_size; i++)
1425    if (cvalue <= utf8_table1[i]) break;    if (cvalue <= utf8_table1[i]) break;
1426  utf8bytes += i;  utf8bytes += i;
# Line 1489  if (!utf && !data) Line 1491  if (!utf && !data)
1491    
1492  else  else
1493    {    {
1494    int c = 0;    pcre_uint32 c = 0;
1495    while (len > 0)    while (len > 0)
1496      {      {
1497      int chlen = utf82ord(p, &c);      int chlen = utf82ord(p, &c);
# Line 1568  if (!utf && !data) Line 1570  if (!utf && !data)
1570    
1571  else  else
1572    {    {
1573    int c = 0;    pcre_uint32 c = 0;
1574    while (len > 0)    while (len > 0)
1575      {      {
1576      int chlen = utf82ord(p, &c);      int chlen = utf82ord(p, &c);
# Line 1768  If handed a NULL file, just counts chars Line 1770  If handed a NULL file, just counts chars
1770    
1771  static int pchars(pcre_uint8 *p, int length, FILE *f)  static int pchars(pcre_uint8 *p, int length, FILE *f)
1772  {  {
1773  int c = 0;  pcre_uint32 c = 0;
1774  int yield = 0;  int yield = 0;
1775    
1776  if (length < 0)  if (length < 0)
# Line 4139  while (!done) Line 4141  while (!done)
4141        /* In UTF mode, input can be UTF-8, so just copy all non-backslash bytes.        /* In UTF mode, input can be UTF-8, so just copy all non-backslash bytes.
4142        In non-UTF mode, allow the value of the byte to fall through to later,        In non-UTF mode, allow the value of the byte to fall through to later,
4143        where values greater than 127 are turned into UTF-8 when running in        where values greater than 127 are turned into UTF-8 when running in
4144        16-bit mode. */        16-bit or 32-bit mode. */
4145    
4146        if (c != '\\')        if (c != '\\')
4147          {          {
# Line 4420  while (!done) Line 4422  while (!done)
4422    
4423        /* We now have a character value in c that may be greater than 255. In        /* We now have a character value in c that may be greater than 255. In
4424        16-bit or 32-bit mode, we always convert characters to UTF-8 so that        16-bit or 32-bit mode, we always convert characters to UTF-8 so that
4425        values greater than 255 can be passed to non-UTF 16-bit strings. In 8-bit        values greater than 255 can be passed to non-UTF 16- or 32-bit strings.
4426        mode we convert to UTF-8 if we are in UTF mode. Values greater than 127        In 8-bit       mode we convert to UTF-8 if we are in UTF mode. Values greater
4427        in UTF mode must have come from \x{...} or octal constructs because values        than 127       in UTF mode must have come from \x{...} or octal constructs
4428        from \x.. get this far only in non-UTF mode. */        because values from \x.. get this far only in non-UTF mode. */
4429    
4430  #if !defined NOUTF || defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32  #if !defined NOUTF || defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32
4431        if (pcre_mode != PCRE8_MODE || use_utf)        if (pcre_mode != PCRE8_MODE || use_utf)

Legend:
Removed from v.1085  
changed lines
  Added in v.1086

  ViewVC Help
Powered by ViewVC 1.1.5