[mw-devel] MW3 r892 - branches/newipc/src

pwb at sucs.org pwb at sucs.org
Thu Jul 20 14:08:31 BST 2006


Author: pwb
Date: 2006-07-20 14:08:28 +0100 (Thu, 20 Jul 2006)
New Revision: 892

Modified:
   branches/newipc/src/iconv.c
Log:
- fix bug in wcs2any() that threw away all the string after an invalid/unconvertible sequence instead of just the invalid/unconvertible characters
- fix test main() to use new function signatures


Modified: branches/newipc/src/iconv.c
===================================================================
--- branches/newipc/src/iconv.c	2006-06-09 14:55:56 UTC (rev 891)
+++ branches/newipc/src/iconv.c	2006-07-20 13:08:28 UTC (rev 892)
@@ -116,8 +116,8 @@
 	if (nconv == (size_t)-1) {
 	    /* iconv barfed, but why? */
 	    if (errno == EILSEQ || errno == EINVAL) {
-		/* invalid input sequence, skip it */
-		(wchar_t *)wcs++;
+		/* invalid or unconvertible input sequence, skip it */
+		wcs+=sizeof(wchar_t);
 		wcsbytesleft-=sizeof(wchar_t);
 		errno = 0;
 		errors++;
@@ -281,13 +281,13 @@
     in = readline("Enter something to convert: ");
     set_local_charset(argv[1]);
 
-    mid = local2wcs(in);
+    mid = local2wcs(in, 1);
     printf("Converted to wchar_t as %ls\n", mid);
 
     free(readline("Change terminal locale and press enter to continue"));
 
     set_local_charset(argv[2]);
-    out = wcs2local(mid);
+    out = wcs2local(mid, 1);
     printf("Converted to target charset as %s\n", out);
 
     return 0;




More information about the mw-devel mailing list