[vlc-commits] MMS: add an error message if UTF-16 conversion fails
Rafaël Carré
git at videolan.org
Sat Mar 3 01:09:53 CET 2012
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri Mar 2 19:08:48 2012 -0500| [26db27e01ad310bfc9004ce6fa22e40a3892fbd5] | committer: Rafaël Carré
MMS: add an error message if UTF-16 conversion fails
Server rejects connection if some field are not set properly
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=26db27e01ad310bfc9004ce6fa22e40a3892fbd5
---
modules/access/mms/buffer.c | 6 +++++-
modules/access/mms/buffer.h | 2 +-
modules/access/mms/mmstu.c | 6 +++---
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/access/mms/buffer.c b/modules/access/mms/buffer.c
index b1e8747..4268750 100644
--- a/modules/access/mms/buffer.c
+++ b/modules/access/mms/buffer.c
@@ -30,6 +30,7 @@
#endif
#include <vlc_common.h>
+#include <vlc_access.h>
#include <vlc_charset.h>
#include "asf.h"
@@ -106,7 +107,7 @@ void var_buffer_addmemory( var_buffer_t *p_buf, void *p_mem, int i_mem )
p_buf->i_data += i_mem;
}
-void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str )
+void var_buffer_addUTF16( access_t *p_access, var_buffer_t *p_buf, const char *p_str )
{
uint16_t *p_out;
size_t i_out;
@@ -120,7 +121,10 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str )
else
p_out = NULL;
if( p_out == NULL )
+ {
+ msg_Err( p_access, "UTF-16 conversion failed" );
i_out = 0;
+ }
i_out /= 2;
for( size_t i = 0; i < i_out; i ++ )
diff --git a/modules/access/mms/buffer.h b/modules/access/mms/buffer.h
index e969fe3..d141905 100644
--- a/modules/access/mms/buffer.h
+++ b/modules/access/mms/buffer.h
@@ -43,7 +43,7 @@ void var_buffer_add16( var_buffer_t *p_buf, uint16_t i_word );
void var_buffer_add32( var_buffer_t *p_buf, uint32_t i_word );
void var_buffer_add64( var_buffer_t *p_buf, uint64_t i_word );
void var_buffer_addmemory( var_buffer_t *p_buf, void *p_mem, int i_mem );
-void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str );
+void var_buffer_addUTF16( access_t *p_access, var_buffer_t *p_buf, const char *p_str );
void var_buffer_free( var_buffer_t *p_buf );
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index b74be96..ac64201 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -536,7 +536,7 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
"NSPlayer/7.0.0.1956; {"GUID_FMT"}; Host: %s",
GUID_PRINT( p_sys->guid ),
p_url->psz_host );
- var_buffer_addUTF16( &buffer, tmp );
+ var_buffer_addUTF16( p_access, &buffer, tmp );
mms_CommandSend( p_access,
0x01, /* connexion request */
@@ -598,7 +598,7 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
{
sprintf( tmp, "\\\\192.168.0.1\\TCP\\1242" );
}
- var_buffer_addUTF16( &buffer, tmp );
+ var_buffer_addUTF16( p_access, &buffer, tmp );
var_buffer_add16( &buffer, '0' );
mms_CommandSend( p_access,
@@ -633,7 +633,7 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
{
mediapath++;
}
- var_buffer_addUTF16( &buffer, mediapath );
+ var_buffer_addUTF16( p_access, &buffer, mediapath );
mms_CommandSend( p_access,
0x05,
More information about the vlc-commits
mailing list