All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH obexd 1/5] Fix pulling vCard for multiple ebooks
@ 2011-07-13 22:10 Bartosz Szatkowski
  2011-07-13 22:10 ` [PATCH obexd 2/5] Fix ebook opening error handling Bartosz Szatkowski
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bartosz Szatkowski @ 2011-07-13 22:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bartosz Szatkowski

Problem occurred when there were multiple ebooks and the last one was
empty. Reported vCard number was 0 and no data was transported.
---
 plugins/phonebook-ebook.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index b51d34d..b2f16e0 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -51,7 +51,7 @@ struct query_context {
 	phonebook_entry_cb entry_cb;
 	phonebook_cache_ready_cb ready_cb;
 	EBookQuery *query;
-	int count;
+	unsigned int count;
 	GString *buf;
 	char *id;
 	unsigned queued_calls;
@@ -158,7 +158,7 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
 {
 	struct query_context *data = user_data;
 	GList *l;
-	unsigned int count = data->count, maxcount;
+	unsigned int count = 0, maxcount;
 
 	if (gerr != NULL) {
 		error("E-Book query failed: %s", gerr->message);
@@ -180,9 +180,8 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
 
 	l = g_list_nth(contacts, data->params->liststartoffset);
 
-	/* FIXME: Missing 0.vcf */
-
-	for (; l && count < maxcount; l = g_list_next(l), count++) {
+	for (; l && count + data->count < maxcount; l = g_list_next(l),
+								count++) {
 		EContact *contact = E_CONTACT(l->data);
 		EVCard *evcard = E_VCARD(contact);
 		char *vcard;
@@ -195,6 +194,8 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
 		g_free(vcard);
 	}
 
+	data->count += count;
+
 done:
 	g_list_free_full(contacts, g_object_unref);
 
@@ -202,8 +203,8 @@ done:
 
 	data->queued_calls--;
 	if (data->queued_calls == 0)
-		data->contacts_cb(data->buf->str, data->buf->len, count, 0,
-							TRUE, data->user_data);
+		data->contacts_cb(data->buf->str, data->buf->len, data->count,
+						0, TRUE, data->user_data);
 }
 
 static void ebook_entry_cb(EBook *book, const GError *gerr,
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-14 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13 22:10 [PATCH obexd 1/5] Fix pulling vCard for multiple ebooks Bartosz Szatkowski
2011-07-13 22:10 ` [PATCH obexd 2/5] Fix ebook opening error handling Bartosz Szatkowski
2011-07-13 22:10 ` [PATCH obexd 3/5] Add opening ebooks before each operation Bartosz Szatkowski
2011-07-13 22:10 ` [PATCH obexd 4/5] Fix no phone number in vCard listing Bartosz Szatkowski
2011-07-13 22:10 ` [PATCH obexd 5/5] Fix freeing buffer before transfer is complete Bartosz Szatkowski
2011-07-14 13:45 ` [PATCH obexd 1/5] Fix pulling vCard for multiple ebooks Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.