]> git.sesse.net Git - vlc/commitdiff
Fix question marks insertion
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 4 Aug 2005 19:03:28 +0000 (19:03 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 4 Aug 2005 19:03:28 +0000 (19:03 +0000)
src/libvlc.c

index ab1d4b98de4e7af182243919176d08b9f9a2404e..770a2889b793044f679ca8d9eb58aece385cba20 100644 (file)
@@ -2493,9 +2493,15 @@ char *FromLocale( const char *locale )
         optr = output = calloc( outb , 1);
 
         vlc_mutex_lock( &libvlc.from_locale_lock );
+        vlc_iconv( libvlc.from_locale, NULL, NULL, NULL, NULL );
+
         while( vlc_iconv( libvlc.from_locale, &iptr, &inb, &optr, &outb )
                                                                == (size_t)-1 )
-            *iptr = '?'; /* should not happen, and yes, it sucks */
+        {
+            *optr++ = '?';
+            *iptr++;
+            vlc_iconv( libvlc.from_locale, NULL, NULL, NULL, NULL );
+        }
         vlc_mutex_unlock( &libvlc.from_locale_lock );
 
         return realloc( output, strlen( output ) + 1 );
@@ -2527,14 +2533,19 @@ char *ToLocale( const char *utf8 )
 
         optr = output = calloc( outb, 1 );
         vlc_mutex_lock( &libvlc.to_locale_lock );
+        vlc_iconv( libvlc.to_locale, NULL, NULL, NULL, NULL );
+
         while( vlc_iconv( libvlc.to_locale, &iptr, &inb, &optr, &outb )
                                                                == (size_t)-1 )
-            *iptr = '?'; /* should not happen, and yes, it sucks */
+        {
+            *optr++ = '?'; /* should not happen, and yes, it sucks */
+            *iptr++;
+            vlc_iconv( libvlc.to_locale, NULL, NULL, NULL, NULL );
+        }
         vlc_mutex_unlock( &libvlc.to_locale_lock );
 
         return realloc( output, strlen( output ) + 1 );
     }
-
     return (char *)utf8;
 }