Nils Philippsen
e995daa375
Fix failure to build with libxml2 version 2.12
...
This declared some xmlError pointers const, which probably was always
assumed, but not made explicit.
Signed-off-by: Nils Philippsen <nils@tiptoe.de>
2023-11-25 00:30:04 +01:00
4b77ecbe83
Sanitize XML values to be valid UTF-8 ( #9317 )
...
This prevents any non UTF-8 strings to leak into
Ardour XML files, which can make the session unloadable.
2023-04-26 17:43:52 +02:00
b35518e212
switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
...
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
90c5524e7b
libbd: add required <cassert> include
2023-03-24 14:19:15 -06:00
luz paz
7f06beda50
Fix typos
...
Found via `codespell -q 3 -S *.po,./.git,./share/patchfiles,./libs,./msvc_extra_headers,./share/web_surfaces,*.patch -L acount,ba,buss,busses,discreet,doubleclick,hsi,ontop,retrn,ro,scrollin,seh,siz,sord,sur,te,trough,ue`
2022-09-21 19:09:55 -06:00
beb0a96f42
API to directly retrieve XML child content
2022-01-13 00:09:55 +01:00
5957e14259
Remove unused #include<> (2/2)
...
PBD::stacktrace() is not used nor needed by default.
It should be used sparingly.
2021-05-05 17:57:16 +02:00
dbcbfd7b5b
Fix builds, missing include
2020-04-24 01:53:59 +02:00
afad873a22
Fix parsing XML with blanks from memory
...
This is needed when the butler thread loads a plugin with
MIDNAM. xmlKeepBlanksDefault() setting is per thread.
see also df3a4ed9c6
2020-04-23 02:28:48 +02:00
705ac7bfc5
Prevent huge stack allocations for MIDNAM files
...
xmlParseMemory() uses a c-pointer char*.
Previously MIDNAM data on the heap were wrapped inside
a std::string only to be later accessed via c_str().
2020-04-23 02:25:38 +02:00
96daa4036a
fix apparent free-ordering issue reported in #7926
2020-03-11 08:50:29 -06:00
df3a4ed9c6
move call to xmlKeepBlanksDefault(0) to before the creation of an XML parser context
...
the value is used by the parser context; the old code called it only after the *first* parser context
was created. therefore the first XMLTree::read() call has its behavior determined by libxml2's default
for this value, rather than by our explicit choice (do not treat whitespace as a note). All subequent
read() calls will use our value.
This variable inside libxml2 is actually per-thread, which just increases the stakes for calling
xmlKeepBlanksDefault() at the right time
2020-01-05 17:58:54 -07:00
7852047dca
Fix XML-writer edge-case (empty content)
2019-11-01 15:39:44 +01:00
2f91bdfa53
NO-OP: <tab> after <space> fixes in libs
2019-04-13 19:19:29 +02:00
7d88091229
Avoid assert() when loading xml: Throw an XMLerror if attribute_value fails.
2017-08-30 10:23:34 -05:00
628e60f8fd
NO-OP: whitespace
2017-05-29 23:45:16 +02:00
Daniel Sheeler
d67436af3b
duplicate routes start off unsoloed to avoid issues related to upstream / downstream buses
2017-05-29 15:42:27 -05:00
1f094027c5
Remove normalization of property names from libpbd xml code
...
It may have been OK to add this code temporarily at this low level, but as it
was introduced in 2008, this change is made with the assumption that any
Sessions that were affected have been re-saved since then with corrected
property names and that "normalization" is no longer necessary.
Timing results before changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 30375 Max: 48253 Total: 431727 Avg: 43172 (43 msecs)
Write : Count: 10 Min: 42553 Max: 49163 Total: 453353 Avg: 45335 (45 msecs)
Read : Count: 10 Min: 70307 Max: 75987 Total: 734923 Avg: 73492 (73 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 154486 Max: 307856 Total: 2678989 Avg: 267898 (267 msecs)
Write : Count: 10 Min: 304273 Max: 343274 Total: 3169158 Avg: 316915 (316 msecs)
Read : Count: 10 Min: 496920 Max: 541394 Total: 5260410 Avg: 526041 (526 msecs)
Timing results after changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 21437 Max: 39749 Total: 348622 Avg: 34862 (34 msecs)
Write : Count: 10 Min: 42320 Max: 49989 Total: 446135 Avg: 44613 (44 msecs)
Read : Count: 10 Min: 63252 Max: 68389 Total: 660841 Avg: 66084 (66 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 113458 Max: 263225 Total: 2215595 Avg: 221559 (221 msecs)
Write : Count: 10 Min: 305439 Max: 339986 Total: 3150697 Avg: 315069 (315 msecs)
Read : Count: 10 Min: 447560 Max: 488121 Total: 4698903 Avg: 469890 (469 msecs)
2017-05-26 08:48:04 +10:00
6e467153a0
Remove unused XMLNode::add_property methods
...
These are now unused and functionality is replaced by XMLNode::set_property
set_property is a better name as a node can only have properties with unique
names and the property will be set or reset(if it already exists). Changing the
name also makes it easier to transition and test the new API.
2017-04-19 09:36:57 +10:00
ae27e33f29
Add a template based get/set_property API to PBD::XMLNode
2017-04-19 09:36:48 +10:00
06700cb2f4
Allow to construct a XML tree from a text buffer
2016-10-29 19:57:43 +02:00
816f3bfb36
Use std::vector::reserve to improve performance of adding properties
...
The number of properties per node roughly corresponds to the number of members
of the class the node is representing and should be fairly low.
Use std::vector::reserve to prevent reallocation on insert for most node types,
there are exceptions like Region(~40 properties).
This seems worth it as part(maybe 1/10th of the total time) of saving a Session
is a combination of what occurs in "Create" and "Write" in this test.
Perf results before changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 30610 Max: 42656 Total: 376672 Avg: 37667 (37 msecs)
Write : Count: 10 Min: 42804 Max: 54277 Total: 460455 Avg: 46045 (46 msecs)
Read : Count: 10 Min: 70364 Max: 85484 Total: 750909 Avg: 75090 (75 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 164360 Max: 356995 Total: 3064482 Avg: 306448 (306 msecs)
Write : Count: 10 Min: 308655 Max: 372953 Total: 3226707 Avg: 322670 (322 msecs)
Read : Count: 10 Min: 517243 Max: 541839 Total: 5289950 Avg: 528995 (528 msecs)
Perf results after changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 30375 Max: 48253 Total: 431727 Avg: 43172 (43 msecs)
Write : Count: 10 Min: 42553 Max: 49163 Total: 453353 Avg: 45335 (45 msecs)
Read : Count: 10 Min: 70307 Max: 75987 Total: 734923 Avg: 73492 (73 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 154486 Max: 307856 Total: 2678989 Avg: 267898 (267 msecs)
Write : Count: 10 Min: 304273 Max: 343274 Total: 3169158 Avg: 316915 (316 msecs)
Read : Count: 10 Min: 496920 Max: 541394 Total: 5260410 Avg: 526041 (526 msecs)
2016-10-10 08:45:34 +10:00
e84fbfe6e5
Remove PropertyMap from XMLNode class
...
It appears that there is no performance benefit from storing properties in a
map for faster lookup or it is counteracted by the penalty of storing and
maintaining the additional data structure.
Timing results before changes with an optimized build:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 41293 Max: 63746 Total: 564448 Avg: 56444 (56 msecs)
Write : Count: 10 Min: 42932 Max: 49221 Total: 453955 Avg: 45395 (45 msecs)
Read : Count: 10 Min: 80160 Max: 84678 Total: 824506 Avg: 82450 (82 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 228759 Max: 420236 Total: 3587597 Avg: 358759 (358 msecs)
Write : Count: 10 Min: 307095 Max: 348767 Total: 3205704 Avg: 320570 (320 msecs)
Read : Count: 10 Min: 572400 Max: 657219 Total: 5959630 Avg: 595963 (595 msecs)
Perf results after changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 30610 Max: 42656 Total: 376672 Avg: 37667 (37 msecs)
Write : Count: 10 Min: 42804 Max: 54277 Total: 460455 Avg: 46045 (46 msecs)
Read : Count: 10 Min: 70364 Max: 85484 Total: 750909 Avg: 75090 (75 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 164360 Max: 356995 Total: 3064482 Avg: 306448 (306 msecs)
Write : Count: 10 Min: 308655 Max: 372953 Total: 3226707 Avg: 322670 (322 msecs)
Read : Count: 10 Min: 517243 Max: 541839 Total: 5289950 Avg: 528995 (528 msecs)
2016-10-10 08:45:34 +10:00
97752e6a51
Use references rather than copying containers in libpbd xml code
...
It is slightly surprising but there seems to be little difference to
performance with these changes. Possibly a slight improvement in "Create" test
with a large xml document(~5%).
Timing results before these changes with an optimized build using new XML perf tests:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 38656 Max: 63827 Total: 571228 Avg: 57122 (57 msecs)
Write : Count: 10 Min: 43594 Max: 49279 Total: 459907 Avg: 45990 (45 msecs)
Read : Count: 10 Min: 80247 Max: 84912 Total: 827207 Avg: 82720 (82 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 230706 Max: 456054 Total: 3850998 Avg: 385099 (385 msecs)
Write : Count: 10 Min: 312322 Max: 353789 Total: 3264211 Avg: 326421 (326 msecs)
Read : Count: 10 Min: 573556 Max: 610865 Total: 5951908 Avg: 595190 (595 msecs)
Timing results after these changes:
XMLTest::testPerfMediumXMLDocumentTiming
Create : Count: 10 Min: 41293 Max: 63746 Total: 564448 Avg: 56444 (56 msecs)
Write : Count: 10 Min: 42932 Max: 49221 Total: 453955 Avg: 45395 (45 msecs)
Read : Count: 10 Min: 80160 Max: 84678 Total: 824506 Avg: 82450 (82 msecs)
XMLTest::testPerfLargeXMLDocumentTiming
Create : Count: 10 Min: 228759 Max: 420236 Total: 3587597 Avg: 358759 (358 msecs)
Write : Count: 10 Min: 307095 Max: 348767 Total: 3205704 Avg: 320570 (320 msecs)
Read : Count: 10 Min: 572400 Max: 657219 Total: 5959630 Avg: 595963 (595 msecs)
2016-10-10 08:45:34 +10:00
4b2987d0f2
Add XMLNode::operator==/!=() for comparing XMLNode instances
...
Implemented to be able to test that when writing an XML document via XMLTree
and then reading back into another XMLTree the structure is equivalent as a
general API test of pbd/xml++.h to check for breakage when changing
implementation.
2016-10-10 08:45:34 +10:00
17ace643e4
OMNIBUS COMMIT: prefer const XMLNode::property method (and provide a real one)
2016-05-04 23:09:45 -04:00
255b5174c4
add a const method to check for existing key/value properties
...
handy to lookup up XMLNodes with "id" == ID w/o allocating memory.
2016-05-03 03:03:00 +02:00
ff05c82312
Revert "experimental session-save speedup" -- needs C++11
...
This reverts commit d1dcedaccf
.
2016-04-08 21:21:38 +02:00
3def1b2830
more potential session-save speedup.
...
std:vector trumps std::list speed in all aspects: traversal, insertion
(at end) and Deletion. ..but we'll have to be careful about iterators..
2016-04-08 21:03:23 +02:00
d1dcedaccf
experimental session-save speedup
...
property order is not important,
unordered_map lookup and insertion is O(1)
2016-04-08 20:32:49 +02:00
14932d1b86
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
2015-10-07 14:36:32 +02:00
22b07e0233
NOOP, remove trailing tabs/whitespace.
2015-10-05 16:17:49 +02:00
4dc63966f0
globally remove all trailing whitespace from ardour code base.
...
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
44cba53219
Revert "When saving a session (in a non-English locale) make sure that we use a locale-specific path"
...
This reverts commit cf5a8651d8
.
2015-07-25 23:14:50 +10:00
cf5a8651d8
When saving a session (in a non-English locale) make sure that we use a locale-specific path
2015-07-23 17:55:13 +01:00
c9b0f0fcb7
debug info to trace down "cannot rename temp session file" errors
...
..but actually, the real error may be concurrent
calls to Session::save_state()
2014-07-05 20:53:22 +02:00
350ed31655
Remaining changes needed for building libpdb on Windows (except for adding the extra JE source modules)
2013-07-17 08:08:46 +01:00
Julien de Kozak
27d77b8719
Fix some compilation warnings
2013-03-30 18:09:40 +01:00
760ccbabfb
add -Wpointer-arith -Wcast-qual -Wcast-align and others to compile flags, and fix const cast warnings generated by new flags
...
git-svn-id: svn://localhost/ardour2/branches/3.0@13124 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-08-10 15:57:09 +00:00
Carl Hetherington
e58e614f20
Fix build.
...
git-svn-id: svn://localhost/ardour2/branches/3.0@12910 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23 12:54:11 +00:00
6262eae7c0
Remove unnecessary header includes
...
git-svn-id: svn://localhost/ardour2/branches/3.0@12827 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23 03:51:41 +00:00
Carl Hetherington
5ac22e9095
Add new SharedStatefulProperty which manages a shared_ptr to
...
some Stateful object, and a subclass to use this for
AutomationList. SharedStatefulProperty will manage undo / redo
using full copies of the XML state, like MementoCommand,
but does it within the Property undo system.
git-svn-id: svn://localhost/ardour2/branches/3.0@12740 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-16 17:20:10 +00:00
71b3c8cfe1
some deep changes to xml++ in which we retain a C-level xmlDocPtr as a member of an XMLTree objects. this allows us to do repeated XPATH searches (as in the midnam parser of libmidi++) without constantly rewriting an entire tree into memory to recreate a new xmlDocPtr with which we can search. Since XMLTree objects don't typically stay around for very long, just when serializing to/from disk, this is not anticipated to have much (if any) impact on memory consumption
...
git-svn-id: svn://localhost/ardour2/branches/3.0@11733 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-03-20 18:01:07 +00:00
3c7f9586ae
implement XMLNode::operator=() as a deep operation with the same semantics as the XMLNode copy constructor. attempt to share as much code as possible between them and the destructor
...
git-svn-id: svn://localhost/ardour2/branches/3.0@11612 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-03-07 02:07:35 +00:00
Carl Hetherington
0c9c47086c
Slightly unpleasant fix for creation of tracks from
...
templates; it would be nice if we could set things up using
the Route's logic for setting names of its children, rather
than repeating the same logic in XML-land (#4303 ).
git-svn-id: svn://localhost/ardour2/branches/3.0@10655 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-11-16 23:03:59 +00:00
72928df58f
make XMLNode::add_property() correctly re-entrant and reduce the size of the tmp buffer used to print a long integer
...
git-svn-id: svn://localhost/ardour2/branches/3.0@9131 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-03-12 20:29:40 +00:00
58ce6c2bb7
a better fix fpr that wierd XMLProperty botch
...
git-svn-id: svn://localhost/ardour2/branches/3.0@9128 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-03-12 20:23:56 +00:00
Carl Hetherington
8778724701
Rename debug -> dump
...
git-svn-id: svn://localhost/ardour2/branches/3.0@7738 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-09-03 15:24:21 +00:00
Carl Hetherington
542372cd18
Add debug() method to dump XML nodes.
...
git-svn-id: svn://localhost/ardour2/branches/3.0@7083 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-05-09 00:46:33 +00:00
Carl Hetherington
896aa29dcf
Remove use of xmlCleanupParser as suggested in the libxml2 docs. Fixes #3047 .
...
git-svn-id: svn://localhost/ardour2/branches/3.0@6793 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-03-25 01:24:59 +00:00