Author: ug Date: Fri Feb 6 16:02:36 2009 New Revision: 55313 URL: http://svn.opensuse.org/viewcvs/yast?rev=55313&view=rev Log: Wrapper for LibStorage::humanStringToByte added Modified: trunk/autoinstallation/package/autoyast2.changes trunk/autoinstallation/src/include/autopart.ycp trunk/autoinstallation/src/modules/AutoinstLVM.ycp trunk/autoinstallation/src/modules/AutoinstStorage.ycp Modified: trunk/autoinstallation/package/autoyast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/package/autoyast2.changes?rev=55313&r1=55312&r2=55313&view=diff ============================================================================== --- trunk/autoinstallation/package/autoyast2.changes (original) +++ trunk/autoinstallation/package/autoyast2.changes Fri Feb 6 16:02:36 2009 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Feb 6 15:56:28 CET 2009 - ug@suse.de + +- Wrapper for LibStorage::humanStringToByte added + +------------------------------------------------------------------- Fri Feb 6 12:30:58 CET 2009 - ug@suse.de - fixed the translation of module/groups in the UI (bnc#448238) Modified: trunk/autoinstallation/src/include/autopart.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/include/autopart.ycp?rev=55313&r1=55312&r2=55313&view=diff ============================================================================== --- trunk/autoinstallation/src/include/autopart.ycp (original) +++ trunk/autoinstallation/src/include/autopart.ycp Fri Feb 6 16:02:36 2009 @@ -120,7 +120,7 @@ ``{ if (haskey(partition, "maxsize")) { - partition["max"] = kmgt_str_to_byte(partition["maxsize"]:""); + partition["max"] = AutoinstStorage::humanStringToByte(partition["maxsize"]:"", true ); } if (partition["size"]:"" != "") @@ -136,7 +136,7 @@ } else { - partition["size"] = kmgt_str_to_byte( s ); + partition["size"] = AutoinstStorage::humanStringToByte( s, true ); } } Modified: trunk/autoinstallation/src/modules/AutoinstLVM.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/modules/AutoinstLVM.ycp?rev=55313&r1=55312&r2=55313&view=diff ============================================================================== --- trunk/autoinstallation/src/modules/AutoinstLVM.ycp (original) +++ trunk/autoinstallation/src/modules/AutoinstLVM.ycp Fri Feb 6 16:02:36 2009 @@ -125,7 +125,7 @@ y2milestone("swap slot size: %1", vgsize/1024*1024 ); lvsize = 1024*1024*Partitions::SwapSizeMb(vgsize/(1024*1024)); } else if (lvsize_str!= "") { - lvsize = kmgt_str_to_byte(lvsize_str); + lvsize = AutoinstStorage::humanStringToByte( lvsize_str, true ); } lv["size_k"] = lvsize/1024; @@ -263,7 +263,7 @@ buffer = (buffer * 2) / 1024; volume_group["partitions"] = maplist( map lv, volume_group["partitions"]:[], ``{ - integer s = kmgt_str_to_byte( lv["size"]:"10000" ); + integer s = AutoinstStorage::humanStringToByte( lv["size"]:"10000", true ); if( s <= 100 && s > 0 ) { // we assume percentage for this lv integer integer_k = freeSpace * tointeger(lv["size"]:"0") / 100; Modified: trunk/autoinstallation/src/modules/AutoinstStorage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/modules/AutoinstStorage.ycp?rev=55313&r1=55312&r2=55313&view=diff ============================================================================== --- trunk/autoinstallation/src/modules/AutoinstStorage.ycp (original) +++ trunk/autoinstallation/src/modules/AutoinstStorage.ycp Fri Feb 6 16:02:36 2009 @@ -19,6 +19,7 @@ import "Partitions"; import "Popup"; import "Report"; + import "LibStorage"; // All shared data are in yast2.rpm to break cyclic dependencies import "AutoinstData"; @@ -65,6 +66,22 @@ return modified; } + /** + * Wrapper function for the LibStorage call that can't be used directly + * in YCP + * @return integer + * + */ + global define integer humanStringToByte( string s, boolean b ) { + integer result = -1; + if( size(s) == 0 ) + s = "0b"; + if( findfirstnotof( s, "1234567890" ) == nil ) + s = s + "b"; + if(! LibStorage::humanStringToByte( s, b, result ) ) + y2milestone("LibStorage::humanStringToByte failed for %1", s); + return result; + } include "autoinstall/autopart.ycp"; include "autoinstall/autoinst_dialogs.ycp"; @@ -425,7 +442,7 @@ integer newCyl = currentCyl * tointeger(percentage) / 100; pe["region",1] = newCyl; } else { - integer new_size = kmgt_str_to_byte( pe["size"]:"0" ); + integer new_size = humanStringToByte( pe["size"]:"0", true ); integer newCyl = new_size/realDisk["cyl_size"]:1; pe["region",1] = newCyl; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org