aboutsummaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-11-24 18:29:14 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-25 13:05:08 -0800
commit1b861ba20e1626d28686c3998fc3bb6b6b49a6d4 (patch)
tree7b20aa389cc1cff459121550418ebcde2a54e449 /save-xml.c
parent5a4640cf44bc08788eb13ab44a5f84ccf75e4a75 (diff)
downloadsubsurface-1b861ba20e1626d28686c3998fc3bb6b6b49a6d4.tar.gz
Start merging dives by keeping the dive computer data from both dives
Also, note that we do *not* do the "find_sample_offset()" any more when we merge two dives that happen at the same time - since we just keep both sets of dive computer data around. But we keep the function to find the best offset around, because we may well want to use it later when *showing* the dive, and trying to match up the different sample data from the multiple dive computers associated with the dive. Because of that, this causes warnings about the now unused function. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/save-xml.c b/save-xml.c
index a86cbd23c..af4356840 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -349,23 +349,19 @@ static void save_trip(FILE *f, dive_trip_t *trip)
static void save_dc(FILE *f, struct dive *dive, struct divecomputer *dc)
{
int i;
- const char *post = "";
-
- if (dc->when || dc->vendor || dc->product) {
- fprintf(f, "<divecomputer");
- if (dc->vendor)
- show_utf8(f, dc->vendor, " vendor='", "'", 1);
- if (dc->product)
- show_utf8(f, dc->product, " product='", "'", 1);
- if (dc->when && dc->when != dive->when)
- show_date(f, dc->when);
- fprintf(f, ">\n");
- post = "</divecomputer>\n";
- }
+
+ fprintf(f, " <divecomputer");
+ if (dc->vendor)
+ show_utf8(f, dc->vendor, " vendor='", "'", 1);
+ if (dc->product)
+ show_utf8(f, dc->product, " product='", "'", 1);
+ if (dc->when && dc->when != dive->when)
+ show_date(f, dc->when);
+ fprintf(f, ">\n");
save_events(f, dc->events);
for (i = 0; i < dc->samples; i++)
save_sample(f, dc->sample+i);
- fprintf(f, post);
+ fprintf(f, " </divecomputer>\n");
}
static void save_dive(FILE *f, struct dive *dive)