diff options
Diffstat (limited to '')
-rw-r--r-- | libcontacts_parse_contact.c | 8 | ||||
-rw-r--r-- | libcontacts_save_contact.c | 2 |
2 files changed, 5 insertions, 5 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; diff --git a/libcontacts_save_contact.c b/libcontacts_save_contact.c index 5d2fcd7..5e27b85 100644 --- a/libcontacts_save_contact.c +++ b/libcontacts_save_contact.c @@ -29,7 +29,7 @@ libcontacts_save_contact(struct libcontacts_contact *contact, const struct passw goto fail; for (p = 0; contact->id[p]; p++) { if (isalpha(contact->id[p])) - contact->id[p] = tolower(contact->id[p]); + contact->id[p] = (char)tolower(contact->id[p]); else contact->id[p] = '-'; } |