diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2020-01-26 21:36:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-26 21:36:19 +0100 |
| commit | 66013a0202ae77ea6c5ae0e0f0c79f5a0edc5622 (patch) | |
| tree | 00bc3e8ca1db1d8d9013e627073b5c3c44f00983 /src | |
| parent | 0f22959cb2f052fd55e2b8b83289d9eca7b1c71f (diff) | |
| parent | 9ae11763257da599388f522364c6be2d044d1d87 (diff) | |
| download | PROJ-66013a0202ae77ea6c5ae0e0f0c79f5a0edc5622.tar.gz PROJ-66013a0202ae77ea6c5ae0e0f0c79f5a0edc5622.zip | |
Merge pull request #1886 from rouault/cppcheck_1_90_happyness
Few improvements to make cppcheck 1.90 happier
Diffstat (limited to 'src')
| -rw-r--r-- | src/init.cpp | 22 | ||||
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 2 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 4 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/init.cpp b/src/init.cpp index 19fcf47b..c1683285 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -48,25 +48,23 @@ static paralist *string_to_paralist (PJ_CONTEXT *ctx, char *definition) { Convert a string (presumably originating from get_init_string) to a paralist. ***************************************************************************************/ const char *c = definition; - paralist *first = nullptr, *next = nullptr; + paralist *first = nullptr, *last = nullptr; while (*c) { /* Keep a handle to the start of the list, so we have something to return */ - if (nullptr==first) - first = next = pj_mkparam_ws (c, &c); - else - next = next->next = pj_mkparam_ws (c, &c); - if (nullptr==next) { + auto param = pj_mkparam_ws (c, &c); + if (nullptr==param) { pj_dealloc_params (ctx, first, ENOMEM); return nullptr; } + if (nullptr==last) { + first = param; + } + else { + last->next = param; + } + last = param; } - - if( next == nullptr ) - return nullptr; - - /* Terminate list and return */ - next->next = nullptr; return first; } diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index a8c7c902..6eef6de8 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -6238,7 +6238,7 @@ void Conversion::_exportToPROJString( if (!param->proj_name) { continue; } - const auto value = + const auto &value = parameterValueMeasure(param->wkt2_name, param->epsg_code); double valueConverted = 0; if (value == nullMeasure) { diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 0fc11f6f..e4b159bd 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -3526,7 +3526,7 @@ ConversionNNPtr WKTParser::Private::buildProjectionStandard( EPSG_CODE_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN); propertiesParameter.set(Identifier::CODESPACE_KEY, Identifier::EPSG); - } else if (paramMapping) { + } else if (mapping && paramMapping) { for (size_t idx = 0; mapping->params[idx] != nullptr; ++idx) { if (mapping->params[idx] == paramMapping) { foundParameters[idx] = true; @@ -4542,7 +4542,7 @@ class JSONParser { static Measure getMeasure(const json &j); IdentifierNNPtr buildId(const json &j, bool removeInverseOf); - ObjectDomainPtr buildObjectDomain(const json &j); + static ObjectDomainPtr buildObjectDomain(const json &j); PropertyMap buildProperties(const json &j, bool removeInverseOf = false); GeographicCRSNNPtr buildGeographicCRS(const json &j); |
