summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-02-08 13:54:13 +0100
committersb <sb@openoffice.org>2010-02-08 13:54:13 +0100
commitc1307dc6470e80c2c79a0f691ecfec44ffe9ad3d (patch)
tree0a1ecdb47013b90add4cb21c5f1a2274b9cfd276 /configmgr
parent0ac0aed5886f74e857e52d7846bf09ce4a6175c1 (diff)
sb111: #i101955# do not pass ephemeral buffer to Pad::add
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/pad.cxx21
-rw-r--r--configmgr/source/pad.hxx4
-rw-r--r--configmgr/source/xmlreader.cxx2
3 files changed, 22 insertions, 5 deletions
diff --git a/configmgr/source/pad.cxx b/configmgr/source/pad.cxx
index b2b639f0dd7c..5bd5c6e5a9f9 100644
--- a/configmgr/source/pad.cxx
+++ b/configmgr/source/pad.cxx
@@ -43,10 +43,7 @@ void Pad::add(char const * begin, sal_Int32 length) {
OSL_ASSERT(
begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
if (length != 0) {
- if (span_.is()) {
- buffer_.append(span_.begin, span_.length);
- span_.clear();
- }
+ flushSpan();
if (buffer_.getLength() == 0) {
span_ = Span(begin, length);
} else {
@@ -55,6 +52,15 @@ void Pad::add(char const * begin, sal_Int32 length) {
}
}
+void Pad::addEphemeral(char const * begin, sal_Int32 length) {
+ OSL_ASSERT(
+ begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ if (length != 0) {
+ flushSpan();
+ buffer_.append(begin, length);
+ }
+}
+
void Pad::clear() {
OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
span_.clear();
@@ -77,4 +83,11 @@ Span Pad::get() const {
}
}
+void Pad::flushSpan() {
+ if (span_.is()) {
+ buffer_.append(span_.begin, span_.length);
+ span_.clear();
+ }
+}
+
}
diff --git a/configmgr/source/pad.hxx b/configmgr/source/pad.hxx
index 2d0ff6bfecc0..e941d68a4342 100644
--- a/configmgr/source/pad.hxx
+++ b/configmgr/source/pad.hxx
@@ -43,6 +43,8 @@ class Pad {
public:
void add(char const * begin, sal_Int32 length);
+ void addEphemeral(char const * begin, sal_Int32 length);
+
void clear();
bool is() const;
@@ -50,6 +52,8 @@ public:
Span get() const;
private:
+ void flushSpan();
+
Span span_;
rtl::OStringBuffer buffer_;
};
diff --git a/configmgr/source/xmlreader.cxx b/configmgr/source/xmlreader.cxx
index 2bac273610fb..9ddbb64bb13a 100644
--- a/configmgr/source/xmlreader.cxx
+++ b/configmgr/source/xmlreader.cxx
@@ -531,7 +531,7 @@ char const * XmlReader::handleReference(char const * position, char const * end)
buf[3] = static_cast< char >((val & 0x3F) | 0x80);
len = 4;
}
- pad_.add(buf, len);
+ pad_.addEphemeral(buf, len);
return position;
} else {
struct EntityRef {