summaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-04-24 12:59:42 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-25 07:19:18 -0700
commit6378bfd91ee6c0ad746b072d8a9389e0eba7c614 (patch)
tree8bc86b80655cbaa48f6ce0f3ec5b01d95f93e15e /save-xml.c
parente088067ef12f5e2032f6b742ef103c582283f84a (diff)
downloadsubsurface-6378bfd91ee6c0ad746b072d8a9389e0eba7c614.tar.gz
Save latitude and longitude on XML even if location not set
This bug don't exists when saving to git storage, only when saving XML. The latitude and longitude were being discarded if the location name was not set and this breaks some users workflow. Not nice. This should fix the final missing part for bug #440 Fixes #440 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/save-xml.c b/save-xml.c
index 4ad03dbf6..1db2513d0 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -71,19 +71,16 @@ 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)
{
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);
- quote(b, text, is_attribute);
+ if (text){
+ 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);
}
@@ -188,13 +185,7 @@ static void show_location(struct membuffer *b, struct dive *dive)
*/
if (latitude.udeg || longitude.udeg) {
int len = sprintf(buffer, " <location ");
-
len += format_location(buffer + len, latitude, longitude);
- if (!dive->location) {
- memcpy(buffer + len, "/>\n", 4);
- put_string(b, buffer);
- return;
- }
buffer[len++] = '>';
buffer[len] = 0;
prefix = buffer;