linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Szatkowski <bulislaw@linux.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bartosz Szatkowski <bulislaw@linux.com>
Subject: [PATCH obexd] Fix pulling phonebook size
Date: Tue, 26 Jul 2011 21:21:06 +0200	[thread overview]
Message-ID: <1311708066-6848-1-git-send-email-bulislaw@linux.com> (raw)
In-Reply-To: <20110726104752.GD5470@dell>

---
 plugins/phonebook-ebook.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index 9cb32c3..683037a 100644
--- a/plugins/phonebook-ebook.c
+++ b/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;
-- 
1.7.6


  reply	other threads:[~2011-07-26 19:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 20:58 [PATCH obexd] Fix pulling phonebook size Bartosz Szatkowski
2011-07-26 10:47 ` Johan Hedberg
2011-07-26 19:21   ` Bartosz Szatkowski [this message]
2011-07-26 19:46     ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311708066-6848-1-git-send-email-bulislaw@linux.com \
    --to=bulislaw@linux.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).