Fix the handling of string variable - store them as UTF-8 into the config variables...
authorAndré Weber <atmo@videolan.org>
Thu, 20 Mar 2008 20:17:48 +0000 (21:17 +0100)
committerAndré Weber <atmo@videolan.org>
Thu, 20 Mar 2008 20:20:36 +0000 (21:20 +0100)
waveout.c forgott to convert string to UTF8 before storing in choice list

modules/audio_output/waveout.c
modules/gui/qt4/components/preferences_widgets.cpp

index 8ec3636..c415835 100644 (file)
@@ -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 );
         }
     }
 
index e346fd0..0ae3b25 100644 (file)
@@ -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 );