mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
allow to load huge VST plugin states -fixes #6623
by default libxml has a XML_MAX_TEXT_LENGTH of 10M with base64 encoding that allows at most 2.5MB state. set XML_PARSE_HUGE to read large sessions
This commit is contained in:
parent
e79b2e376f
commit
14932d1b86
1 changed files with 8 additions and 13 deletions
|
|
@ -82,26 +82,23 @@ XMLTree::read_internal(bool validate)
|
||||||
_doc = 0;
|
_doc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlParserCtxtPtr ctxt = NULL; /* the parser context */
|
/* create a parser context */
|
||||||
|
xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
|
||||||
|
if (ctxt == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
xmlKeepBlanksDefault(0);
|
xmlKeepBlanksDefault(0);
|
||||||
/* parse the file, activating the DTD validation option */
|
/* parse the file, activating the DTD validation option */
|
||||||
if (validate) {
|
if (validate) {
|
||||||
/* create a parser context */
|
|
||||||
ctxt = xmlNewParserCtxt();
|
|
||||||
if (ctxt == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_doc = xmlCtxtReadFile(ctxt, _filename.c_str(), NULL, XML_PARSE_DTDVALID);
|
_doc = xmlCtxtReadFile(ctxt, _filename.c_str(), NULL, XML_PARSE_DTDVALID);
|
||||||
} else {
|
} else {
|
||||||
_doc = xmlParseFile(_filename.c_str());
|
_doc = xmlCtxtReadFile(ctxt, _filename.c_str(), NULL, XML_PARSE_HUGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if parsing suceeded */
|
/* check if parsing suceeded */
|
||||||
if (_doc == NULL) {
|
if (_doc == NULL) {
|
||||||
if (validate) {
|
xmlFreeParserCtxt(ctxt);
|
||||||
xmlFreeParserCtxt(ctxt);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
/* check if validation suceeded */
|
/* check if validation suceeded */
|
||||||
|
|
@ -114,9 +111,7 @@ XMLTree::read_internal(bool validate)
|
||||||
_root = readnode(xmlDocGetRootElement(_doc));
|
_root = readnode(xmlDocGetRootElement(_doc));
|
||||||
|
|
||||||
/* free up the parser context */
|
/* free up the parser context */
|
||||||
if (validate) {
|
xmlFreeParserCtxt(ctxt);
|
||||||
xmlFreeParserCtxt(ctxt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue