[vlc-devel] commit: Fix the handling of string variable - store them as UTF-8 into the config variables , also convert the StringList values to an UTF8 string before putting them into a QVariant - which seems not to work if created from a "char *" - because later converterd QVariant->toString() isn' t UTF8 like expected. ( André Weber )

git version control git at videolan.org
Thu Mar 20 21:11:53 CET 2008


vlc | branch: master | André Weber <atmo at videolan.org> | Thu Mar 20 21:17:48 2008 +0100| [61a056a7eb4b1190384432f31ba63d102e8d0230]

Fix the handling of string variable - store them as UTF-8 into the config variables, also convert the StringList values to an UTF8 string before putting them into a QVariant - which seems not to work if created from a "char *" - because later converterd QVariant->toString() isn't UTF8 like expected.
waveout.c forgott to convert string to UTF8 before storing in choice list

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

 modules/audio_output/waveout.c                     |   16 +++++++++++-----
 modules/gui/qt4/components/preferences_widgets.cpp |    6 +++---
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 8ec3636..c415835 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -1193,11 +1193,11 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
         if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))
            == MMSYSERR_NOERROR)
         {
-          sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,
+          sprintf( sz_dev_name, psz_device_name_fmt, caps.szPname,
                                                caps.wMid,
                                                caps.wPid
                                               );
-          p_item->ppsz_list[j] = strdup( sz_dev_name );
+          p_item->ppsz_list[j] = FromLocaleDup( sz_dev_name );
           p_item->ppsz_list_text[j] = FromLocaleDup( sz_dev_name );
           p_item->i_list++;
           j++;
@@ -1232,12 +1232,18 @@ static uint32_t findDeviceID(char *psz_device_name)
         if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))
            == MMSYSERR_NOERROR)
         {
-            sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,
+            sprintf(sz_dev_name, psz_device_name_fmt, caps.szPname,
                                                caps.wMid,
                                                caps.wPid
                                               );
-            if(!stricmp(sz_dev_name,psz_device_name))
-               return i;
+            char *psz_temp = FromLocaleDup(sz_dev_name);
+
+            if( !stricmp(psz_temp, psz_device_name) )
+            {
+                LocaleFree( psz_temp );
+                return i;
+            }
+            LocaleFree( psz_temp );
         }
     }
 
diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index e346fd0..0ae3b25 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -184,7 +184,7 @@ void ConfigControl::doApply( intf_thread_t *p_intf )
             VStringConfigControl *vscc =
                             qobject_cast<VStringConfigControl *>(this);
             assert( vscc );
-            config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) );
+            config_PutPsz( p_intf, vscc->getName(), qtu( vscc->getValue() ) );
             break;
         }
         case CONFIG_ITEM_KEY:
@@ -381,7 +381,7 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
 
        p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
 
-       // assume in a×y case that dirty was set to VLC_TRUE
+       // assume in any case that dirty was set to VLC_TRUE
        // because lazy programmes will use the same callback for
        // this, like the one behind the refresh push button?
        p_module_config->b_dirty = VLC_FALSE;
@@ -466,7 +466,7 @@ void StringListConfigControl::finish(module_config_t *p_module_config, bool byca
                             p_module_config->ppsz_list_text[i_index])?
                             p_module_config->ppsz_list_text[i_index] :
                             p_module_config->ppsz_list[i_index] ),
-                        QVariant( p_module_config->ppsz_list[i_index] ) );
+                   QVariant( qfu(p_module_config->ppsz_list[i_index] )) );
         if( p_item->value.psz && !strcmp( p_module_config->value.psz,
                                           p_module_config->ppsz_list[i_index] ) )
             combo->setCurrentIndex( combo->count() - 1 );




More information about the vlc-devel mailing list