This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] fix iconv -c problem



Hello,

In glibc 2.2.1, telling iconv to omit invalid characters from output by
using "-c" option has no effect. With or without it, iconv always stop
and complain when it sees an invalid character. Here is a patch to fix
this.

Yong Li
<rigel863@yahoo.com>


	* iconv/gconv_open.c (__gconv_open): Fix the variable used to
          set result->__data[cnt].__flags.
	* iconv/iconv_prog.c (main): Correct error handling method name.


diff -Naur glibc-2.2.1.orig/iconv/gconv_open.c glibc-2.2.1/iconv/gconv_open.c
--- glibc-2.2.1.orig/iconv/gconv_open.c	Mon Sep 11 05:42:57 2000
+++ glibc-2.2.1/iconv/gconv_open.c	Tue Jan 23 01:47:21 2001
@@ -35,7 +35,6 @@
   __gconv_t result = NULL;
   size_t cnt = 0;
   int res;
-  int conv_flags = 0;
   const char *errhand;
   const char *ignore;
   struct trans_struct *trans = NULL;
@@ -247,7 +246,7 @@
 		 output buffer.  */
 	      if (cnt < nsteps - 1)
 		{
-		  result->__data[cnt].__flags = conv_flags;
+		  result->__data[cnt].__flags = flags;

 		  /* Allocate the buffer.  */
 		  size = (GCONV_NCHAR_GOAL * steps[cnt].__max_needed_to);
@@ -265,7 +264,7 @@
 	      else
 		{
 		  /* Handle the last entry.  */
-		  result->__data[cnt].__flags = conv_flags | __GCONV_IS_LAST;
+		  result->__data[cnt].__flags = flags | __GCONV_IS_LAST;

 		  break;
 		}
diff -Naur glibc-2.2.1.orig/iconv/iconv_prog.c glibc-2.2.1/iconv/iconv_prog.c
--- glibc-2.2.1.orig/iconv/iconv_prog.c	Sat Jan 13 15:09:08 2001
+++ glibc-2.2.1/iconv/iconv_prog.c	Tue Jan 23 01:49:39 2001
@@ -168,7 +168,7 @@
       cp = mempcpy (newp, to_code, errhand - to_code);
       while (nslash-- > 0)
 	*cp++ = '/';
-      memcpy (cp, "NEEDED", sizeof ("NEEDED"));
+      memcpy (cp, "IGNORE", sizeof ("IGNORE"));

       to_code = newp;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]