[vlc-commits] commit: Replace vlc_fix_readdir() with FromCharset() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Tue Oct 26 19:18:23 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Oct 26 20:17:55 2010 +0300| [4ff67459ae3e0fc2f443ca1fed77e45faa9003f9] | committer: Rémi Denis-Courmont 

Replace vlc_fix_readdir() with FromCharset()

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

 src/libvlc.h          |    5 -----
 src/text/charset.c    |   29 -----------------------------
 src/text/filesystem.c |    7 +++++--
 3 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/src/libvlc.h b/src/libvlc.h
index 02bdfaa..793e67a 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -91,11 +91,6 @@ void msg_StackAdd ( const char*, ... );
 const char* msg_StackMsg ( void );
 
 /*
- * Unicode stuff
- */
-char *vlc_fix_readdir (const char *);
-
-/*
  * LibVLC exit event handling
  */
 typedef struct vlc_exit
diff --git a/src/text/charset.c b/src/text/charset.c
index 07b814e..1722210 100644
--- a/src/text/charset.c
+++ b/src/text/charset.c
@@ -43,35 +43,6 @@
 #include "libvlc.h"
 #include <vlc_charset.h>
 
-char *vlc_fix_readdir( const char *psz_string )
-{
-#ifdef __APPLE__
-    vlc_iconv_t hd = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
-
-    if (hd != (vlc_iconv_t)(-1))
-    {
-        const char *psz_in = psz_string;
-        size_t i_in = strlen(psz_in);
-        size_t i_out = i_in * 2;
-        char *psz_utf8 = malloc(i_out + 1);
-        char *psz_out = psz_utf8;
-
-        size_t i_ret = vlc_iconv (hd, &psz_in, &i_in, &psz_out, &i_out);
-        vlc_iconv_close (hd);
-        if( i_ret == (size_t)(-1) || i_in )
-        {
-            free( psz_utf8 );
-            return strdup( psz_string );
-        }
-
-        *psz_out = '\0';
-        return psz_utf8;
-    }
-#endif
-    return strdup( psz_string );
-}
-
-
 /**
  * us_strtod() has the same prototype as ANSI C strtod() but it uses the
  * POSIX/C decimal format, regardless of the current numeric locale.
diff --git a/src/text/filesystem.c b/src/text/filesystem.c
index f83a4fc..ef4cfdc 100644
--- a/src/text/filesystem.c
+++ b/src/text/filesystem.c
@@ -347,10 +347,13 @@ char *vlc_readdir( DIR *dir )
     if (val != 0)
         errno = val;
     else if (ent != NULL)
-        path = vlc_fix_readdir (ent->d_name);
+#ifndef __APPLE__
+        path = strdup (ent->d_name);
+#else
+        path = FromCharset ("UTF-8-MAC", ent->d_name, strlen (ent->d_name));
+#endif
     free (buf);
     return path;
-#endif
 }
 
 static int dummy_select( const char *str )



More information about the vlc-commits mailing list