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

Diff of /code/trunk/pcre_ord2utf8.c

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

revision 904 by ph10, Mon Jan 23 17:30:49 2012 UTC revision 1099 by chpe, Tue Oct 16 15:56:22 2012 UTC
# Line 45  character value into a UTF8 string. */ Line 45  character value into a UTF8 string. */
45  #include "config.h"  #include "config.h"
46  #endif  #endif
47    
48  #include "pcre_internal.h"  #define COMPILE_PCRE8
49    
50    #include "pcre_internal.h"
51    
52  /*************************************************  /*************************************************
53  *       Convert character value to UTF-8         *  *       Convert character value to UTF-8         *
54  *************************************************/  *************************************************/
55    
56  /* This function takes an integer value in the range 0 - 0x10ffff  /* This function takes an integer value in the range 0 - 0x10ffff
57  and encodes it as a UTF-8 character in 1 to 6 pcre_uchars.  and encodes it as a UTF-8 character in 1 to 4 pcre_uchars.
58    
59  Arguments:  Arguments:
60    cvalue     the character value    cvalue     the character value
# Line 69  PRIV(ord2utf)(pcre_uint32 cvalue, pcre_u Line 70  PRIV(ord2utf)(pcre_uint32 cvalue, pcre_u
70    
71  register int i, j;  register int i, j;
72    
 /* Checking invalid cvalue character, encoded as invalid UTF-16 character.  
 Should never happen in practice. */  
 if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000)  
   cvalue = 0xfffe;  
   
73  for (i = 0; i < PRIV(utf8_table1_size); i++)  for (i = 0; i < PRIV(utf8_table1_size); i++)
74    if ((int)cvalue <= PRIV(utf8_table1)[i]) break;    if ((int)cvalue <= PRIV(utf8_table1)[i]) break;
75  buffer += i;  buffer += i;

Legend:
Removed from v.904  
changed lines
  Added in v.1099

  ViewVC Help
Powered by ViewVC 1.1.5