aboutsummaryrefslogtreecommitdiff
path: root/src/apps
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-03-07 11:57:55 +0100
committerGitHub <noreply@github.com>2021-03-07 11:57:55 +0100
commit4cc4e038bc9ac868156884f58b02d89849962f08 (patch)
tree6402b7c11f07f3cc1aa06680a98b5935cc96872b /src/apps
parent5b9d009293db4021b57a4949f467f2dd1081870a (diff)
parente3b0dda249ad58ed6cf0f7ed44924659b9fee50f (diff)
downloadPROJ-4cc4e038bc9ac868156884f58b02d89849962f08.tar.gz
PROJ-4cc4e038bc9ac868156884f58b02d89849962f08.zip
Merge pull request #2560 from rouault/coverityscan_fixes
Several fixes/improvements spotted by CoverityScan
Diffstat (limited to 'src/apps')
-rw-r--r--src/apps/cct.cpp2
-rw-r--r--src/apps/cs2cs.cpp8
-rw-r--r--src/apps/gie.cpp2
-rw-r--r--src/apps/projinfo.cpp8
4 files changed, 16 insertions, 4 deletions
diff --git a/src/apps/cct.cpp b/src/apps/cct.cpp
index 4f21f10a..ca62c570 100644
--- a/src/apps/cct.cpp
+++ b/src/apps/cct.cpp
@@ -455,7 +455,7 @@ int main(int argc, char **argv) {
size_t len = strlen(comment);
if (len >= 1)
comment[len - 1] = '\0';
- comment_delimiter = (comment && *comment) ? whitespace : blank_comment;
+ comment_delimiter = *comment ? whitespace : blank_comment;
/* Time to print the result */
/* use same arguments to printf format string for both radians and
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp
index 5542a282..19f924d4 100644
--- a/src/apps/cs2cs.cpp
+++ b/src/apps/cs2cs.cpp
@@ -422,7 +422,13 @@ int main(int argc, char **argv) {
emess(1, "missing argument for --accuracy");
std::exit(1);
}
- accuracy = c_locale_stod(*argv);
+ try {
+ accuracy = c_locale_stod(*argv);
+ } catch (const std::exception &e) {
+ std::cerr << "Invalid value for option --accuracy: "
+ << e.what() << std::endl;
+ std::exit(1);
+ }
}
else if (strcmp(*argv, "--authority") == 0 ) {
++argv;
diff --git a/src/apps/gie.cpp b/src/apps/gie.cpp
index 95c7da34..07c06dd9 100644
--- a/src/apps/gie.cpp
+++ b/src/apps/gie.cpp
@@ -958,7 +958,7 @@ Tell GIE what to expect, when transforming the ACCEPTed input
err_const_from_errno(proj_errno(T.P)),
proj_errno (T.P),
expect_failure_with_errno,
- F->lineno
+ static_cast<int>(F->lineno)
);
return another_failing_failure ();
}
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp
index 8c266e94..71830f00 100644
--- a/src/apps/projinfo.cpp
+++ b/src/apps/projinfo.cpp
@@ -942,7 +942,13 @@ int main(int argc, char **argv) {
}
} else if (arg == "--accuracy" && i + 1 < argc) {
i++;
- minimumAccuracy = c_locale_stod(argv[i]);
+ try {
+ minimumAccuracy = c_locale_stod(argv[i]);
+ } catch (const std::exception &e) {
+ std::cerr << "Invalid value for option --accuracy: " << e.what()
+ << std::endl;
+ usage();
+ }
} else if (arg == "--area" && i + 1 < argc) {
i++;
area = argv[i];