Base/App: fix warnings from code analysers:

* convert old-style-casts to explicit C++ casts where possible
* make some implicit conversions explicit
This commit is contained in:
wmayer
2022-03-06 23:49:30 +01:00
parent 26ece78df4
commit 4a343ab31e
30 changed files with 211 additions and 155 deletions

View File

@@ -235,18 +235,18 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity &quant, doub
minden = quant.getFormat().getDenominator();
// Compute and round the total number of fractional units
ntot = (int)std::round(totalInches * (double)minden);
ntot = static_cast<int>(std::round(totalInches * static_cast<double>(minden)));
// If this is zero, nothing to do but return
if( ntot==0 )
return QString::fromLatin1("0");
// Compute the whole number of feet and remaining units
feet = (int)std::floor(ntot / (12*minden));
feet = static_cast<int>(std::floor(ntot / (12*minden)));
ntot = ntot - 12*minden*feet;
// Compute the remaining number of whole inches
inches = (int)std::floor(ntot/minden);
inches = static_cast<int>(std::floor(ntot/minden));
// Lastly the fractional quantities
num = ntot - inches*minden;
@@ -387,9 +387,9 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, d
// double wholeSeconds = std::floor(rawSeconds);
// double remainSeconds = rawSeconds - wholeSeconds;
int outDeg = (int) wholeDegrees;
int outMin = (int) wholeMinutes;
int outSec = (int) std::round(rawSeconds);
int outDeg = static_cast<int>(wholeDegrees);
int outMin = static_cast<int>(wholeMinutes);
int outSec = static_cast<int>(std::round(rawSeconds));
std::stringstream output;
output << outDeg << degreeString.toUtf8().constData();