mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Revert "Save latitude and longitude on XML even if location not set"
This fixes the bug in #440 by accident, and introduces lots of empty
attributes and tags in the xml.
This reverts commit 6378bfd91e
.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0c836ebc47
commit
7b0b5d9643
1 changed files with 18 additions and 9 deletions
27
save-xml.c
27
save-xml.c
|
@ -71,16 +71,19 @@ static void quote(struct membuffer *b, const char *text, int is_attribute)
|
||||||
static void show_utf8(struct membuffer *b, const char *text, const char *pre, const char *post, int is_attribute)
|
static void show_utf8(struct membuffer *b, const char *text, const char *pre, const char *post, int is_attribute)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
if (!text)
|
||||||
|
return;
|
||||||
|
while (isspace(*text))
|
||||||
|
text++;
|
||||||
|
len = strlen(text);
|
||||||
|
if (!len)
|
||||||
|
return;
|
||||||
|
while (len && isspace(text[len - 1]))
|
||||||
|
len--;
|
||||||
|
/* FIXME! Quoting! */
|
||||||
put_string(b, pre);
|
put_string(b, pre);
|
||||||
if (text){
|
quote(b, text, is_attribute);
|
||||||
while (isspace(*text))
|
|
||||||
text++;
|
|
||||||
len = strlen(text);
|
|
||||||
while (len && isspace(text[len - 1]))
|
|
||||||
len--;
|
|
||||||
/* FIXME! Quoting! */
|
|
||||||
quote(b, text, is_attribute);
|
|
||||||
}
|
|
||||||
put_string(b, post);
|
put_string(b, post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +188,13 @@ static void show_location(struct membuffer *b, struct dive *dive)
|
||||||
*/
|
*/
|
||||||
if (latitude.udeg || longitude.udeg) {
|
if (latitude.udeg || longitude.udeg) {
|
||||||
int len = sprintf(buffer, " <location ");
|
int len = sprintf(buffer, " <location ");
|
||||||
|
|
||||||
len += format_location(buffer + len, latitude, longitude);
|
len += format_location(buffer + len, latitude, longitude);
|
||||||
|
if (!dive->location) {
|
||||||
|
memcpy(buffer + len, "/>\n", 4);
|
||||||
|
put_string(b, buffer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
buffer[len++] = '>';
|
buffer[len++] = '>';
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
prefix = buffer;
|
prefix = buffer;
|
||||||
|
|
Loading…
Add table
Reference in a new issue