diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-04 03:31:17 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-04 03:31:17 +0200 |
commit | ddce3c7b8adf084ca59e2c079b23ea6f9f56b992 (patch) | |
tree | c8883d3dd3cf51ed9402d30626d5533e2dbf4273 /libcontacts_parse_contact.c | |
parent | sync on save before rename, and check for errors on close (diff) | |
download | libcontacts-ddce3c7b8adf084ca59e2c079b23ea6f9f56b992.tar.gz libcontacts-ddce3c7b8adf084ca59e2c079b23ea6f9f56b992.tar.bz2 libcontacts-ddce3c7b8adf084ca59e2c079b23ea6f9f56b992.tar.xz |
Fix birthday support
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libcontacts_parse_contact.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libcontacts_parse_contact.c b/libcontacts_parse_contact.c index 79dc579..1c2b336 100644 --- a/libcontacts_parse_contact.c +++ b/libcontacts_parse_contact.c @@ -7,6 +7,8 @@ static time_t gettime(const char *data) { time_t ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -24,6 +26,8 @@ static unsigned int getposuint(const char *data) { unsigned int ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -41,6 +45,8 @@ static unsigned char getposuchar(const char *data) { unsigned char ret = 0; + while (*data == ' ' || *data == '\t') data++; + data = &strchr(data, ' ')[1]; if ('1' > *data || *data > '9') return 0; for (; isdigit(*data); data++) { @@ -419,7 +425,7 @@ libcontacts_parse_contact(char *data, struct libcontacts_contact *contact) break; } else if (!strcmp(p, "BIRTH:") && !contact->birthday) { - contact->birthday = malloc(sizeof(*contact->birthday)); + contact->birthday = calloc(1, sizeof(*contact->birthday)); if (!contact->birthday) goto fail; state = 9; |