From: <ny...@us...> - 2006-07-26 19:45:40
|
Revision: 131 Author: nyaochi Date: 2006-07-26 08:11:46 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=131&view=rev Log Message: ----------- Fixed a bug in string conversion. A string conversion always fails with a source string longer than 512 bytes (MBS -> UCS-2) due to the incorrect handling of returned values from iconv. This bug was the root of the JSPL problem I've been investigating. Modified Paths: -------------- trunk/lib/ucs2/ucs2char_iconv.c Modified: trunk/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/lib/ucs2/ucs2char_iconv.c 2006-07-10 19:26:30 UTC (rev 130) +++ trunk/lib/ucs2/ucs2char_iconv.c 2006-07-26 15:11:46 UTC (rev 131) @@ -29,6 +29,7 @@ #include <os.h> #include <sys/types.h> #include <sys/stat.h> +#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> @@ -174,7 +175,7 @@ char *p = buffer; size_t outbytesleft = 1024; int iconvret = iconv(cd, (const char **)inbuf, &inbytesleft, &p, &outbytesleft); - if (iconvret == -1) { + if (iconvret == -1 && errno != E2BIG) { return 0; } ret += (1024 - outbytesleft); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |