[mapcode] 04/32: Fixed decoder

Stefan Fritsch sf at moszumanska.debian.org
Wed Nov 2 23:27:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

sf pushed a commit to annotated tag v1.33
in repository mapcode.

commit fce02525ca6deb75985b67c1a929fa5fd7506f45
Author: Rijn Buve <rijn at buve.nl>
Date:   Tue Aug 19 19:54:00 2014 +0200

    Fixed decoder
---
 mapcode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mapcode.c b/mapcode.c
index e226759..883da0d 100644
--- a/mapcode.c
+++ b/mapcode.c
@@ -50,7 +50,7 @@ int main(const int argc, const char** argv)
     if ((strcmp(cmd, "-d") == 0) || (strcmp(cmd, "--decode") == 0)) {
 
         // Decode: [-d | --decode] <default-country-ISO3> <mapcode> [<mapcode> ...]
-        if (argc < 3) {
+        if (argc < 4) {
             usage(appName);
             return -1;
         }
@@ -84,8 +84,8 @@ int main(const int argc, const char** argv)
             context = text2tc(argv[4], 0);
         }
         const int nrResults = coord2mc(results, lat, lon, context);
-        if (nrResults == 0) {
-            printf("error: cannot encode lat=%s, lon=%s (default country='%s')\n", argv[2], argv[3], (argc == 5) ? argv[4] : "none");
+        if (nrResults <= 0) {
+            printf("error: cannot encode lat=%s, lon=%s (default country=%d)\n", argv[2], argv[3], context);
             return -1;
         }
         for (int i = 0; i < nrResults; ++i) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapcode.git



More information about the Pkg-grass-devel mailing list