[vlc-commits] dmo: fix logging of WCHAR as a char

Steve Lhomme git at videolan.org
Wed Apr 3 09:56:06 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr  3 09:42:07 2019 +0200| [67108c24830956f38cb101180ad87841d91a5df9] | committer: Steve Lhomme

dmo: fix logging of WCHAR as a char

We read the value as a WCHAR (UNICODE is set) so we can't use the string for
logging directly.

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

 modules/codec/dmo/dmo.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 65f7dae01f..2c6fea8a84 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -48,12 +48,6 @@
 # define DMO_DEBUG 1
 #endif
 
-#ifdef UNICODE
-# define PRIs "%ls"
-#else
-# define PRIs "%s"
-#endif
-
 typedef long (STDCALL *GETCLASS) ( const GUID*, const GUID*, void** );
 
 /*****************************************************************************
@@ -244,9 +238,10 @@ static int DecoderOpen( vlc_object_t *p_this )
     {
         if( decoders_table[i].i_fourcc == p_dec->fmt_in.i_codec )
         {
-            msg_Dbg( p_dec, "DMO codec for %4.4s may work with dll="PRIs,
-                     (char*)&p_dec->fmt_in.i_codec,
-                     decoders_table[i].psz_dll );
+            char *log_dll = FromWide( decoders_table[i].psz_dll );
+            msg_Dbg( p_dec, "DMO codec for %4.4s may work with dll=%s",
+                     (char*)&p_dec->fmt_in.i_codec, log_dll);
+            free( log_dll );
             goto found;
         }
     }
@@ -748,8 +743,9 @@ loader:
     *p_hmsdmo_dll = LoadLibrary( codecs_table[i_codec].psz_dll );
     if( *p_hmsdmo_dll == NULL )
     {
-        msg_Dbg( p_this, "failed loading '"PRIs"'",
-                 codecs_table[i_codec].psz_dll );
+        char *log_dll = FromWide(codecs_table[i_codec].psz_dll);
+        msg_Dbg( p_this, "failed loading '%s'", log_dll );
+        free( log_dll );
         return VLC_EGENERIC;
     }
 



More information about the vlc-commits mailing list