Fix string to float conversion when typing gain values in Gain Meter
authorTim Mayberry <mojofunk@gmail.com>
Sun, 21 Aug 2016 11:52:04 +0000 (21:52 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Wed, 24 Aug 2016 10:42:56 +0000 (20:42 +1000)
Remove the LocaleGuard so that the value of LC_NUMERIC is that of the users
locale and sscanf will parse the string correctly. For instance, with a locale
like nl_NL or fr_FR where the decimal point is different than the "C" locale,
only the number up to the decimal point will be parsed by sscanf and input
values will be rounded down.

gtk2_ardour/gain_meter.cc

index 85122b93ee8caa2a9bdc7aa20069315f2f5e4a66..55bdf4ce2f7d9daa6f304e3811864eff534971f1 100644 (file)
@@ -477,15 +477,9 @@ GainMeterBase::gain_activated ()
 {
        float f;
 
-       {
-               // Switch to user's preferred locale so that
-               // if they use different LC_NUMERIC conventions,
-               // we will honor them.
-
-               PBD::LocaleGuard lg;
-               if (sscanf (gain_display.get_text().c_str(), "%f", &f) != 1) {
-                       return;
-               }
+       // Use the user's preferred locale/LC_NUMERIC setting
+       if (sscanf (gain_display.get_text().c_str(), "%f", &f) != 1) {
+               return;
        }
 
        /* clamp to displayable values */