mirror of git://git.sysmocom.de/ofono
gatresult: strip trailing spaces from unquoted strings
Some vendors might print trailing spaces after unsolicited result codes. Avoid duplicating and stripping the string after calling g_at_result_iter_next_unquoted_string() by stripping the spaces in gatresult instead.
This commit is contained in:
parent
c56b66bf4b
commit
8905150bda
|
@ -111,6 +111,7 @@ gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
|
|||
unsigned int pos;
|
||||
unsigned int end;
|
||||
unsigned int len;
|
||||
unsigned int stripped;
|
||||
char *line;
|
||||
|
||||
if (iter == NULL)
|
||||
|
@ -139,7 +140,12 @@ gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
|
|||
while (end < len && line[end] != ',' && line[end] != ')')
|
||||
end += 1;
|
||||
|
||||
iter->buf[end] = '\0';
|
||||
stripped = end;
|
||||
|
||||
while (line[stripped - 1] == ' ')
|
||||
stripped -= 1;
|
||||
|
||||
iter->buf[stripped] = '\0';
|
||||
|
||||
out:
|
||||
iter->line_pos = skip_to_next_field(line, end, len);
|
||||
|
|
Loading…
Reference in New Issue