Skip to content

Commit

Permalink
Address warnings raised by recent cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 17, 2020
1 parent 0403980 commit 9c50122
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/iso19111/coordinateoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6530,8 +6530,8 @@ struct Transformation::Private {

TransformationPtr forwardOperation_{};

TransformationNNPtr registerInv(const Transformation *thisIn,
TransformationNNPtr invTransform);
static TransformationNNPtr registerInv(const Transformation *thisIn,
TransformationNNPtr invTransform);
};
//! @endcond

Expand Down Expand Up @@ -8068,7 +8068,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
double z =
parameterValueNumericAsSI(EPSG_CODE_PARAMETER_Z_AXIS_TRANSLATION);
auto properties = createPropertiesForInverse(this, false, false);
return d->registerInv(
return Private::registerInv(
this, create(properties, l_targetCRS, l_sourceCRS, nullptr,
createMethodMapNameEPSGCode(
useOperationMethodEPSGCodeIfPresent(
Expand Down Expand Up @@ -8101,14 +8101,14 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
EPSG_CODE_PARAMETER_FLATTENING_DIFFERENCE);

if (methodEPSGCode == EPSG_CODE_METHOD_ABRIDGED_MOLODENSKY) {
return d->registerInv(
return Private::registerInv(
this,
createAbridgedMolodensky(
createPropertiesForInverse(this, false, false), l_targetCRS,
l_sourceCRS, negate(x), negate(y), negate(z), negate(da),
negate(df), coordinateOperationAccuracies()));
} else {
return d->registerInv(
return Private::registerInv(
this,
createMolodensky(createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, negate(x), negate(y),
Expand All @@ -8121,7 +8121,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
auto offset =
parameterValueMeasure(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET);
const common::Angle newOffset(negate(offset.value()), offset.unit());
return d->registerInv(
return Private::registerInv(
this, createLongitudeRotation(
createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, newOffset));
Expand All @@ -8138,7 +8138,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
const common::Angle newOffsetLong(negate(offsetLong.value()),
offsetLong.unit());

return d->registerInv(
return Private::registerInv(
this, createGeographic2DOffsets(
createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, newOffsetLat, newOffsetLong,
Expand All @@ -8161,7 +8161,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
const common::Length newOffsetHeight(negate(offsetHeight.value()),
offsetHeight.unit());

return d->registerInv(
return Private::registerInv(
this, createGeographic3DOffsets(
createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, newOffsetLat, newOffsetLong,
Expand All @@ -8184,7 +8184,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
const common::Length newOffsetHeight(negate(offsetHeight.value()),
offsetHeight.unit());

return d->registerInv(
return Private::registerInv(
this, createGeographic2DWithHeightOffsets(
createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, newOffsetLat, newOffsetLong,
Expand All @@ -8198,7 +8198,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
const common::Length newOffsetHeight(negate(offsetHeight.value()),
offsetHeight.unit());

return d->registerInv(
return Private::registerInv(
this,
createVerticalOffset(createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, newOffsetHeight,
Expand All @@ -8208,7 +8208,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
if (methodEPSGCode == EPSG_CODE_METHOD_CHANGE_VERTICAL_UNIT) {
const double convFactor = parameterValueNumericAsSI(
EPSG_CODE_PARAMETER_UNIT_CONVERSION_SCALAR);
return d->registerInv(
return Private::registerInv(
this, createChangeVerticalUnit(
createPropertiesForInverse(this, false, false),
l_targetCRS, l_sourceCRS, common::Scale(1.0 / convFactor),
Expand All @@ -8218,7 +8218,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
#ifdef notdef
// We don't need that currently, but we might...
if (methodEPSGCode == EPSG_CODE_METHOD_HEIGHT_DEPTH_REVERSAL) {
return d->registerInv(
return Private::registerInv(
this,
createHeightDepthReversal(
createPropertiesForInverse(this, false, false), l_targetCRS,
Expand Down
9 changes: 9 additions & 0 deletions src/transformations/defmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,21 +475,25 @@ struct GridPrototype {
int width = 0;
int height = 0;

// cppcheck-suppress functionStatic
bool getLonLatOffset(int /*ix*/, int /*iy*/, double & /*lonOffsetRadian*/,
double & /*latOffsetRadian*/) const {
throw UnimplementedException("getLonLatOffset unimplemented");
}

// cppcheck-suppress functionStatic
bool getZOffset(int /*ix*/, int /*iy*/, double & /*zOffset*/) const {
throw UnimplementedException("getZOffset unimplemented");
}

// cppcheck-suppress functionStatic
bool getEastingNorthingOffset(int /*ix*/, int /*iy*/,
double & /*eastingOffset*/,
double & /*northingOffset*/) const {
throw UnimplementedException("getEastingNorthingOffset unimplemented");
}

// cppcheck-suppress functionStatic
bool getLonLatZOffset(int /*ix*/, int /*iy*/, double & /*lonOffsetRadian*/,
double & /*latOffsetRadian*/,
double & /*zOffset*/) const {
Expand All @@ -500,6 +504,7 @@ struct GridPrototype {
#endif
}

// cppcheck-suppress functionStatic
bool getEastingNorthingZOffset(int /*ix*/, int /*iy*/,
double & /*eastingOffset*/,
double & /*northingOffset*/,
Expand All @@ -526,6 +531,7 @@ struct GridPrototype {
template <class Grid = GridPrototype> struct GridSetPrototype {
// The return pointer should remain "stable" over time for a given grid
// of a GridSet.
// cppcheck-suppress functionStatic
const Grid *gridAt(double /*x */, double /* y */) {
throw UnimplementedException("gridAt unimplemented");
}
Expand All @@ -542,20 +548,23 @@ struct EvaluatorIfacePrototype {
throw UnimplementedException("open unimplemented");
}

// cppcheck-suppress functionStatic
void geographicToGeocentric(double /* lam */, double /* phi */,
double /* height*/, double /* a */,
double /* b */, double /*es*/, double & /* X */,
double & /* Y */, double & /* Z */) {
throw UnimplementedException("geographicToGeocentric unimplemented");
}

// cppcheck-suppress functionStatic
void geocentricToGeographic(double /* X */, double /* Y */, double /* Z */,
double /* a */, double /* b */, double /*es*/,
double & /* lam */, double & /* phi */,
double & /* height*/) {
throw UnimplementedException("geocentricToGeographic unimplemented");
}

// cppcheck-suppress functionStatic
bool isGeographicCRS(const std::string & /* crsDef */) {
throw UnimplementedException("isGeographicCRS unimplemented");
}
Expand Down
6 changes: 3 additions & 3 deletions src/transformations/defmodel_exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace DEFORMATON_MODEL_NAMESPACE {
/** Parsing exception. */
class ParsingException : public std::exception {
public:
ParsingException(const std::string &msg) : msg_(msg) {}
explicit ParsingException(const std::string &msg) : msg_(msg) {}
const char *what() const noexcept override;

private:
Expand All @@ -51,7 +51,7 @@ const char *ParsingException::what() const noexcept { return msg_.c_str(); }

class UnimplementedException : public std::exception {
public:
UnimplementedException(const std::string &msg) : msg_(msg) {}
explicit UnimplementedException(const std::string &msg) : msg_(msg) {}
const char *what() const noexcept override;

private:
Expand All @@ -67,7 +67,7 @@ const char *UnimplementedException::what() const noexcept {
/** Evaluator exception. */
class EvaluatorException : public std::exception {
public:
EvaluatorException(const std::string &msg) : msg_(msg) {}
explicit EvaluatorException(const std::string &msg) : msg_(msg) {}
const char *what() const noexcept override;

private:
Expand Down

0 comments on commit 9c50122

Please sign in to comment.