diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-03-06 22:40:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-06 22:40:35 +0100 |
| commit | 3af34fc1c404ab05499134fb36288c883ae1c1c9 (patch) | |
| tree | 47e78480ad55e7a83c726aec5545f7f6033e80cc /src | |
| parent | 194b13a8762dbe4f4a2db818d211bfeac557c731 (diff) | |
| parent | feeca61287d9e59c78d2f70a52bf0f5d9542757b (diff) | |
| download | PROJ-3af34fc1c404ab05499134fb36288c883ae1c1c9.tar.gz PROJ-3af34fc1c404ab05499134fb36288c883ae1c1c9.zip | |
Merge pull request #2559 from rouault/gcc11_wnonnull
Fix gcc 11 -Wnonnull warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/factory.cpp | 13 | ||||
| -rw-r--r-- | src/iso19111/operation/coordinateoperationfactory.cpp | 16 |
2 files changed, 17 insertions, 12 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 49d2a737..5da9e6e0 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -4723,12 +4723,17 @@ AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates( sourceCRSCode == targetCRSCode) { return listTmp; } + const auto sourceGeodCRS = + dynamic_cast<crs::GeodeticCRS *>(sourceCRS.get()); + const auto targetGeodCRS = + dynamic_cast<crs::GeodeticCRS *>(targetCRS.get()); + if (!sourceGeodCRS || !targetGeodCRS) { + return listTmp; + } std::string minDate; - const auto &sourceDatum = - dynamic_cast<crs::GeodeticCRS *>(sourceCRS.get())->datum(); - const auto &targetDatum = - dynamic_cast<crs::GeodeticCRS *>(targetCRS.get())->datum(); + const auto &sourceDatum = sourceGeodCRS->datum(); + const auto &targetDatum = targetGeodCRS->datum(); if (sourceDatum && sourceDatum->publicationDate().has_value() && targetDatum && targetDatum->publicationDate().has_value()) { const auto sourceDate(sourceDatum->publicationDate()->toString()); diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp index 4832c7b8..4bd68b1d 100644 --- a/src/iso19111/operation/coordinateoperationfactory.cpp +++ b/src/iso19111/operation/coordinateoperationfactory.cpp @@ -1856,14 +1856,14 @@ createBallparkGeographicOffset(const crs::CRSNNPtr &sourceCRS, accuracies.emplace_back(metadata::PositionalAccuracy::create("0")); } - if (dynamic_cast<const crs::SingleCRS *>(sourceCRS.get()) - ->coordinateSystem() - ->axisList() - .size() == 3 || - dynamic_cast<const crs::SingleCRS *>(targetCRS.get()) - ->coordinateSystem() - ->axisList() - .size() == 3) { + const auto singleSourceCRS = + dynamic_cast<const crs::SingleCRS *>(sourceCRS.get()); + const auto singleTargetCRS = + dynamic_cast<const crs::SingleCRS *>(targetCRS.get()); + if ((singleSourceCRS && + singleSourceCRS->coordinateSystem()->axisList().size() == 3) || + (singleTargetCRS && + singleTargetCRS->coordinateSystem()->axisList().size() == 3)) { return Transformation::createGeographic3DOffsets( map, sourceCRS, targetCRS, angle0, angle0, common::Length(0), accuracies); |
