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 |
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; |