summaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 06:45:12 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 06:45:12 -0700
commitde35c886837016c80fc65043d8a2f0b373efec5b (patch)
tree87eaf634a88f557d88d9580d5b5ad759f9e1ceeb /save-xml.c
parent70d4421cd0ab235ee4f37ed7f8b6ad863da703bb (diff)
downloadsubsurface-de35c886837016c80fc65043d8a2f0b373efec5b.tar.gz
Track minimum datafile version
Add infrastructure and helper functions to track minimum datafile version. To make this information useful we need to keep the XML and git data format versions in track moving forward. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/save-xml.c b/save-xml.c
index 8ff133122..620980a60 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -8,6 +8,7 @@
#include <fcntl.h>
#include "dive.h"
+#include "divelist.h"
#include "device.h"
#include "membuffer.h"
#include "strndup.h"
@@ -483,8 +484,6 @@ static void save_one_device(void *_f, const char *model, uint32_t deviceid,
put_format(b, "/>\n");
}
-#define VERSION 3
-
int save_dives(const char *filename)
{
return save_dives_logic(filename, false);
@@ -496,7 +495,7 @@ void save_dives_buffer(struct membuffer *b, const bool select_only)
struct dive *dive;
dive_trip_t *trip;
- put_format(b, "<divelog program='subsurface' version='%d'>\n<settings>\n", VERSION);
+ put_format(b, "<divelog program='subsurface' version='%d'>\n<settings>\n", DATAFORMAT_VERSION);
if (prefs.save_userid_local)
put_format(b, " <userid>%30s</userid>\n", prefs.userid);
@@ -618,7 +617,7 @@ static void try_to_backup(const char *filename)
while (extension[i][0] != '\0') {
int elen = strlen(extension[i]);
if (strcasecmp(filename + flen - elen, extension[i]) == 0) {
- if (last_xml_version < VERSION) {
+ if (last_xml_version < DATAFORMAT_VERSION) {
int se_len = strlen(extension[i]) + 5;
char *special_ext = malloc(se_len);
snprintf(special_ext, se_len, "%s.v%d", extension[i], last_xml_version);