From: Jim Evins Date: Fri, 28 Oct 2005 01:10:56 +0000 (+0000) Subject: 2005-10-27 Jim Evins X-Git-Tag: glabels-2_3_0~397 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=71e143d2eec8f00cc33b766b6e5dabdf117425ce;p=glabels 2005-10-27 Jim Evins * src/merge-evolution.c: (gl_merge_evolution_get_record): * src/merge-vcard.c: (gl_merge_vcard_get_record), (parse_next_vcard): Additional cleanup of EDS and vcard backends. Provided by Austin Henry . git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@558 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index ce58c163..9965d0ec 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,11 @@ +2005-10-27 Jim Evins + + * src/merge-evolution.c: (gl_merge_evolution_get_record): + * src/merge-vcard.c: (gl_merge_vcard_get_record), + (parse_next_vcard): + Additional cleanup of EDS and vcard backends. Provided by + Austin Henry . + 2005-10-24 Jim Evins * AUTHORS: diff --git a/glabels2/src/merge-evolution.c b/glabels2/src/merge-evolution.c index 77d73de3..2a63b233 100644 --- a/glabels2/src/merge-evolution.c +++ b/glabels2/src/merge-evolution.c @@ -431,28 +431,28 @@ gl_merge_evolution_get_record (glMerge *merge) /* get the record key */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("record_key"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_FILE_AS)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_FILE_AS)); record->field_list = g_list_append (record->field_list, field); /* get the full name */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("full_name"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_FULL_NAME)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_FULL_NAME)); record->field_list = g_list_append (record->field_list, field); /* get the home address */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("home_address"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_ADDRESS_LABEL_HOME)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_ADDRESS_LABEL_HOME)); record->field_list = g_list_append (record->field_list, field); /* get the work address */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("work_address"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_ADDRESS_LABEL_WORK)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_ADDRESS_LABEL_WORK)); record->field_list = g_list_append (record->field_list, field); diff --git a/glabels2/src/merge-vcard.c b/glabels2/src/merge-vcard.c index 65834dd5..490d29a7 100644 --- a/glabels2/src/merge-vcard.c +++ b/glabels2/src/merge-vcard.c @@ -301,7 +301,7 @@ gl_merge_vcard_get_record (glMerge *merge) merge_vcard = GL_MERGE_VCARD (merge); vcard = parse_next_vcard(merge_vcard->private->fp); - if (vcard[0] == '\0') { + if (vcard == NULL || vcard[0] == '\0') { return NULL; /* EOF */ } contact = e_contact_new_from_vcard(vcard); @@ -319,21 +319,21 @@ gl_merge_vcard_get_record (glMerge *merge) /* get the full name */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("full_name"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_FULL_NAME)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_FULL_NAME)); record->field_list = g_list_append (record->field_list, field); /* get the home address */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("home_address"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_ADDRESS_LABEL_HOME)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_ADDRESS_LABEL_HOME)); record->field_list = g_list_append (record->field_list, field); /* get the work address */ field = g_new0 (glMergeField, 1); field->key = g_strdup ("work_address"); - field->value = g_strdup (e_contact_get(contact, E_CONTACT_ADDRESS_LABEL_WORK)); + field->value = g_strdup (e_contact_get_const(contact, E_CONTACT_ADDRESS_LABEL_WORK)); record->field_list = g_list_append (record->field_list, field); @@ -374,6 +374,11 @@ parse_next_vcard (FILE *fp) char line[512]; int size = 2048, cursize = 0; + /* if no source has been set up, don't try to read from the file */ + if (!fp) { + return NULL; + } + vcard = g_malloc0(size); while (fgets(line, sizeof(line), fp) && found_end == FALSE) {