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

Diff of /code/trunk/pcre32_valid_utf32.c

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

revision 1055 by chpe, Tue Oct 16 15:53:30 2012 UTC revision 1088 by chpe, Tue Oct 16 15:55:41 2012 UTC
# Line 51  strings. */ Line 51  strings. */
51    
52  #include "pcre_internal.h"  #include "pcre_internal.h"
53    
 #define MASK (0x1fffffu)  
   
54  /*************************************************  /*************************************************
55  *         Validate a UTF-32 string                *  *         Validate a UTF-32 string                *
56  *************************************************/  *************************************************/
# Line 63  that subsequent code can assume it is de Line 61  that subsequent code can assume it is de
61  can be turned off for maximum performance, but the consequences of supplying an  can be turned off for maximum performance, but the consequences of supplying an
62  invalid string are then undefined.  invalid string are then undefined.
63    
64  From release 8.21 more information about the details of the error are passed  More information about the details of the error are passed
65  back in the returned value:  back in the returned value:
66    
67  PCRE_UTF32_ERR0  No error  PCRE_UTF32_ERR0  No error
68  PCRE_UTF32_ERR1  Surrogate character  PCRE_UTF32_ERR1  Surrogate character
69  PCRE_UTF32_ERR2  Not allowed character  PCRE_UTF32_ERR2  Disallowed character 0xfffe
70    PCRE_UTF32_ERR3  Character > 0x10ffff
71    
72  Arguments:  Arguments:
73    string       points to the string    string       points to the string
# Line 94  if (length < 0) Line 93  if (length < 0)
93    
94  for (p = string; length-- > 0; p++)  for (p = string; length-- > 0; p++)
95    {    {
96    c = *p & MASK;    c = *p & UTF32_MASK;
97    
98    if ((c & 0xfffff800u) != 0xd800u)    if ((c & 0xfffff800u) != 0xd800u)
99      {      {
# Line 106  for (p = string; length-- > 0; p++) Line 105  for (p = string; length-- > 0; p++)
105        *erroroffset = p - string;        *erroroffset = p - string;
106        return PCRE_UTF32_ERR2;        return PCRE_UTF32_ERR2;
107        }        }
108        else if (c > 0x10ffffu)
109          {
110          *erroroffset = p - string;
111          return PCRE_UTF32_ERR3;
112          }
113      }      }
114    else    else
115      {      {

Legend:
Removed from v.1055  
changed lines
  Added in v.1088

  ViewVC Help
Powered by ViewVC 1.1.5