Merge lp:~rodrigo-moya/evolution-couchdb/birth-date-format into lp:evolution-couchdb

Proposed by Rodrigo Moya
Status: Merged
Approved by: Nicola Larosa
Approved revision: 94
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/evolution-couchdb/birth-date-format
Merge into: lp:evolution-couchdb
Diff against target: 35 lines (+10/-6)
1 file modified
addressbook/e-book-backend-couchdb.c (+10/-6)
To merge this branch: bzr merge lp:~rodrigo-moya/evolution-couchdb/birth-date-format
Reviewer Review Type Date Requested Status
Nicola Larosa (community) Approve
John O'Brien (community) Approve
Review via email: mp+14536@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Use e_contact_get for dates, since e_contact_get_const just works for strings, and make sure we never set empty dates on contact records

Revision history for this message
John O'Brien (jdobrien) wrote :

looks good

review: Approve
Revision history for this message
Nicola Larosa (teknico) wrote :

Yeah, good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addressbook/e-book-backend-couchdb.c'
2--- addressbook/e-book-backend-couchdb.c 2009-11-04 22:07:53 +0000
3+++ addressbook/e-book-backend-couchdb.c 2009-11-06 09:55:18 +0000
4@@ -787,21 +787,25 @@
5 }
6
7 /* birth date */
8- dt = (EContactDate *) e_contact_get_const (contact, E_CONTACT_BIRTH_DATE);
9+ dt = (EContactDate *) e_contact_get (contact, E_CONTACT_BIRTH_DATE);
10 if (dt) {
11 char *dt_str = e_contact_date_to_string (dt);
12- couchdb_document_contact_set_birth_date (document, (const char *) dt_str);
13+ if (dt_str != NULL) {
14+ couchdb_document_contact_set_birth_date (document, (const char *) dt_str);
15
16- g_free (dt_str);
17+ g_free (dt_str);
18+ }
19 }
20
21 /* wedding date */
22- dt = (EContactDate *) e_contact_get_const (contact, E_CONTACT_ANNIVERSARY);
23+ dt = (EContactDate *) e_contact_get (contact, E_CONTACT_ANNIVERSARY);
24 if (dt) {
25 char *dt_str = e_contact_date_to_string (dt);
26- couchdb_document_contact_set_wedding_date (document, (const char *) dt_str);
27+ if (dt_str != NULL) {
28+ couchdb_document_contact_set_wedding_date (document, (const char *) dt_str);
29
30- g_free (dt_str);
31+ g_free (dt_str);
32+ }
33 }
34
35 /* application annotations */

Subscribers

People subscribed via source and target branches