Fix: Make next_hexstring handle optional quotes
authorDenis Kenzior <denkenz@gmail.com>
Fri, 2 Oct 2009 23:22:44 +0000 (18:22 -0500)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 3 Oct 2009 02:35:04 +0000 (04:35 +0200)
Ericsson MBM devices send CRSM information as hex strings, yet enclose
them in quotes which is not according to the standard.

gatchat/gatresult.c

index ee02c0c..1436ae3 100644 (file)
@@ -228,6 +228,9 @@ gboolean g_at_result_iter_next_hexstring(GAtResultIter *iter,
                goto out;
        }
 
+       if (line[pos] == '"')
+               pos += 1;
+
        end = pos;
 
        while (end < len && g_ascii_isxdigit(line[end]))
@@ -241,6 +244,9 @@ gboolean g_at_result_iter_next_hexstring(GAtResultIter *iter,
        for (; pos < end; pos += 2)
                sscanf(line + pos, "%02hhx", bufpos++);
 
+       if (line[end] == '"')
+               end += 1;
+
 out:
        iter->line_pos = skip_to_next_field(line, end, len);