Revision: 1099
http://vcs.pcre.org/viewvc?view=rev&revision=1099
Author: chpe
Date: 2012-10-16 16:56:22 +0100 (Tue, 16 Oct 2012)
Log Message:
-----------
pcre32: utf: Remove unused replacement in PRIV(ord2utf)
The code replaced surrogates and characters > 10ffff with fffe, for no apparent
reason. Taking this code out still lets the test suite pass. We cannot assert
however that the character is a valid unicode character since we do need to handle
e.g. 10ffff here.
Modified Paths:
--------------
code/trunk/pcre16_ord2utf16.c
code/trunk/pcre32_ord2utf32.c
code/trunk/pcre_ord2utf8.c
Modified: code/trunk/pcre16_ord2utf16.c
===================================================================
--- code/trunk/pcre16_ord2utf16.c 2012-10-16 15:56:18 UTC (rev 1098)
+++ code/trunk/pcre16_ord2utf16.c 2012-10-16 15:56:22 UTC (rev 1099)
@@ -69,11 +69,6 @@
{
#ifdef SUPPORT_UTF
-/* Checking invalid cvalue character, encoded as invalid UTF-16 character.
-Should never happen in practice. */
-if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000)
- cvalue = 0xfffe;
-
if (cvalue <= 0xffff)
{
*buffer = (pcre_uchar)cvalue;
Modified: code/trunk/pcre32_ord2utf32.c
===================================================================
--- code/trunk/pcre32_ord2utf32.c 2012-10-16 15:56:18 UTC (rev 1098)
+++ code/trunk/pcre32_ord2utf32.c 2012-10-16 15:56:22 UTC (rev 1099)
@@ -69,12 +69,6 @@
{
#ifdef SUPPORT_UTF
-cvalue &= UTF32_MASK;
-
-/* Checking invalid cvalue character, encoded as invalid UTF-32 character */
-if ((cvalue & 0xfffff800u) == 0xd800u || cvalue >= 0x110000u)
- cvalue = 0xfffeu;
-
*buffer = (pcre_uchar)cvalue;
return 1;
Modified: code/trunk/pcre_ord2utf8.c
===================================================================
--- code/trunk/pcre_ord2utf8.c 2012-10-16 15:56:18 UTC (rev 1098)
+++ code/trunk/pcre_ord2utf8.c 2012-10-16 15:56:22 UTC (rev 1099)
@@ -45,15 +45,16 @@
#include "config.h"
#endif
+#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
@@ -69,11 +70,6 @@
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;