[vlc-commits] commit: DMO: use FromWide(), fix charset ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Tue Aug 3 17:30:34 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug  3 18:28:54 2010 +0300| [1e7cd2c85a338ef153002325ae40cc90517f51e1] | committer: Rémi Denis-Courmont 

DMO: use FromWide(), fix charset

On Windows, wcstombs() converts UTF-16 to ANSI, not to UTF-8.

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

 modules/codec/dmo/dmo.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 7d82faf..33c3077 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -38,6 +38,7 @@
 #    define LOADER
 #else
 #   include <objbase.h>
+#   include <vlc_charset.h>
 #endif
 
 #ifdef LOADER
@@ -728,8 +729,7 @@ static int LoadDMO( vlc_object_t *p_this, HINSTANCE *p_hmsdmo_dll,
     while( ( S_OK == p_enum_dmo->vt->Next( p_enum_dmo, 1, &clsid_dmo,
                      &psz_dmo_name, &i_dummy /* NULL doesn't work */ ) ) )
     {
-        char psz_temp[MAX_PATH];
-        wcstombs( psz_temp, psz_dmo_name, MAX_PATH );
+        char *psz_temp = FromWide( psz_dmo_name );
         msg_Dbg( p_this, "found DMO: %s", psz_temp );
         CoTaskMemFree( psz_dmo_name );
 
@@ -738,9 +738,14 @@ static int LoadDMO( vlc_object_t *p_this, HINSTANCE *p_hmsdmo_dll,
                               &IID_IMediaObject, (void **)pp_dmo ) )
         {
             msg_Warn( p_this, "can't create DMO: %s", psz_temp );
+            free( psz_temp );
             *pp_dmo = 0;
         }
-        else break;
+        else
+        {
+            free( psz_temp );
+            break;
+        }
     }
 
     p_enum_dmo->vt->Release( (IUnknown *)p_enum_dmo );



More information about the vlc-commits mailing list