[Libreoffice-commits] core.git: include/xmlreader xmlreader/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 8 06:31:48 UTC 2019
include/xmlreader/span.hxx | 4 ++--
include/xmlreader/xmlreader.hxx | 2 +-
xmlreader/source/xmlreader.cxx | 6 +++++-
3 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 266303e867fae0eb10fe9aa52cf683e3db88376a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Oct 7 10:38:28 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 8 08:30:46 2019 +0200
cleanups in xmlreader
(*) fix order of headers
(*) include the right headers in span.hxx
(*) use std::memcmp instead of memcmp
(*) clear entries from cache when the namespaces array is resized
Change-Id: I04319bbaa84369e5470799578fadcda66a591c9f
Reviewed-on: https://gerrit.libreoffice.org/80347
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/xmlreader/span.hxx b/include/xmlreader/span.hxx
index f56059b96274..a3da663e5a71 100644
--- a/include/xmlreader/span.hxx
+++ b/include/xmlreader/span.hxx
@@ -24,9 +24,9 @@
#include <cstddef>
#include <cstring>
+#include <functional>
#include <sal/types.h>
-#include <rtl/string.h>
#include <xmlreader/detail/xmlreaderdllapi.hxx>
namespace rtl { class OUString; }
@@ -53,7 +53,7 @@ struct SAL_WARN_UNUSED OOO_DLLPUBLIC_XMLREADER Span {
bool operator==(Span const & text) const {
return length == text.length
- && memcmp(begin, text.begin, text.length) == 0;
+ && std::memcmp(begin, text.begin, text.length) == 0;
}
bool operator!=(Span const & text) const {
diff --git a/include/xmlreader/xmlreader.hxx b/include/xmlreader/xmlreader.hxx
index a553baeb6c3a..99e889ee0d59 100644
--- a/include/xmlreader/xmlreader.hxx
+++ b/include/xmlreader/xmlreader.hxx
@@ -22,8 +22,8 @@
#include <sal/config.h>
-#include <unordered_map>
#include <stack>
+#include <unordered_map>
#include <vector>
#include <osl/file.h>
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
index 95a27a785b5c..918f42a2e1b2 100644
--- a/xmlreader/source/xmlreader.cxx
+++ b/xmlreader/source/xmlreader.cxx
@@ -714,7 +714,11 @@ XmlReader::Result XmlReader::handleEndTag() {
void XmlReader::handleElementEnd() {
assert(!elements_.empty());
- namespaces_.resize(elements_.top().inheritedNamespaces);
+ // remove keys from cache that are no longer valid
+ auto end = elements_.top().inheritedNamespaces;
+ for (auto i = end; i < namespaces_.size(); ++i)
+ cacheNSIds_.erase(namespaces_[i].prefix);
+ namespaces_.resize(end);
elements_.pop();
state_ = elements_.empty() ? State::Done : State::Content;
}
More information about the Libreoffice-commits
mailing list