aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-07-27 12:05:11 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2017-08-08 12:54:21 +0200
commit7c9ce960d70a92cbace3c4030f4faabcf378ef42 (patch)
tree2518dd842f244deaf4a622b89994b121912f15d9
parent5090f5a18d0c6a0494fe92268112613fef9be0e0 (diff)
Fixes of checking digits
-rw-r--r--src/anetz/stations.c16
-rw-r--r--src/bnetz/stations.c16
-rw-r--r--src/nmt/nmt.c2
3 files changed, 17 insertions, 17 deletions
diff --git a/src/anetz/stations.c b/src/anetz/stations.c
index 1b5bc50..9908755 100644
--- a/src/anetz/stations.c
+++ b/src/anetz/stations.c
@@ -151,15 +151,15 @@ double lat_from_coordinates(const char *string)
{
if (strlen(string) != 11)
abort();
- if (string[0] < '0' && string[0] > '9')
+ if (string[0] < '0' || string[0] > '9')
abort();
- if (string[1] < '0' && string[1] > '9')
+ if (string[1] < '0' || string[1] > '9')
abort();
if (string[2] != 'o')
abort();
- if (string[3] < '0' && string[3] > '9')
+ if (string[3] < '0' || string[3] > '9')
abort();
- if (string[4] < '0' && string[4] > '9')
+ if (string[4] < '0' || string[4] > '9')
abort();
return (double)(string[0] - '0') * 10.0 +
@@ -172,15 +172,15 @@ double lon_from_coordinates(const char *string)
{
if (strlen(string) != 11)
abort();
- if (string[6] < '0' && string[6] > '9')
+ if (string[6] < '0' || string[6] > '9')
abort();
- if (string[7] < '0' && string[7] > '9')
+ if (string[7] < '0' || string[7] > '9')
abort();
if (string[8] != 'o')
abort();
- if (string[9] < '0' && string[9] > '9')
+ if (string[9] < '0' || string[9] > '9')
abort();
- if (string[10] < '0' && string[10] > '9')
+ if (string[10] < '0' || string[10] > '9')
abort();
return (double)(string[6] - '0') * 10.0 +
diff --git a/src/bnetz/stations.c b/src/bnetz/stations.c
index 10b0ad5..a4a4483 100644
--- a/src/bnetz/stations.c
+++ b/src/bnetz/stations.c
@@ -189,15 +189,15 @@ double lat_from_coordinates(const char *string)
{
if (strlen(string) != 11)
abort();
- if (string[0] < '0' && string[0] > '9')
+ if (string[0] < '0' || string[0] > '9')
abort();
- if (string[1] < '0' && string[1] > '9')
+ if (string[1] < '0' || string[1] > '9')
abort();
if (string[2] != 'o')
abort();
- if (string[3] < '0' && string[3] > '9')
+ if (string[3] < '0' || string[3] > '9')
abort();
- if (string[4] < '0' && string[4] > '9')
+ if (string[4] < '0' || string[4] > '9')
abort();
return (double)(string[0] - '0') * 10.0 +
@@ -210,15 +210,15 @@ double lon_from_coordinates(const char *string)
{
if (strlen(string) != 11)
abort();
- if (string[6] < '0' && string[6] > '9')
+ if (string[6] < '0' || string[6] > '9')
abort();
- if (string[7] < '0' && string[7] > '9')
+ if (string[7] < '0' || string[7] > '9')
abort();
if (string[8] != 'o')
abort();
- if (string[9] < '0' && string[9] > '9')
+ if (string[9] < '0' || string[9] > '9')
abort();
- if (string[10] < '0' && string[10] > '9')
+ if (string[10] < '0' || string[10] > '9')
abort();
return (double)(string[6] - '0') * 10.0 +
diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c
index 847be72..1ec6d08 100644
--- a/src/nmt/nmt.c
+++ b/src/nmt/nmt.c
@@ -232,7 +232,7 @@ static int dialstring2number(const char *dialstring, char *ms_country, char *ms_
PDEBUG(DNMT, DEBUG_NOTICE, "Wrong number of digits, use 7 digits: ZXXXXXX (Z=country, X=mobile number)\n");
return -1;
}
- if (dialstring[0] < '0' && dialstring[0] > '9') {
+ if (dialstring[0] < '0' || dialstring[0] > '9') {
PDEBUG(DNMT, DEBUG_NOTICE, "Invalid country digit (first digit) of dial string\n");
return -1;
}