From: Guilherme Maciel Ferreira Date: Wed, 2 Feb 2011 11:08:19 +0000 (+0100) Subject: Rename variables according with their enumeration type names X-Git-Tag: v2.6~86^2~8 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=a398513a74c55c558224b03058a5e937a70ae957;p=libi2ncommon Rename variables according with their enumeration type names --- diff --git a/src/stringfunc.cpp b/src/stringfunc.cpp index fc5ae60..310cb01 100644 --- a/src/stringfunc.cpp +++ b/src/stringfunc.cpp @@ -921,13 +921,13 @@ const string symbolFormatLong[MAX_SYMBOL_FORMATS] = { string nice_unit_format( const int64_t input, - const UnitBase system, - const UnitFormat symbolformat + const UnitBase base, + const UnitFormat format ) { // select the system of units (decimal or binary) int multiple = 0; - if (system == UnitBase1000) + if (base == UnitBase1000) { multiple = 1000; } @@ -946,18 +946,19 @@ string nice_unit_format( sizecount++; } - // round the input number + // round the input number "half up" to multiples of 10 + const int rounding_multiplier = 10; long double tmp; - tmp = size * 10; + tmp = size * rounding_multiplier; tmp += 0.5; tmp = (int64_t) (tmp); - tmp = (long double) (tmp) / (long double) (10); + tmp = (long double) (tmp) / (long double) (rounding_multiplier); size = tmp; // format the input number, placing the appropriate symbol ostringstream out; out.setf (ios::fixed); - if (symbolformat == ShortUnitFormat) + if (format == ShortUnitFormat) { out.precision(1); out << size << i18n( symbolFormatShort[sizecount].c_str() ); diff --git a/src/stringfunc.hxx b/src/stringfunc.hxx index ca45bd4..47fc607 100644 --- a/src/stringfunc.hxx +++ b/src/stringfunc.hxx @@ -204,8 +204,8 @@ enum UnitFormat { std::string nice_unit_format( const int64_t input, - const UnitBase system = UnitBase1000, - const UnitFormat symbolformat = LongUnitFormat + const UnitBase base = UnitBase1000, + const UnitFormat format = LongUnitFormat ); bool replace_all(std::string &base, const std::string *ist, const std::string *soll);