aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/factory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-03-06 22:21:57 +0100
committerEven Rouault <even.rouault@spatialys.com>2021-03-06 22:40:46 +0100
commit4075266be0c074077847e8dfd3de96decfdfae14 (patch)
treef52dfffb96f78854fcfb5cab3148ff236a6acd59 /src/iso19111/factory.cpp
parent6f1a3c4648bf06862dca0b3725cbb3b7ee0284e3 (diff)
downloadPROJ-4075266be0c074077847e8dfd3de96decfdfae14.tar.gz
PROJ-4075266be0c074077847e8dfd3de96decfdfae14.zip
Fix gcc 11 -Wnonnull warnings
``` /proj-8.0.0/src/iso19111/operation/coordinateoperationfactory.cpp: In function 'osgeo::proj::operation::TransformationNNPtr osgeo::proj::operation::createBallparkGeographicOffset(const CRSNNPtr&, const CRSNNPtr&, const DatabaseContextPtr&)': /proj-8.0.0/src/iso19111/operation/coordinateoperationfactory.cpp:1860:36: warning: 'this' pointer is null [-Wnonnull] 1860 | ->coordinateSystem() | ^ In file included from /proj-8.0.0/src/iso19111/operation/coordinateoperationfactory.cpp:35: /proj-8.0.0/include/proj/crs.hpp:196:47: note: in a call to non-static member function 'const CoordinateSystemNNPtr& osgeo::proj::crs::SingleCRS::coordinateSystem() const' 196 | PROJ_DLL const cs::CoordinateSystemNNPtr &coordinateSystem() PROJ_PURE_DECL; | ^~~~~~~~~~~~~~~~ /proj-8.0.0/src/iso19111/operation/coordinateoperationfactory.cpp:1864:36: warning: 'this' pointer is null [-Wnonnull] 1864 | ->coordinateSystem() | ^ In file included from /proj-8.0.0/src/iso19111/operation/coordinateoperationfactory.cpp:35: /proj-8.0.0/include/proj/crs.hpp:196:47: note: in a call to non-static member function 'const CoordinateSystemNNPtr& osgeo::proj::crs::SingleCRS::coordinateSystem() const' 196 | PROJ_DLL const cs::CoordinateSystemNNPtr &coordinateSystem() PROJ_PURE_DECL; | ^~~~~~~~~~~~~~~~ /proj-8.0.0/src/iso19111/factory.cpp: In member function 'std::vector<dropbox::oxygen::nn<std::shared_ptr<osgeo::proj::operation::CoordinateOperation> > > osgeo::proj::io::AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates(const CRSNNPtr&, const string&, const string&, const CRSNNPtr&, const string&, const string&, bool, bool, bool, bool, const std::vector<std::__cxx11::basic_string<char> >&, const ExtentPtr&, const ExtentPtr&) const': /proj-8.0.0/src/iso19111/factory.cpp:4724:66: warning: 'this' pointer is null [-Wnonnull] 4724 | dynamic_cast<crs::GeodeticCRS *>(sourceCRS.get())->datum(); | ^ In file included from /proj-8.0.0/src/iso19111/factory.cpp:36: /proj-8.0.0/include/proj/crs.hpp:254:54: note: in a call to non-static member function 'const GeodeticReferenceFramePtr& osgeo::proj::crs::GeodeticCRS::datum() const' 254 | PROJ_DLL const datum::GeodeticReferenceFramePtr &datum() PROJ_PURE_DECL; | ^~~~~ /proj-8.0.0/src/iso19111/factory.cpp:4726:66: warning: 'this' pointer is null [-Wnonnull] 4726 | dynamic_cast<crs::GeodeticCRS *>(targetCRS.get())->datum(); | ^ In file included from /proj-8.0.0/src/iso19111/factory.cpp:36: /proj-8.0.0/include/proj/crs.hpp:254:54: note: in a call to non-static member function 'const GeodeticReferenceFramePtr& osgeo::proj::crs::GeodeticCRS::datum() const' 254 | PROJ_DLL const datum::GeodeticReferenceFramePtr &datum() PROJ_PURE_DECL; | ^~~~~ ```
Diffstat (limited to 'src/iso19111/factory.cpp')
-rw-r--r--src/iso19111/factory.cpp13
1 files changed, 9 insertions, 4 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());