aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-04 03:31:17 +0200
committerMattias Andrée <maandree@kth.se>2021-04-04 03:31:17 +0200
commitddce3c7b8adf084ca59e2c079b23ea6f9f56b992 (patch)
treec8883d3dd3cf51ed9402d30626d5533e2dbf4273
parentsync on save before rename, and check for errors on close (diff)
downloadlibcontacts-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_birthday_destroy.c2
-rw-r--r--libcontacts_parse_contact.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/libcontacts_birthday_destroy.c b/libcontacts_birthday_destroy.c
index c2c1f95..8935b76 100644
--- a/libcontacts_birthday_destroy.c
+++ b/libcontacts_birthday_destroy.c
@@ -5,5 +5,5 @@
void
libcontacts_birthday_destroy(struct libcontacts_birthday *this)
{
- (void) this;
+ DESTROY_ALL_STRINGS(this->unrecognised_data);
}
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;