@@ -28,12 +28,12 @@ bool cmpStringGrow::operator()(const string& a, const string& b) const {
2828
2929unsigned FctHelper::digitsNum_uint32 (uint32_t n) {
3030 static constexpr uint32_t MaxTable[9 ] = { 10u , 100u , 1000u , 10000u , 100000u , 1000000u , 10000000u , 100000000u , 1000000000u }; // to_string(numeric_limits<uint32_t>::max()) = "4294967295" has length 10
31- return 1 + (upper_bound (MaxTable, MaxTable + 9 , n) - MaxTable);
31+ return 1 + static_cast < unsigned > (upper_bound (MaxTable, MaxTable + 9 , n) - MaxTable);
3232}
3333
3434unsigned FctHelper::digitsNum_uint64 (uint64_t n) {
3535 static constexpr uint64_t MaxTable[19 ] = { 10uLL, 100uLL, 1000uLL, 10000uLL, 100000uLL, 1000000uLL, 10000000uLL, 100000000uLL, 1000000000uLL, 10000000000uLL, 100000000000uLL, 1000000000000uLL, 10000000000000uLL, 100000000000000uLL, 1000000000000000uLL, 10000000000000000uLL, 100000000000000000uLL, 1000000000000000000uLL, 10000000000000000000uLL }; // to_string(numeric_limits<uint64_t>::max()) = "18446744073709551615" has length 20
36- return 1 + (upper_bound (MaxTable, MaxTable + 19 , n) - MaxTable);
36+ return 1 + static_cast < unsigned > (upper_bound (MaxTable, MaxTable + 19 , n) - MaxTable);
3737}
3838
3939string FctHelper::round (long double x, unsigned n, char separator) {
@@ -120,7 +120,7 @@ string FctHelper::durationYearsToMs(const chrono::microseconds& dur, bool innerA
120120 durationUs -= minutes * minuteUs;
121121 int64_t seconds = durationUs / secondUs;
122122 durationUs -= seconds * secondUs;
123- double milliseconds = durationUs / 1000.0 ;
123+ double milliseconds = static_cast < double >( durationUs) / 1000.0 ;
124124
125125 stringstream ss;
126126 bool empty = true ;
@@ -131,14 +131,14 @@ string FctHelper::durationYearsToMs(const chrono::microseconds& dur, bool innerA
131131 if (innerAlign && !empty) {
132132 if (negative)
133133 indent++;
134- unsigned len = num.length ();
134+ string::size_type len = num.length ();
135135 if (indent <= len)
136136 return " " ;
137137 return string (indent - len, ' ' );
138138 } else
139139 return " " ;
140140 };
141- auto appendRequestedBlankIndent = [&](unsigned indent) {
141+ auto appendRequestedBlankIndent = [&](string::size_type indent) {
142142 if (innerAlign && !empty) {
143143 if (negative)
144144 indent++;
@@ -202,9 +202,9 @@ string FctHelper::durationYearsToMs(const chrono::microseconds& dur, bool innerA
202202string FctHelper::durationStringMs (const chrono::microseconds& dur, bool innerAlign, unsigned round, bool showMonths, bool showWeeks, bool wolframAlphaMode, const string& yrId, const string& moId, const string& wkId, const string& dId, const string& hId, const string& minId, const string& sId , const string& msId) {
203203 stringstream ss;
204204 if (dur.count () >= 1000000 )
205- ss << FctHelper::round (dur.count () / 1000.0 , 2 ) << msId << " (" << durationYearsToMs (dur, innerAlign, round, showMonths, showWeeks, wolframAlphaMode, yrId, moId, wkId, dId, hId, minId, sId , msId) << " )" ;
205+ ss << FctHelper::round (static_cast < long double >( dur.count () ) / 1000.0 , 2 ) << msId << " (" << durationYearsToMs (dur, innerAlign, round, showMonths, showWeeks, wolframAlphaMode, yrId, moId, wkId, dId, hId, minId, sId , msId) << " )" ;
206206 else
207- ss << FctHelper::round (dur.count () / 1000.0 , 2 ) << msId;
207+ ss << FctHelper::round (static_cast < long double >( dur.count () ) / 1000.0 , 2 ) << msId;
208208 return ss.str ();
209209}
210210
@@ -293,7 +293,7 @@ wstring FctHelper::utf8toWide(const char* in) {
293293
294294vector<string> FctHelper::stringSplit (const string& str, const string& sep) {
295295 vector<string> parts;
296- unsigned start = 0 ;
296+ string::size_type start = 0 ;
297297 string::size_type end = str.find (sep);
298298 while (end != string::npos) {
299299 parts.push_back (str.substr (start, end - start));
0 commit comments