All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gatchat: fix to number parsing when number is omitted
@ 2011-03-09  7:27 Paavo Leinonen
  2011-03-09 22:03 ` Denis Kenzior
  2011-03-11 12:25 ` [PATCH] atmodem: fix PB reading when fields are omitted Paavo Leinonen
  0 siblings, 2 replies; 4+ messages in thread
From: Paavo Leinonen @ 2011-03-09  7:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

Line position index must be updated the number field is empty. Otherwise
we will read same field again in subsequent calls.
---

Hi,

While testing SIM Phonebook we noticed that Email addresses stored to SIM PB
were not properly parsed by oFono. Root cause for this was 
g_at_result_iter_next_number which did not update iterator's line_pos
attribute when number was missing. As a result, wrong fields were 
read when parsing email field (among others).

Entry was following:

+CPBR: 1,"12356789*#98#*",129,"Esko M\303\226rk\303\266",,,,,"M\303\266lkky","longandhardemailaddress(a)huhhuhjuu.mobi"

Br,
Paavo

 gatchat/gatresult.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gatchat/gatresult.c b/gatchat/gatresult.c
index f992486..fb9f4d5 100644
--- a/gatchat/gatresult.c
+++ b/gatchat/gatresult.c
@@ -281,11 +281,11 @@ gboolean g_at_result_iter_next_number(GAtResultIter *iter, gint *number)
 		end += 1;
 	}
 
+	iter->line_pos = skip_to_next_field(line, end, len);
+
 	if (pos == end)
 		return FALSE;
 
-	iter->line_pos = skip_to_next_field(line, end, len);
-
 	if (number)
 		*number = value;
 
-- 
1.7.1


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

* Re: [PATCH] gatchat: fix to number parsing when number is omitted
  2011-03-09  7:27 [PATCH] gatchat: fix to number parsing when number is omitted Paavo Leinonen
@ 2011-03-09 22:03 ` Denis Kenzior
  2011-03-11 12:25 ` [PATCH] atmodem: fix PB reading when fields are omitted Paavo Leinonen
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-03-09 22:03 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Hi Paavo,

On 03/09/2011 01:27 AM, Paavo Leinonen wrote:
> Line position index must be updated the number field is empty. Otherwise
> we will read same field again in subsequent calls.
> ---
> 
> Hi,
> 
> While testing SIM Phonebook we noticed that Email addresses stored to SIM PB
> were not properly parsed by oFono. Root cause for this was 
> g_at_result_iter_next_number which did not update iterator's line_pos
> attribute when number was missing. As a result, wrong fields were 
> read when parsing email field (among others).

This is actually on purpose, we do not want to consume the field if the
parsing failed.  For fields that might have omitted entries I suggest
you use g_at_result_iter_next_number_default.

Regards,
-Denis

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

* [PATCH] atmodem: fix PB reading when fields are omitted
  2011-03-09  7:27 [PATCH] gatchat: fix to number parsing when number is omitted Paavo Leinonen
  2011-03-09 22:03 ` Denis Kenzior
@ 2011-03-11 12:25 ` Paavo Leinonen
  2011-03-11 19:56   ` Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Paavo Leinonen @ 2011-03-11 12:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

Fix SIM PB reading when numeric fields have been omitted.

---

Hi,

Here is the fix for SIM PB reading as proposed.

BR,
Paavo

 drivers/atmodem/phonebook.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index 97213db..ebac563 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -172,10 +172,10 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
 			continue;
 		}
 
-		g_at_result_iter_next_number(&iter, &hidden);
+		g_at_result_iter_next_number_default(&iter, 0, &hidden);
 		parse_text(&iter, &group, current);
 		g_at_result_iter_next_string(&iter, &adnumber);
-		g_at_result_iter_next_number(&iter, &adtype);
+		g_at_result_iter_next_number_default(&iter, 0, &adtype);
 		parse_text(&iter, &secondtext, current);
 		parse_text(&iter, &email, current);
 		parse_text(&iter, &sip_uri, current);
-- 
1.7.1


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

* Re: [PATCH] atmodem: fix PB reading when fields are omitted
  2011-03-11 12:25 ` [PATCH] atmodem: fix PB reading when fields are omitted Paavo Leinonen
@ 2011-03-11 19:56   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-03-11 19:56 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Hi Paavo,

On 03/11/2011 06:25 AM, Paavo Leinonen wrote:
> Fix SIM PB reading when numeric fields have been omitted.
> 
> ---
> 
> Hi,
> 
> Here is the fix for SIM PB reading as proposed.
> 
> BR,
> Paavo
> 
>  drivers/atmodem/phonebook.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2011-03-11 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-09  7:27 [PATCH] gatchat: fix to number parsing when number is omitted Paavo Leinonen
2011-03-09 22:03 ` Denis Kenzior
2011-03-11 12:25 ` [PATCH] atmodem: fix PB reading when fields are omitted Paavo Leinonen
2011-03-11 19:56   ` Denis Kenzior

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.