mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Handle XSLT based imports correctly
XSLT conversions create V2 XML files, but we shouldn't abort when we parse those without having the user informed about the potential slowness - all XSLT based imports are slow, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
959077c66b
commit
6f7e3d04cb
3 changed files with 10 additions and 5 deletions
|
@ -24,6 +24,7 @@ int metric = 1;
|
|||
int last_xml_version = -1;
|
||||
bool abort_read_of_old_file = false;
|
||||
bool v2_question_shown = false;
|
||||
bool imported_via_xslt = false;
|
||||
|
||||
static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
|
||||
|
||||
|
@ -1681,7 +1682,7 @@ static bool entry(const char *name, char *buf)
|
|||
if (!strncmp(name, "version.program", sizeof("version.program") - 1) ||
|
||||
!strncmp(name, "version.divelog", sizeof("version.divelog") - 1)) {
|
||||
last_xml_version = atoi(buf);
|
||||
if (last_xml_version < 3 && !v2_question_shown) {
|
||||
if (last_xml_version < 3 && !v2_question_shown && !imported_via_xslt) {
|
||||
// let's ask the user what they want to do about reverse geo coding
|
||||
// and warn them that opening older XML files can take a while
|
||||
// since C code shouldn't call the UI we set a global flag and bail
|
||||
|
@ -1953,7 +1954,7 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
|
|||
}
|
||||
dive_end();
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
imported_via_xslt = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3154,7 +3155,7 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
|
|||
}
|
||||
free((void *)attribute);
|
||||
}
|
||||
|
||||
imported_via_xslt = true;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xslt = get_stylesheet(info->file);
|
||||
if (xslt == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue