[vlc-devel] commit: iconv: don't pretend it is present and do crap when it's not ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jul 5 23:08:34 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jul  6 00:10:26 2008 +0300| [fdc31525a74c563d8375491d7bd77b0e0a936ef7]

iconv: don't pretend it is present and do crap when it's not

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdc31525a74c563d8375491d7bd77b0e0a936ef7
---

 src/extras/libc.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/extras/libc.c b/src/extras/libc.c
index 19cbdf2..f58f05f 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -417,7 +417,7 @@ vlc_iconv_t vlc_iconv_open( const char *tocode, const char *fromcode )
 #if defined(HAVE_ICONV)
     return iconv_open( tocode, fromcode );
 #else
-    return NULL;
+    return (vlc_iconv_t)(-1);
 #endif
 }
 
@@ -428,21 +428,7 @@ size_t vlc_iconv( vlc_iconv_t cd, const char **inbuf, size_t *inbytesleft,
     return iconv( cd, (ICONV_CONST char **)inbuf, inbytesleft,
                   outbuf, outbytesleft );
 #else
-    int i_bytes;
-
-    if (inbytesleft == NULL || outbytesleft == NULL)
-    {
-        return 0;
-    }
-
-    i_bytes = __MIN(*inbytesleft, *outbytesleft);
-    if( !inbuf || !outbuf || !i_bytes ) return (size_t)(-1);
-    memcpy( *outbuf, *inbuf, i_bytes );
-    inbuf += i_bytes;
-    outbuf += i_bytes;
-    inbytesleft -= i_bytes;
-    outbytesleft -= i_bytes;
-    return i_bytes;
+    abort ();
 #endif
 }
 
@@ -451,7 +437,7 @@ int vlc_iconv_close( vlc_iconv_t cd )
 #if defined(HAVE_ICONV)
     return iconv_close( cd );
 #else
-    return 0;
+    abort ();
 #endif
 }
 




More information about the vlc-devel mailing list