Diff for /embedaddon/pcre/pcre16_valid_utf16.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:50:25 version 1.1.1.2, 2013/07/22 08:25:55
Line 6 Line 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.
   
                        Written by Philip Hazel                         Written by Philip Hazel
           Copyright (c) 1997-2012 University of Cambridge           Copyright (c) 1997-2013 University of Cambridge
   
 -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 69  PCRE_UTF16_ERR0  No error Line 69  PCRE_UTF16_ERR0  No error
 PCRE_UTF16_ERR1  Missing low surrogate at the end of the string  PCRE_UTF16_ERR1  Missing low surrogate at the end of the string
 PCRE_UTF16_ERR2  Invalid low surrogate  PCRE_UTF16_ERR2  Invalid low surrogate
 PCRE_UTF16_ERR3  Isolated low surrogate  PCRE_UTF16_ERR3  Isolated low surrogate
PCRE_UTF16_ERR4  Not allowed characterPCRE_UTF16_ERR4  Unused (was non-character)
   
 Arguments:  Arguments:
   string       points to the string    string       points to the string
Line 85  PRIV(valid_utf)(PCRE_PUCHAR string, int length, int *e Line 85  PRIV(valid_utf)(PCRE_PUCHAR string, int length, int *e
 {  {
 #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
 register PCRE_PUCHAR p;  register PCRE_PUCHAR p;
register pcre_uchar c;register pcre_uint32 c;
   
 if (length < 0)  if (length < 0)
   {    {
Line 100  for (p = string; length-- > 0; p++) Line 100  for (p = string; length-- > 0; p++)
   if ((c & 0xf800) != 0xd800)    if ((c & 0xf800) != 0xd800)
     {      {
     /* Normal UTF-16 code point. Neither high nor low surrogate. */      /* Normal UTF-16 code point. Neither high nor low surrogate. */
   
     /* This is probably a BOM from a different byte-order.  
     Regardless, the string is rejected. */  
     if (c == 0xfffe)  
       {  
       *erroroffset = p - string;  
       return PCRE_UTF16_ERR4;  
       }  
     }      }
   else if ((c & 0x0400) == 0)    else if ((c & 0x0400) == 0)
     {      {
    /* High surrogate. */    /* High surrogate. Must be a followed by a low surrogate. */
 
    /* Must be a followed by a low surrogate. */ 
     if (length == 0)      if (length == 0)
       {        {
       *erroroffset = p - string;        *erroroffset = p - string;
Line 138  for (p = string; length-- > 0; p++) Line 128  for (p = string; length-- > 0; p++)
 #else  /* SUPPORT_UTF */  #else  /* SUPPORT_UTF */
 (void)(string);  /* Keep picky compilers happy */  (void)(string);  /* Keep picky compilers happy */
 (void)(length);  (void)(length);
   (void)(erroroffset);
 #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
   
 return PCRE_UTF16_ERR0;   /* This indicates success */  return PCRE_UTF16_ERR0;   /* This indicates success */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>