linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd] Fix pulling phonebook size
@ 2011-07-22 20:58 Bartosz Szatkowski
  2011-07-26 10:47 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Szatkowski @ 2011-07-22 20:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bartosz Szatkowski

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

diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index 9cb32c3..91d0c0b 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -180,7 +180,7 @@ 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;
 	}
 
-- 
1.7.6


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

* Re: [PATCH obexd] Fix pulling phonebook size
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2011-07-26 10:47 UTC (permalink / raw)
  To: Bartosz Szatkowski; +Cc: linux-bluetooth

Hi Bartosz,

On Fri, Jul 22, 2011, Bartosz Szatkowski wrote:
> ---
>  plugins/phonebook-ebook.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
> index 9cb32c3..91d0c0b 100644
> --- a/plugins/phonebook-ebook.c
> +++ b/plugins/phonebook-ebook.c
> @@ -180,7 +180,7 @@ 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;
>  	}

Since you're doing this I suppose it also makes sense to move the
initialization of the count variable (to 0) to the initialization part
of the for loop in the same function.

Johan

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

* [PATCH obexd] Fix pulling phonebook size
  2011-07-26 10:47 ` Johan Hedberg
@ 2011-07-26 19:21   ` Bartosz Szatkowski
  2011-07-26 19:46     ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Szatkowski @ 2011-07-26 19:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bartosz Szatkowski

---
 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


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

* Re: [PATCH obexd] Fix pulling phonebook size
  2011-07-26 19:21   ` Bartosz Szatkowski
@ 2011-07-26 19:46     ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2011-07-26 19:46 UTC (permalink / raw)
  To: Bartosz Szatkowski; +Cc: linux-bluetooth

Hi Bartosz,

On Tue, Jul 26, 2011, Bartosz Szatkowski wrote:
> ---
>  plugins/phonebook-ebook.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2011-07-26 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-07-26 19:46     ` Johan Hedberg

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).