diff options
author | Bartosz Szatkowski <bulislaw@linux.com> | 2011-07-26 21:21:06 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:48:40 +0100 |
commit | 11ba40a65fb44e9cf0a884d96de1eb1a435c19a5 (patch) | |
tree | a59bac94c3fb686d22e1d2c5bc841012dbfe2e47 /obexd/plugins/phonebook-ebook.c | |
parent | 6d3d6bdaf0b638b24685884e62140c4aa63b954e (diff) |
obexd: Fix pulling phonebook size
Diffstat (limited to 'obexd/plugins/phonebook-ebook.c')
-rw-r--r-- | obexd/plugins/phonebook-ebook.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c index 9cb32c375..683037ab2 100644 --- a/obexd/plugins/phonebook-ebook.c +++ b/obexd/plugins/phonebook-ebook.c @@ -164,7 +164,7 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, { struct query_context *data = user_data; GList *l; - unsigned int count = 0, maxcount; + unsigned int count, maxcount; if (gerr != NULL) { error("E-Book query failed: %s", gerr->message); @@ -180,13 +180,13 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, */ maxcount = data->params->maxlistcount; if (maxcount == 0) { - count += g_list_length(contacts); + data->count += g_list_length(contacts); goto done; } l = g_list_nth(contacts, data->params->liststartoffset); - for (; l && count + data->count < maxcount; l = g_list_next(l), + for (count = 0; l && count + data->count < maxcount; l = g_list_next(l), count++) { EContact *contact = E_CONTACT(l->data); EVCard *evcard = E_VCARD(contact); @@ -200,13 +200,13 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, g_free(vcard); } + DBG("collected %d vcards", count); + data->count += count; done: g_list_free_full(contacts, g_object_unref); - DBG("collected %d vcards", count); - data->queued_calls--; if (data->queued_calls == 0) { GString *buf = data->buf; |