diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-11-12 16:08:21 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-11-12 16:18:36 +0100 |
commit | 95cec52515a51a96e58fae9aa11ca2459365e66d (patch) | |
tree | 70b36f45b7e563ace5e07eb66eb6cb1a0770ac20 /sax | |
parent | dba04714fc5ba0e0f4798351397b61748eaa5785 (diff) |
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
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastattribs.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
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() ); |