diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-10-25 19:18:06 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-10-25 19:18:06 +0100 |
| commit | 6476108774c8c947f0197ec1acff781f17e6edde (patch) | |
| tree | c6115998e4da123021825e6938c283fd17c90ceb | |
| parent | 9f2500e74e6141469b1ca3134346ac12e7d7dbb4 (diff) | |
| download | PROJ-6476108774c8c947f0197ec1acff781f17e6edde.tar.gz PROJ-6476108774c8c947f0197ec1acff781f17e6edde.zip | |
Fix issues spotted by cppcheck
| -rw-r--r-- | src/4D_api.cpp | 4 | ||||
| -rw-r--r-- | src/iso19111/c_api.cpp | 3 | ||||
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 17 |
3 files changed, 9 insertions, 15 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 0c26840d..86c0e071 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -977,9 +977,7 @@ static void reproject_bbox(PJ* pjGeogToCrs, maxx = -maxx; maxy = -maxy; - std::vector<double> x, y; - x.resize(21 * 4); - y.resize(21 * 4); + std::vector<double> x(21 * 4), y(21 * 4); for( int j = 0; j <= 20; j++ ) { x[j] = west_lon + j * (east_lon - west_lon) / 20; diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 8d77437a..7582f37f 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -1032,7 +1032,7 @@ PJ_OBJ_LIST *proj_create_from_name(PJ_CONTEXT *ctx, const char *auth_name, size_t limitResultCount, const char *const *options) { SANITIZE_CTX(ctx); - if (!searchedName || (types != nullptr && typesCount <= 0) || + if (!searchedName || (types != nullptr && typesCount == 0) || (types == nullptr && typesCount > 0)) { proj_log_error(ctx, __FUNCTION__, "invalid input"); return nullptr; @@ -7871,6 +7871,7 @@ proj_create_operations(PJ_CONTEXT *ctx, const PJ *source_crs, * @since 7.1 */ int proj_get_suggested_operation(PJ_CONTEXT *ctx, PJ_OBJ_LIST *operations, + // cppcheck-suppress passedByValue PJ_DIRECTION direction, PJ_COORD coord) { SANITIZE_CTX(ctx); auto opList = dynamic_cast<PJ_OPERATION_LIST *>(operations); diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 19586a59..be15b3e0 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -10221,15 +10221,10 @@ ConcatenatedOperationNNPtr ConcatenatedOperation::create( auto subOpInterpCRS = operationsIn[i]->interpolationCRS(); if (interpolationCRS == nullptr) interpolationCRS = subOpInterpCRS; - else if ((subOpInterpCRS == nullptr && - interpolationCRS != nullptr) || - (subOpInterpCRS != nullptr && - interpolationCRS == nullptr) || - (subOpInterpCRS != nullptr && - interpolationCRS != nullptr && - !(subOpInterpCRS->isEquivalentTo( - interpolationCRS.get(), - util::IComparable::Criterion::EQUIVALENT)))) { + else if (subOpInterpCRS == nullptr || + !(subOpInterpCRS->isEquivalentTo( + interpolationCRS.get(), + util::IComparable::Criterion::EQUIVALENT))) { interpolationCRS = nullptr; interpolationCRSValid = false; } @@ -10604,7 +10599,7 @@ void ConcatenatedOperation::_exportToWKT(io::WKTFormatter *formatter) const { !identifiers().empty()); formatter->addQuotedString(nameStr()); - if (isWKT2 && formatter->use2019Keywords()) { + if (formatter->use2019Keywords()) { const auto &version = operationVersion(); if (version.has_value()) { formatter->startNode(io::WKTConstants::VERSION, false); @@ -14463,7 +14458,7 @@ void CoordinateOperationFactory::Private::createOperationsBoundToGeog( hubSrcGeog->coordinateSystem()->axisList(); const auto &targetAxisList = geogDst->coordinateSystem()->axisList(); - if (hubAxisList.size() == 3 && hubAxisList.size() == 3 && + if (hubAxisList.size() == 3 && targetAxisList.size() == 3 && !hubAxisList[2]->_isEquivalentTo( targetAxisList[2].get(), util::IComparable::Criterion::EQUIVALENT)) { |
