[PATCH 1/3] Revert "Save latitude and longitude on XML even if location not set"
Linus Torvalds
torvalds at linux-foundation.org
Tue May 6 15:45:37 PDT 2014
On Tue, May 6, 2014 at 3:27 PM, Anton Lundin <glance at acc.umu.se> wrote:
> This fixes the bug in #440 by accident, and introduces lots of empty
> attributes and tags in the xml.
> +
> + if (!text)
> + return;
> + while (isspace(*text))
> + text++;
> + len = strlen(text);
> + if (!len)
> + return;
> + while (len && isspace(text[len - 1]))
> + len--;
The code makes no sense.
As shown by the "if (!len)", empty strings shouldn't be shown.
But the "strip whitespace" can *make* the string empty.
So the "if (!len)" test is misplaced. Please just fix it.
But what is worse, is that "len" is then apparently not used, and it
just goes on to do
quote(b, text, is_attribute);
because apparently when the code was changed to use "quote()" the use
of "len" as a limiter of the string was lost. So that should be fixed
too.
Linus
More information about the subsurface
mailing list