[xiph-commits] r10644 - trunk/vorbis-tools/share

giles at svn.xiph.org giles at svn.xiph.org
Sun Dec 18 10:55:06 PST 2005


Author: giles
Date: 2005-12-18 10:55:05 -0800 (Sun, 18 Dec 2005)
New Revision: 10644

Modified:
   trunk/vorbis-tools/share/iconvert.c
Log:
Don't assert against positive return values of iconv(). It's normal 
behaviour and there's not much we can do to repair the damage. 
Supposedly fixes issue #242.


Modified: trunk/vorbis-tools/share/iconvert.c
===================================================================
--- trunk/vorbis-tools/share/iconvert.c	2005-12-18 18:33:41 UTC (rev 10643)
+++ trunk/vorbis-tools/share/iconvert.c	2005-12-18 18:55:05 UTC (rev 10644)
@@ -109,7 +109,7 @@
   obl = utflen;
   for (;;) {
     k = iconv(cd1, &ib, &ibl, &ob, &obl);
-    assert((!k && !ibl) ||
+    assert((k != (size_t)(-1) && !ibl) ||
 	   (k == (size_t)(-1) && errno == E2BIG && ibl && obl < 6) ||
 	   (k == (size_t)(-1) &&
 	    (errno == EILSEQ || errno == EINVAL) && ibl));
@@ -180,7 +180,7 @@
       ob = tbuf;
       obl = sizeof(tbuf);
       k = iconv(cd2, &tb, &tbl, &ob, &obl);
-      assert((!k && !tbl) ||
+      assert((k != (size_t)(-1) && !tbl) ||
 	     (k == (size_t)(-1) && errno == EILSEQ && tbl));
       for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--)
 	;
@@ -190,7 +190,7 @@
   ob = tbuf;
   obl = sizeof(tbuf);
   k = iconv(cd2, 0, 0, &ob, &obl);
-  assert(!k);
+  assert(k != (size_t)(-1));
   outlen += ob - tbuf;
 
   /* Convert from UTF-8 for real */
@@ -213,14 +213,14 @@
       size_t tbl = 1;
 
       k = iconv(cd2, &tb, &tbl, &ob, &obl);
-      assert((!k && !tbl) ||
+      assert((k != (size_t)(-1) && !tbl) ||
 	     (k == (size_t)(-1) && errno == EILSEQ && tbl));
       for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--)
 	;
     }
   }
   k = iconv(cd2, 0, 0, &ob, &obl);
-  assert(!k);
+  assert(k != (size_t)(-1));
   assert(!obl);
   *ob = '\0';
 



More information about the commits mailing list