diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-03 10:33:06 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-03 10:33:06 +0200 |
commit | 9fca48f29e571cd0c2c8e189068ea9469532de6c (patch) | |
tree | 5230df8d8e7f4fd0d59b79f96c42ecb901b5a327 /libcontacts_parse_contact.c | |
parent | m (diff) | |
download | libcontacts-9fca48f29e571cd0c2c8e189068ea9469532de6c.tar.gz libcontacts-9fca48f29e571cd0c2c8e189068ea9469532de6c.tar.bz2 libcontacts-9fca48f29e571cd0c2c8e189068ea9469532de6c.tar.xz |
Fix bugs and warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libcontacts_parse_contact.c')
-rw-r--r-- | libcontacts_parse_contact.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libcontacts_parse_contact.c b/libcontacts_parse_contact.c index df31559..f8de012 100644 --- a/libcontacts_parse_contact.c +++ b/libcontacts_parse_contact.c @@ -6,7 +6,7 @@ static time_t gettime(const char *data) { time_t ret = 0; - if (*data > '1' || '9' > *data) + if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { if (ret > (TIME_MAX - (*data & 15)) / 10) @@ -22,7 +22,7 @@ static unsigned int getposuint(const char *data) { unsigned int ret = 0; - if (*data > '1' || '9' > *data) + if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { if (ret > (UINT_MAX - (*data & 15)) / 10) @@ -38,12 +38,12 @@ static unsigned char getposuchar(const char *data) { unsigned char ret = 0; - if (*data > '1' || '9' > *data) + if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { if (ret > (UCHAR_MAX - (*data & 15)) / 10) return 0; - ret = ret * 10 + (*data & 15); + ret = (unsigned char)(ret * 10 + (*data & 15)); } if (*data) return 0; |