summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-09-28 00:09:16 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-10-23 11:53:18 +0200
commit406062334a4891094928149711fcbb98fccc3fff (patch)
treedc5d868fe6a21ea5518bd7390191f5b93d290032 /sax
parent50d2ffd2a107ae8fd5c3e53f4f75234ad37081ea (diff)
FastSerializer: avoid some more OStrings
Change-Id: I2d5dbe9adccdd231cc16a1f83a90a4adeb965c64
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/fastattribs.cxx6
-rw-r--r--sax/source/tools/fastserializer.cxx14
-rw-r--r--sax/source/tools/fastserializer.hxx1
-rw-r--r--sax/source/tools/fshelper.cxx5
4 files changed, 14 insertions, 12 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 67f3196b12c9..e2cbcc677238 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -225,12 +225,6 @@ Sequence< FastAttribute > FastAttributeList::getFastAttributes( ) throw (Runtim
return aSeq;
}
-sal_Int32 FastAttributeList::AttributeValueLength(sal_Int32 i)
-{
- // Pointers to null terminated strings
- return maAttributeValues[i + 1] - maAttributeValues[i] - 1;
-}
-
sal_Int32 FastTokenHandlerBase::getTokenFromChars(
const css::uno::Reference< css::xml::sax::XFastTokenHandler > &xTokenHandler,
FastTokenHandlerBase *pTokenHandler,
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 3a8b770c182c..d6c1a949b3dc 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -83,14 +83,20 @@ namespace sax_fastparser {
void FastSaxSerializer::write( const OString& sOutput, bool bEscape )
{
+ write( sOutput.getStr(), sOutput.getLength(), bEscape );
+ }
+
+ void FastSaxSerializer::write( const char* pStr, sal_Int32 nLen, bool bEscape )
+ {
+ if (nLen == 0)
+ nLen = strlen(pStr);
+
if (!bEscape)
{
- writeBytes( sOutput.getStr(), sOutput.getLength() );
+ writeBytes( pStr, nLen );
return;
}
- const char* pStr = sOutput.getStr();
- sal_Int32 nLen = sOutput.getLength();
for (sal_Int32 i = 0; i < nLen; ++i)
{
char c = pStr[ i ];
@@ -222,7 +228,7 @@ namespace sax_fastparser {
writeBytes(sEqualSignAndQuote, N_CHARS(sEqualSignAndQuote));
- write(pAttrList->getFastAttributeValue(j), true);
+ write(pAttrList->getFastAttributeValue(j), pAttrList->AttributeValueLength(j), true);
writeBytes(sQuote, N_CHARS(sQuote));
}
diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx
index 089348a004e9..05db2c792354 100644
--- a/sax/source/tools/fastserializer.hxx
+++ b/sax/source/tools/fastserializer.hxx
@@ -105,6 +105,7 @@ public:
void write( const OUString& s, bool bEscape = false );
void write( const OString& s, bool bEscape = false );
+ void write( const char* pStr, sal_Int32 nLen, bool bEscape = false );
public:
/** From now on, don't write directly to the stream, but to top of a stack.
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 30e59322f034..c6ac390dca19 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -109,7 +109,8 @@ void FastSerializerHelper::singleElement(sal_Int32 elementTokenId, XFastAttribut
FastSerializerHelper* FastSerializerHelper::write(const char* value)
{
- return write(OString(value));
+ mpSerializer->write(value, 0, false);
+ return this;
}
FastSerializerHelper* FastSerializerHelper::write(const OUString& value)
@@ -141,7 +142,7 @@ FastSerializerHelper* FastSerializerHelper::write(double value)
FastSerializerHelper* FastSerializerHelper::writeEscaped(const char* value)
{
- mpSerializer->write(OString(value), true);
+ mpSerializer->write(value, 0, true);
return this;
}