From 58d59c3617c3046509b43bc9716f560cd8cea8b9 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Mar 2021 23:28:16 +0100 Subject: cct: remove useless nullptr checking (CID 314822) --- src/apps/cct.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/apps') 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 -- cgit v1.2.3 From 9093dc498ed984c6f54adecd40fd1e702621de39 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Mar 2021 23:30:29 +0100 Subject: cs2cs: catch exception on bad value for --accuracy (CID 314818) --- src/apps/cs2cs.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/apps') 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; -- cgit v1.2.3 From 7e4c94f5fdc309c29fe29748996b6bf0036e0ea7 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Mar 2021 23:31:48 +0100 Subject: gie.cpp: use correct type in error message (CID 314813) --- src/apps/gie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/apps') 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(F->lineno) ); return another_failing_failure (); } -- cgit v1.2.3 From ecd5a542c1eb760a8570d45b01d395e658d22a88 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Mar 2021 23:34:12 +0100 Subject: projinfo: catch exception on bad value for --accuracy (CID 314810) --- src/apps/projinfo.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/apps') 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]; -- cgit v1.2.3