Skip to content

Commit 17569c7

Browse files
committed
Fixed encoder args
1 parent 1d825dc commit 17569c7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mapcode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ int main(const int argc, const char** argv)
7171
else if ((strcmp(cmd, "-e") == 0) || (strcmp(cmd, "--encode") == 0)) {
7272

7373
// Encode: [-e | --encode] <lat:-90..90> <lon:-180..180> [country-ISO3]>
74-
if ((argc != 3) && (argc != 4)) {
74+
if ((argc != 4) && (argc != 5)) {
7575
usage(appName);
7676
return -1;
7777
}
78-
const double lat = atof(argv[1]);
79-
const double lon = atof(argv[2]);
78+
const double lat = atof(argv[2]);
79+
const double lon = atof(argv[3]);
8080

8181
const char* results[32];
8282
int context = 0;
8383
if (argc == 4) {
84-
context = text2tc(argv[3], 0);
84+
context = text2tc(argv[4], 0);
8585
}
8686
const int nrResults = coord2mc(results, lat, lon, context);
8787
if (nrResults == 0) {
88-
printf("error: cannot encode lat=%s, lon=%s (default country='%s')\n", argv[1], argv[2], (argc == 4) ? argv[3] : "none");
88+
printf("error: cannot encode lat=%s, lon=%s (default country='%s')\n", argv[2], argv[3], (argc == 5) ? argv[4] : "none");
8989
return -1;
9090
}
9191
for (int i = 0; i < nrResults; ++i) {

0 commit comments

Comments
 (0)