]> git.sesse.net Git - vlc/commitdiff
Fixed #949 (UTF-8 url support)
authorLaurent Aimar <fenrir@videolan.org>
Fri, 23 Mar 2007 19:28:48 +0000 (19:28 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 23 Mar 2007 19:28:48 +0000 (19:28 +0000)
modules/access/mms/buffer.c
modules/access/mms/mmstu.c

index 0a90278a67ccfaae760f07a5c0d3f533b323324d..22a7856cea4e3cfae955106568f3c364b3d32b3f 100644 (file)
@@ -124,10 +124,27 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, char *p_str )
     }
     else
     {
-        for( i = 0; i < strlen( p_str ) + 1; i++ ) // and 0
+        vlc_iconv_t iconv_handle;
+        size_t i_in = strlen( p_str );
+        size_t i_out = i_in * 4;
+        char *psz_out, *psz_tmp;
+        uint16_t *pw;
+
+        psz_out = psz_tmp = malloc( i_out + 1 );
+        iconv_handle = vlc_iconv_open( "UTF-16LE", "UTF-8" );
+        vlc_iconv( iconv_handle, &p_str, &i_in, &psz_tmp, &i_out );
+        vlc_iconv_close( iconv_handle );
+        psz_tmp[0] = '\0';
+        psz_tmp[1] = '\0';
+
+        for( i = 0; ; i += 2 )
         {
-            var_buffer_add16( p_buf, p_str[i] );
+            uint16_t v = GetWLE( &psz_out[i] );
+            var_buffer_add16( p_buf, v );
+            if( !v )
+                break;
         }
+        free( psz_out );
     }
 }
 
index 7e441cae73e26e5ecb7687b4cb86a60e163e50e0..1b44c24a7aaa0701760f9464e6b51d94c95417d8 100644 (file)
@@ -1218,14 +1218,15 @@ static int  mms_ParsePacket( access_t *p_access,
 
     if( i_packet_seq_num != p_sys->i_packet_seq_num )
     {
+#if 0
         /* FIXME for udp could be just wrong order ? */
         msg_Warn( p_access,
                   "detected packet lost (%d != %d)",
                   i_packet_seq_num,
                   p_sys->i_packet_seq_num );
-        p_sys->i_packet_seq_num = i_packet_seq_num;
+#endif
     }
-    p_sys->i_packet_seq_num++;
+    p_sys->i_packet_seq_num = i_packet_seq_num + 1;
 
     if( i_packet_id == p_sys->i_header_packet_id_type )
     {