/[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 58 by nigel, Sat Feb 24 21:39:50 2007 UTC revision 59 by nigel, Sat Feb 24 21:39:54 2007 UTC
# Line 73  for (i = 0; i < sizeof(utf8_table1)/size Line 73  for (i = 0; i < sizeof(utf8_table1)/size
73    if (cvalue <= utf8_table1[i]) break;    if (cvalue <= utf8_table1[i]) break;
74  if (i >= sizeof(utf8_table1)/sizeof(int)) return 0;  if (i >= sizeof(utf8_table1)/sizeof(int)) return 0;
75  if (cvalue < 0) return -1;  if (cvalue < 0) return -1;
76  *buffer++ = utf8_table2[i] | (cvalue & utf8_table3[i]);  
77  cvalue >>= 6 - i;  buffer += i;
78  for (j = 0; j < i; j++)  for (j = i; j > 0; j--)
79    {   {
80    *buffer++ = 0x80 | (cvalue & 0x3f);   *buffer-- = 0x80 | (cvalue & 0x3f);
81    cvalue >>= 6;   cvalue >>= 6;
82    }   }
83    *buffer = utf8_table2[i] | cvalue;
84  return i + 1;  return i + 1;
85  }  }
86    
# Line 117  if (i == 0 || i == 6) return 0; / Line 118  if (i == 0 || i == 6) return 0; /
118    
119  /* i now has a value in the range 1-5 */  /* i now has a value in the range 1-5 */
120    
121  d = c & utf8_table3[i];  s = 6*i;
122  s = 6 - i;  d = (c & utf8_table3[i]) << s;
123    
124  for (j = 0; j < i; j++)  for (j = 0; j < i; j++)
125    {    {
126    c = *buffer++;    c = *buffer++;
127    if ((c & 0xc0) != 0x80) return -(j+1);    if ((c & 0xc0) != 0x80) return -(j+1);
128      s -= 6;
129    d |= (c & 0x3f) << s;    d |= (c & 0x3f) << s;
   s += 6;  
130    }    }
131    
132  /* Check that encoding was the correct unique one */  /* Check that encoding was the correct unique one */
# Line 460  while (argc > 1 && argv[op][0] == '-') Line 461  while (argc > 1 && argv[op][0] == '-')
461    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;    else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
462    else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;    else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
463    else if (strcmp(argv[op], "-o") == 0 && argc > 2 &&    else if (strcmp(argv[op], "-o") == 0 && argc > 2 &&
464        ((size_offsets = strtoul(argv[op+1], &endptr, 10)), *endptr == 0))        ((size_offsets = (int)strtoul(argv[op+1], &endptr, 10)), *endptr == 0))
465      {      {
466      op++;      op++;
467      argc--;      argc--;

Legend:
Removed from v.58  
changed lines
  Added in v.59

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12