Skip to content

Commit

Permalink
Fix a few Coverity Scan warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 19, 2025
1 parent e1733c3 commit c340447
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/apps/projinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,10 @@ static void suggestCompletion(const std::vector<std::string> &args) {
const auto columnPos = args.back().find(':');
if (columnPos != std::string::npos) {
const auto authName = args.back().substr(0, columnPos);
const auto codeStart = columnPos + 1 < args.back().size()
? args.back().substr(columnPos + 1)
: std::string();
const std::string codeStart =
columnPos + 1 < args.back().size()
? args.back().substr(columnPos + 1)
: std::string();
auto factory = AuthorityFactory::create(dbContext, authName);
const auto list = factory->getCRSInfoList();

Expand All @@ -1242,7 +1243,7 @@ static void suggestCompletion(const std::vector<std::string> &args) {
// If there is a single match, remove the name from the
// suggestion.
res.clear();
res.push_back(code);
res.push_back(std::move(code));
}
for (const auto &val : res) {
if (!first)
Expand Down
9 changes: 6 additions & 3 deletions src/iso19111/operation/coordinateoperationfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4253,9 +4253,12 @@ CoordinateOperationFactory::Private::createOperationsGeogToVertFromGeoid(
std::vector<metadata::PositionalAccuracyNNPtr> accuracies;
const auto &modelAccuracies =
model->coordinateOperationAccuracies();
std::vector<CoordinateOperationNNPtr> transformationsForGrid =
io::DatabaseContext::getTransformationsForGridName(
authFactory->databaseContext(), projFilename);
std::vector<CoordinateOperationNNPtr> transformationsForGrid;
if (authFactory) {
transformationsForGrid =
io::DatabaseContext::getTransformationsForGridName(
authFactory->databaseContext(), projFilename);
}

// Only select transformations whose datum of the target vertical
// CRS match the one of the target vertical CRS of interest (when
Expand Down

0 comments on commit c340447

Please sign in to comment.