summaryrefslogtreecommitdiff
path: root/ext/pcre/pcrelib/pcre_ord2utf8.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2013-03-03 19:06:22 +0100
committerAnatol Belski <ab@php.net>2013-03-03 19:06:22 +0100
commit357ab3cbada57374075ccf57c9ec25bbbbcb6948 (patch)
treef8c61f2068629b070bf82ada4ad2b2adc44516ba /ext/pcre/pcrelib/pcre_ord2utf8.c
parentc134f2a1a5ef56da72dbdc1096eddc91e4f5939e (diff)
downloadphp-git-357ab3cbada57374075ccf57c9ec25bbbbcb6948.tar.gz
merged PCRE 8.32
- defined HAVE_CONFIG_H to simplify the future merges - PCRE NEWS http://pcre.org/news.txt
Diffstat (limited to 'ext/pcre/pcrelib/pcre_ord2utf8.c')
-rw-r--r--ext/pcre/pcrelib/pcre_ord2utf8.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/pcre/pcrelib/pcre_ord2utf8.c b/ext/pcre/pcrelib/pcre_ord2utf8.c
index 917d943f0a..95f1beb963 100644
--- a/ext/pcre/pcrelib/pcre_ord2utf8.c
+++ b/ext/pcre/pcrelib/pcre_ord2utf8.c
@@ -41,17 +41,20 @@ POSSIBILITY OF SUCH DAMAGE.
/* This file contains a private PCRE function that converts an ordinal
character value into a UTF8 string. */
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
-#include "pcre_internal.h"
+#define COMPILE_PCRE8
+#include "pcre_internal.h"
/*************************************************
* Convert character value to UTF-8 *
*************************************************/
/* This function takes an integer value in the range 0 - 0x10ffff
-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.
Arguments:
cvalue the character value
@@ -60,6 +63,7 @@ Arguments:
Returns: number of characters placed in the buffer
*/
+unsigned
int
PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer)
{
@@ -67,11 +71,6 @@ PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer)
register int i, j;
-/* Checking invalid cvalue character, encoded as invalid UTF-16 character.
-Should never happen in practice. */
-if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000)
- cvalue = 0xfffe;
-
for (i = 0; i < PRIV(utf8_table1_size); i++)
if ((int)cvalue <= PRIV(utf8_table1)[i]) break;
buffer += i;