summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-11-12 16:08:21 +0100
committerLuboš Luňák <l.lunak@collabora.com>2014-11-12 18:10:22 +0100
commit7c19553a30335f746e0967af1a346a7b6c8bd44f (patch)
treee7b2f5f539b09c5d063ca6994ac5ffee61152127
parentsc: one CPU is parsing, one is populating -> halve the thread count. (diff)
downloadcore-7c19553a30335f746e0967af1a346a7b6c8bd44f.tar.gz
core-7c19553a30335f746e0967af1a346a7b6c8bd44f.zip
allow inserting attributes that have zero length
Otherwise the strlen() might give an incorrect length if the attribute value is just a part of a longer string. Change-Id: I67eb7baecfa928fdee26c5ea9003bd7fc9b96d59
-rw-r--r--include/sax/fastattribs.hxx3
-rw-r--r--sax/source/tools/fastattribs.cxx7
2 files changed, 7 insertions, 3 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 85a1218e8616..39f5a5f814a2 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -80,7 +80,8 @@ public:
virtual ~FastAttributeList();
void clear();
- void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength = 0 );
+ void add( sal_Int32 nToken, const sal_Char* pValue );
+ void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
void add( sal_Int32 nToken, const OString& rValue );
void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue );
void addUnknown( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue );
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index e2cbcc677238..36277cf3a236 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -79,8 +79,6 @@ void FastAttributeList::clear()
void FastAttributeList::add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength )
{
maAttributeTokens.push_back( nToken );
- if (nValueLength == 0)
- nValueLength = strlen(pValue);
sal_Int32 nWritePosition = maAttributeValues.back();
maAttributeValues.push_back( maAttributeValues.back() + nValueLength + 1 );
if (maAttributeValues.back() > mnChunkLength)
@@ -92,6 +90,11 @@ void FastAttributeList::add( sal_Int32 nToken, const sal_Char* pValue, size_t nV
mpChunk[nWritePosition + nValueLength] = '\0';
}
+void FastAttributeList::add( sal_Int32 nToken, const sal_Char* pValue )
+{
+ add( nToken, pValue, strlen( pValue ));
+}
+
void FastAttributeList::add( sal_Int32 nToken, const OString& rValue )
{
add( nToken, rValue.getStr(), rValue.getLength() );