[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r14005 - in /fsf/trunk/libc: ChangeLog NEWS iconvdata/Makefile iconvdata/bug-iconv9.c iconvdata/iso-2022-jp.c



Author: eglibc
Date: Fri May 27 09:34:16 2011
New Revision: 14005

Log:
Import glibc-mainline for 2011-05-27

Added:
    fsf/trunk/libc/iconvdata/bug-iconv9.c   (with props)
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/iconvdata/Makefile
    fsf/trunk/libc/iconvdata/iso-2022-jp.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri May 27 09:34:16 2011
@@ -1,3 +1,14 @@
+2011-05-27  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12814]
+	* iconvdata/Makefile (tests): Add bug-iconv9.
+	* iconvdata/bug-iconv9.c: New file.
+
+2011-05-27  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	[BZ #12814]
+	* iconvdata/iso-2022-jp.c (BODY): Fix invalid variable shadowing.
+
 2011-05-25  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/x86_64/sys/user.h

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri May 27 09:34:16 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-5-23
+GNU C Library NEWS -- history of user-visible changes.  2011-5-27
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -17,7 +17,7 @@
   12545, 12551, 12582, 12583, 12587, 12597, 12601, 12611, 12625, 12626,
   12631, 12650, 12653, 12655, 12660, 12671, 12681, 12685, 12711, 12713,
   12714, 12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775, 12777,
-  12782, 12788, 12792, 12795
+  12782, 12788, 12792, 12795, 12814
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.

Modified: fsf/trunk/libc/iconvdata/Makefile
==============================================================================
--- fsf/trunk/libc/iconvdata/Makefile (original)
+++ fsf/trunk/libc/iconvdata/Makefile Fri May 27 09:34:16 2011
@@ -68,7 +68,7 @@
 
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8
+	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
 ifeq ($(have-thread-library),yes)
 tests += bug-iconv3
 endif

Added: fsf/trunk/libc/iconvdata/bug-iconv9.c
==============================================================================
--- fsf/trunk/libc/iconvdata/bug-iconv9.c (added)
+++ fsf/trunk/libc/iconvdata/bug-iconv9.c Fri May 27 09:34:16 2011
@@ -1,0 +1,68 @@
+// BZ 12814
+#include <errno.h>
+#include <iconv.h>
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  iconv_t h = iconv_open ("ISO-2022-JP-2", "UTF-8");
+  if (h == (iconv_t) -1)
+    {
+      printf ("cannot load iconv module: %m\n");
+      return 1;
+    }
+
+  // Euro sign
+  static const char inbuf[] = "\xe2\x82\xac";
+  char *in = (char *) inbuf;
+  size_t inlen = sizeof (inbuf) - 1;
+
+  char outbuf[100];
+  char *out = outbuf;
+  size_t outlen = sizeof (outbuf);
+
+  int res = 0;
+  size_t n = iconv (h, &in, &inlen, &out, &outlen);
+  if (n == (size_t) -1)
+    {
+      printf ("iconv failed with %d: %m\n", errno);
+      return 1;
+    }
+  if (n != 0)
+    {
+      printf ("iconv returned %zu, expected zero\n", n);
+      res = 1;
+    }
+  if (in != inbuf + sizeof (inbuf) - 1)
+    {
+      printf ("in advanced by %jd, expected %zu\n",
+	      in - inbuf, sizeof (inbuf) - 1);
+      res = 1;
+    }
+  static const char expected[] = "\x1b\x2e\x46\x1b\x4e\x24";
+  if (out - outbuf != sizeof (expected) - 1
+      || memcmp (outbuf, expected, sizeof (expected) - 1) != 0)
+    {
+      fputs ("generated sequence is: \"", stdout);
+      for (size_t i = 0; i < out - outbuf; ++i)
+	printf ("\\x%02hhx", outbuf[i]);
+      fputs ("\", expected \"", stdout);
+      for (size_t i = 0; i < sizeof (expected) - 1; ++i)
+	printf ("\\x%02hhx", expected[i]);
+      puts ("\"");
+      res = 1;
+    }
+
+  if (iconv_close (h) != 0)
+    {
+      puts ("failed closing iconv module");
+      res = 1;
+    }
+
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Propchange: fsf/trunk/libc/iconvdata/bug-iconv9.c
------------------------------------------------------------------------------
    svn:mime-type = text/cpp

Modified: fsf/trunk/libc/iconvdata/iso-2022-jp.c
==============================================================================
--- fsf/trunk/libc/iconvdata/iso-2022-jp.c (original)
+++ fsf/trunk/libc/iconvdata/iso-2022-jp.c Fri May 27 09:34:16 2011
@@ -1,5 +1,5 @@
 /* Conversion module for ISO-2022-JP and ISO-2022-JP-2.
-   Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000-2002, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -664,7 +664,7 @@
 									      \
 			*outptr++ = ESC;				      \
 			*outptr++ = 'N';				      \
-			*outptr++ = res;				      \
+			*outptr++ = res & 0x7f;				      \
 			written = 3;					      \
 		      }							      \
 		  }							      \
@@ -706,7 +706,7 @@
 									      \
 	    /* At the beginning of a line, G2 designation is cleared.  */     \
 	    if (var == iso2022jp2 && ch == 0x0a)			      \
-	      set2 = UNSPECIFIED_set; 					      \
+	      set2 = UNSPECIFIED_set;					      \
 	  }								      \
 	else								      \
 	  {								      \
@@ -764,9 +764,9 @@
 			++rp;						      \
 		      if (ch >= rp->start)				      \
 			{						      \
-			  unsigned char res =				      \
+			  unsigned char ch2 =				      \
 			    iso88597_from_ucs4[ch - 0xa0 + rp->idx];	      \
-			  if (res != '\0')				      \
+			  if (ch2 != '\0')				      \
 			    {						      \
 			      if (set2 != ISO88597_set)			      \
 				{					      \
@@ -789,7 +789,7 @@
 				}					      \
 			      *outptr++ = ESC;				      \
 			      *outptr++ = 'N';				      \
-			      *outptr++ = res;				      \
+			      *outptr++ = ch2 - 0x80;			      \
 			      res = __GCONV_OK;				      \
 			      break;					      \
 			    }						      \