public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix for UTF-16 string encoding
@ 2013-07-13 21:47 Jared Parsons
  0 siblings, 0 replies; only message in thread
From: Jared Parsons @ 2013-07-13 21:47 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Hello everyone,

Attached is a patch to fix bug 41698 
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41698) and a second patch 
with extends test suite coverage for it.

No unexpected failures on the g++ test suite.




libcpp/Changelog:

2013-07-13  Jared Parsons  <jaredpar@gmail.com>

     * charset.c: Fixed UTF-16 encoding of U+FFFF.

gcc/testsuite/Changelog:

2013-07-13  Jared Parsons  <jaredpar@gmail.com>

     * g++.dg/ext/utf16-1.C: Extended test case.




- Jared


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 291 bytes --]

--- libcpp/charset.c.old	2013-07-13 02:05:15.008064713 -0400
+++ libcpp/charset.c	2013-07-13 02:05:43.688066468 -0400
@@ -353,7 +353,7 @@ one_utf8_to_utf16 (iconv_t bigend, const
       return EILSEQ;
     }
 
-  if (s < 0xFFFF)
+  if (s <= 0xFFFF)
     {
       if (*outbytesleftp < 2)
 	{

[-- Attachment #3: testsuite-patch --]
[-- Type: text/plain, Size: 600 bytes --]

--- gcc/testsuite/g++.dg/ext/utf16-1.C.old	2013-07-13 16:56:08.500387672 -0400
+++ gcc/testsuite/g++.dg/ext/utf16-1.C	2013-07-13 16:58:06.633726139 -0400
@@ -19,11 +19,15 @@ const static char16_t	c9 = L'a';
 const static char16_t	ca = L'\u2029';
 const static char16_t	cb = L'\u8010';
 
+const static char16_t   cc = u'\uFFFF';
+
 #define A	0x0061
 #define D	0x0024
 #define X	0x2029
 #define Y	0x8010
 
+#define Z   0xFFFF
+
 int main ()
 {
     if (sizeof (u'a') != sizeof (char16_t))
@@ -62,4 +66,7 @@ int main ()
 	abort ();
     if (cb != Y)
 	abort ();
+
+    if (cc != Z)
+        abort();
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-13 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-13 21:47 Fix for UTF-16 string encoding Jared Parsons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).