Author: aschnell Date: Fri Nov 21 12:14:42 2008 New Revision: 53503 URL: http://svn.opensuse.org/viewcvs/yast?rev=53503&view=rev Log: - fixed size parser for locale fr_FR (bnc #447490) Modified: trunk/storage/VERSION trunk/storage/libstorage/src/AppUtil.cc trunk/storage/libstorage/testsuite/humanstring2.cc trunk/storage/libstorage/testsuite/single.out/humanstring2.out trunk/storage/package/yast2-storage.changes Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=53503&r1=53502&r2=53503&view=diff ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Fri Nov 21 12:14:42 2008 @@ -1 +1 @@ -2.17.52 +2.17.53 Modified: trunk/storage/libstorage/src/AppUtil.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.cc?rev=53503&r1=53502&r2=53503&view=diff ============================================================================== --- trunk/storage/libstorage/src/AppUtil.cc (original) +++ trunk/storage/libstorage/src/AppUtil.cc Fri Nov 21 12:14:42 2008 @@ -610,7 +610,7 @@ { const locale loc = classic ? locale::classic() : locale(); - double f = (double)(size); + double f = size; int i = 0; while (f >= 1024.0 && i + 1 < numSuffixes()) @@ -640,24 +640,31 @@ { const locale loc = classic ? locale::classic() : locale(); - istringstream s(boost::trim_copy(str, loc)); - s.imbue(loc); - - double f; - string suffix; - s >> f; - if (!s.eof()) s >> suffix; - - if (s.fail() || !s.eof() || f < 0.0) - return false; + const string str_trimmed = boost::trim_copy(str, loc); + double f = 1.0; + for (int i = 0; i < numSuffixes(); i++) { - if (boost::equals(suffix, getSuffix(i, classic, false), boost::is_iequal(loc)) || - (!classic && boost::equals(suffix, getSuffix(i, classic, true), boost::is_iequal(loc)))) + for (int j = 0; j < (classic ? 1 : 2); j++) { - size = f; - return true; + string suffix = getSuffix(i, classic, j != 0); + if (boost::iends_with(str_trimmed, suffix, loc)) + { + string number = str_trimmed.substr(0, str_trimmed.size() - suffix.size()); + + istringstream s(boost::trim_copy(number, loc)); + s.imbue(loc); + + double g; + s >> g; + + if (!s.fail() && s.eof() && g >= 0.0) + { + size = g * f; + return true; + } + } } f *= 1024.0; Modified: trunk/storage/libstorage/testsuite/humanstring2.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/testsuite/humanstring2.cc?rev=53503&r1=53502&r2=53503&view=diff ============================================================================== --- trunk/storage/libstorage/testsuite/humanstring2.cc (original) +++ trunk/storage/libstorage/testsuite/humanstring2.cc Fri Nov 21 12:14:42 2008 @@ -50,6 +50,10 @@ test("en_GB.UTF-8", "12.4g", false); test("en_GB.UTF-8", "12.4 G", false); + test("en_GB.UTF-8", "123,456 kB", false); + test("de_DE.UTF-8", "123.456 kB", false); + test("fr_FR.UTF-8", "123 456 kB", false); + test("en_GB.UTF-8", "123,456.789kB", false); test("de_DE.UTF-8", "123.456,789kB", false); test("fr_FR.UTF-8", "123 456,789kB", false); @@ -58,5 +62,12 @@ test("de_DE.UTF-8", "123.456,789 kB", false); test("fr_FR.UTF-8", "123 456,789 kB", false); + test("fr_FR.UTF-8", "5GB", false); + test("fr_FR.UTF-8", "5 GB", false); + + test("en_US.UTF-8", "5 G B", false); // FAILS + test("de_DE.UTF-8", "12.34 kB", false); // FAILS + test("fr_FR.UTF-8", "12 34 GB", false); // FAILS + delete s; } Modified: trunk/storage/libstorage/testsuite/single.out/humanstring2.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/testsuite/single.out/humanstring2.out?rev=53503&r1=53502&r2=53503&view=diff ============================================================================== --- trunk/storage/libstorage/testsuite/single.out/humanstring2.out (original) +++ trunk/storage/libstorage/testsuite/single.out/humanstring2.out Fri Nov 21 12:14:42 2008 @@ -10,9 +10,17 @@ parse ok 13314398617 parse ok 13314398617 parse ok 13314398617 +parse ok 126418944 +parse ok 126418944 +parse ok 126418944 parse ok 126419751 parse ok 126419751 parse ok 126419751 parse ok 126419751 parse ok 126419751 parse ok 126419751 +parse ok 5368709120 +parse ok 5368709120 +parse error +parse error +parse error Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=53503&r1=53502&r2=53503&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Fri Nov 21 12:14:42 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Nov 21 11:45:39 CET 2008 - aschnell@suse.de + +- fixed size parser for locale fr_FR (bnc #447490) +- 2.17.53 + +------------------------------------------------------------------- Tue Nov 18 18:14:42 CET 2008 - aschnell@suse.de - fixed use of existing encrypted devices (bnc #435244) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org