conga/ricci/modules/storage parted_wrapper.cpp
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: kupcevic at sourceware.org 2007-03-20 15:48:30
Modified files:
ricci/modules/storage: parted_wrapper.cpp
Log message:
storage module: long long constant int to long long int conversion error? C idiocy
ricci/modules/storage/parted_wrapper.cpp +7 -6
@@ -594,8 +594,9 @@ long long bbb; list<PartedPartition> parts = plain_partitions(pt_path, aaa, bbb); - seg_begin = seg_begin / 1000000; - long long seg_end = seg_begin + size / 1000000; + // parted defines 1KB as 1000 bytes + seg_begin = seg_begin / 1000 / 1000; + long long seg_end = seg_begin + size / 1000 / 1000; vector<String> args; args.push_back("-s");
@@ -665,7 +666,7 @@ long long multiplier; // parted defines 1KB as 1000 bytes. if (s.find("b") == s.npos) - multiplier = 1000000; // by old parted behavior, size is in MB + multiplier = 1000 * 1000; // by old parted behavior, size is in MB else { if (s.size() < 3) throw String("parted size has an invalid value: ") + s;
@@ -673,11 +674,11 @@ if (s[s.size()-2] == 'k') multiplier = 1000; else if (s[s.size()-2] == 'm') - multiplier = 1000000; + multiplier = 1000 * 1000; else if (s[s.size()-2] == 'g') - multiplier = 1000000000; + multiplier = 1000 * 1000 * 1000; else if (s[s.size()-2] == 't') - multiplier = 1000000000000; + multiplier = 1000 * 1000 * 1000 * 1000; } return (long long) utils::to_float(s) * multiplier;