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

Diff of /code/trunk/pcre_valid_utf8.c

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

revision 211 by ph10, Thu Aug 9 09:52:43 2007 UTC revision 409 by ph10, Sat Mar 28 17:10:56 2009 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2007 University of Cambridge             Copyright (c) 1997-2009 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 43  strings. */ Line 43  strings. */
43    
44    
45  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
46  #include <config.h>  #include "config.h"
47  #endif  #endif
48    
49  #include "pcre_internal.h"  #include "pcre_internal.h"
# Line 62  an invalid string are then undefined. Line 62  an invalid string are then undefined.
62  Originally, this function checked according to RFC 2279, allowing for values in  Originally, this function checked according to RFC 2279, allowing for values in
63  the range 0 to 0x7fffffff, up to 6 bytes long, but ensuring that they were in  the range 0 to 0x7fffffff, up to 6 bytes long, but ensuring that they were in
64  the canonical format. Once somebody had pointed out RFC 3629 to me (it  the canonical format. Once somebody had pointed out RFC 3629 to me (it
65  obsoletes 2279), additional restrictions were applies. The values are now  obsoletes 2279), additional restrictions were applied. The values are now
66  limited to be between 0 and 0x0010ffff, no more than 4 bytes long, and the  limited to be between 0 and 0x0010ffff, no more than 4 bytes long, and the
67  subrange 0xd000 to 0xdfff is excluded.  subrange 0xd000 to 0xdfff is excluded.
68    
# Line 75  Returns:       < 0    if the string is a Line 75  Returns:       < 0    if the string is a
75  */  */
76    
77  int  int
78  _pcre_valid_utf8(const uschar *string, int length)  _pcre_valid_utf8(USPTR string, int length)
79  {  {
80  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
81  register const uschar *p;  register USPTR p;
82    
83  if (length < 0)  if (length < 0)
84    {    {
# Line 154  for (p = string; length-- > 0; p++) Line 154  for (p = string; length-- > 0; p++)
154      if ((*(++p) & 0xc0) != 0x80) return p - string;      if ((*(++p) & 0xc0) != 0x80) return p - string;
155      }      }
156    }    }
157    #else
158    (void)(string);  /* Keep picky compilers happy */
159    (void)(length);
160  #endif  #endif
161    
162  return -1;  return -1;

Legend:
Removed from v.211  
changed lines
  Added in v.409

  ViewVC Help
Powered by ViewVC 1.1.5