include/xmlreader/pad.hxx | 3 +-- translations | 2 +- xmlreader/source/pad.cxx | 25 +++++++++++-------------- 3 files changed, 13 insertions(+), 17 deletions(-)
New commits: commit a1555567bf564c4b3cca2dd54b768be9460dec2f Author: Martin Srebotnjak <mi...@filmsi.net> AuthorDate: Fri May 14 21:31:21 2021 +0200 Commit: Gerrit Code Review <ger...@gerrit.libreoffice.org> CommitDate: Fri May 14 21:31:21 2021 +0200 Update git submodules * Update translations from branch 'master' to 48ffdf216a07738135223c4f95e9f942be8a5dd9 - Slovenian translation fixes Change-Id: If37efb1022635028ec8e9d1a66d20d3c6d8ebccc diff --git a/translations b/translations index 8b7f5b16e211..48ffdf216a07 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 8b7f5b16e211c9309c744b041802d371306bb7b0 +Subproject commit 48ffdf216a07738135223c4f95e9f942be8a5dd9 commit 233fa432256603812454cbdc372059afade50942 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri May 14 15:59:46 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri May 14 21:31:04 2021 +0200 Revert "improve perf of xmlreader::Pad" This reverts commit de5af8315e014ce3408f66c6de3c9c4e841f8437. Reason for revert: this commit needs bounds checking before it can reland Change-Id: I686a533cc27fc4644cce918ca64bd168bba19617 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115518 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/xmlreader/pad.hxx b/include/xmlreader/pad.hxx index 1f758c471338..3aa73d57eab4 100644 --- a/include/xmlreader/pad.hxx +++ b/include/xmlreader/pad.hxx @@ -47,8 +47,7 @@ private: SAL_DLLPRIVATE void flushSpan(); Span span_; - sal_Int32 buflength_ = 0; - char buffer_[1024]; + OStringBuffer buffer_{ 256 }; }; } diff --git a/xmlreader/source/pad.cxx b/xmlreader/source/pad.cxx index 74bb5ec63fb0..ce45f805f496 100644 --- a/xmlreader/source/pad.cxx +++ b/xmlreader/source/pad.cxx @@ -29,49 +29,46 @@ namespace xmlreader { void Pad::add(char const * begin, sal_Int32 length) { assert( - begin != nullptr && length >= 0 && !(span_.is() && buflength_ != 0)); + begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); if (length != 0) { flushSpan(); - if (buflength_ == 0) { + if (buffer_.isEmpty()) { span_ = Span(begin, length); } else { - memcpy(buffer_ + buflength_, begin, length); - buflength_ += length; + buffer_.append(begin, length); } } } void Pad::addEphemeral(char const * begin, sal_Int32 length) { assert( - begin != nullptr && length >= 0 && !(span_.is() && buflength_ != 0)); + begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); if (length != 0) { flushSpan(); - memcpy(buffer_ + buflength_, begin, length); - buflength_ += length; + buffer_.append(begin, length); } } void Pad::clear() { - assert(!(span_.is() && buflength_ != 0)); + assert(!(span_.is() && buffer_.getLength() != 0)); span_.clear(); - buflength_ = 0; + buffer_.setLength(0); } Span Pad::get() const { - assert(!(span_.is() && buflength_ != 0)); + assert(!(span_.is() && buffer_.getLength() != 0)); if (span_.is()) { return span_; - } else if (buflength_ == 0) { + } else if (buffer_.isEmpty()) { return Span(""); } else { - return Span(buffer_, buflength_); + return Span(buffer_.getStr(), buffer_.getLength()); } } void Pad::flushSpan() { if (span_.is()) { - memcpy(buffer_ + buflength_, span_.begin, span_.length); - buflength_ += span_.length; + buffer_.append(span_.begin, span_.length); span_.clear(); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits