refs #800 Replaced some C-style casts.

This commit is contained in:
Mathew Sutcliffe
2016-11-10 00:45:34 +00:00
committed by Klaus Basan
parent 1f54bbc0d5
commit ced70c4612
2 changed files with 6 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ namespace BlackMisc
double CMathUtils::cubicRootReal(double x) double CMathUtils::cubicRootReal(double x)
{ {
double result; double result;
result = std::pow(qAbs(x), (double)1.0 / 3.0); result = std::pow(qAbs(x), 1.0 / 3.0);
return x < 0 ? -result : result; return x < 0 ? -result : result;
} }
@@ -47,7 +47,7 @@ namespace BlackMisc
if (fractpart == 0) return value; // do not mess any "integers" to the worse if (fractpart == 0) return value; // do not mess any "integers" to the worse
double m = pow(10.0, digits); double m = pow(10.0, digits);
qint64 ri = qRound64(value * m); // do not loose any range here qint64 ri = qRound64(value * m); // do not loose any range here
double rv = double(ri) / m; double rv = static_cast<double>(ri) / m;
return rv; return rv;
} }
@@ -57,7 +57,7 @@ namespace BlackMisc
fractpart = modf(value, &intpart); fractpart = modf(value, &intpart);
if (fractpart == 0) return value; // do not mess any "integers" to the worse if (fractpart == 0) return value; // do not mess any "integers" to the worse
qint64 ri = qRound(value / epsilon); qint64 ri = qRound(value / epsilon);
double rv = double(ri) * epsilon; // do not loose any range here double rv = static_cast<double>(ri) * epsilon; // do not loose any range here
return rv; return rv;
} }

View File

@@ -204,10 +204,11 @@ namespace BlackWxPlugin
// Search next grib field // Search next grib field
g2int lskip = 0; g2int lskip = 0;
g2int lgrib = 0; g2int lgrib = 0;
findNextGribMessage((unsigned char*)gribData.data(), gribData.size(), iseek, &lskip, &lgrib); auto constData = reinterpret_cast<unsigned char*>(const_cast<char*>(gribData.data()));
findNextGribMessage(constData, gribData.size(), iseek, &lskip, &lgrib);
if (lgrib == 0) { break; } if (lgrib == 0) { break; }
unsigned char *readPtr = (unsigned char*)gribData.data() + lskip; unsigned char *readPtr = constData + lskip;
iseek=lskip + lgrib; iseek=lskip + lgrib;
g2int sec0[3]; g2int sec0[3];