diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-03 19:51:47 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-12 14:18:12 +0200 |
commit | 038e4b3b1e10d072b432cb06234521ae9a262a70 (patch) | |
tree | 6fb8087fd6a11fea6440dae91e8419043ad5f784 /sax | |
parent | 7bc6a7187c26690c64acb397e68d921be71e362e (diff) |
Use hasElements to check Sequence emptiness in sax..sdext
Similar to clang-tidy readability-container-size-empty
Change-Id: If6a567708d3c59355d54933fad23c85195846624
Reviewed-on: https://gerrit.libreoffice.org/71763
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/attributes.cxx | 2 | ||||
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 2 | ||||
-rw-r--r-- | sax/source/expatwrap/xml2utf.cxx | 6 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 2 | ||||
-rw-r--r-- | sax/source/fastparser/legacyfastparser.cxx | 2 | ||||
-rw-r--r-- | sax/source/tools/fastserializer.cxx | 6 |
6 files changed, 10 insertions, 10 deletions
diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx index c0ffdd7178ab..6c71e9aa182a 100644 --- a/sax/qa/cppunit/attributes.cxx +++ b/sax/qa/cppunit/attributes.cxx @@ -61,7 +61,7 @@ void AttributesTest::test() xAttributeList->clear(); CPPUNIT_ASSERT( !xAttributeList->hasAttribute(1) ); - CPPUNIT_ASSERT_EQUAL( sal_Int32(0), xAttributeList->getFastAttributes().getLength() ); + CPPUNIT_ASSERT( !xAttributeList->getFastAttributes().hasElements() ); xAttributeList->addUnknown("c", "c"); CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xAttributeList->getUnknownAttributes().getLength() ); } diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index e98da4dd2a83..2ba000328529 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -372,7 +372,7 @@ void SAL_CALL SaxExpatParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments) { // possible arguments: a string "DoSmeplease" - if (rArguments.getLength()) + if (rArguments.hasElements()) { OUString str; if ((rArguments[0] >>= str) && "DoSmeplease" == str) diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 535075e1f7e2..c71f0bf2a993 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -59,7 +59,7 @@ sal_Int32 XMLFile2UTFConverter::readAndConvert( Sequence<sal_Int8> &seq , sal_In if( ! m_bStarted && nRead ) { // ensure that enough data is available to parse encoding - if( seqStart.getLength() ) + if( seqStart.hasElements() ) { // prefix with what we had so far. sal_Int32 nLength = seq.getLength(); @@ -382,7 +382,7 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> & const sal_Int8 *pbSource = seqText.getConstArray(); std::unique_ptr<sal_Int8[]> pbTempMem; - if( m_seqSource.getLength() ) { + if( m_seqSource.hasElements() ) { // put old rest and new byte sequence into one array pbTempMem.reset(new sal_Int8[ nSourceSize ]); memcpy( pbTempMem.get() , m_seqSource.getConstArray() , m_seqSource.getLength() ); @@ -450,7 +450,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource , { std::unique_ptr<sal_Unicode[]> puTempMem; - if( m_seqSource.getLength() ) { + if( m_seqSource.hasElements() ) { // For surrogates ! // put old rest and new byte sequence into one array // In general when surrogates are used, they should be rarely diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 01557cc608d4..1ac7b209d311 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -1334,7 +1334,7 @@ FastSaxParser::~FastSaxParser() void SAL_CALL FastSaxParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments) { - if (rArguments.getLength()) + if (rArguments.hasElements()) { OUString str; if ( rArguments[0] >>= str ) diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx index ba047016df8d..53b3ac8ef78c 100644 --- a/sax/source/fastparser/legacyfastparser.cxx +++ b/sax/source/fastparser/legacyfastparser.cxx @@ -296,7 +296,7 @@ SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new Namespace void SAL_CALL SaxLegacyFastParser::initialize(Sequence< Any > const& rArguments ) { - if (rArguments.getLength()) + if (rArguments.hasElements()) { Reference< XFastTokenHandler > xTokenHandler; OUString str; diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index f6849e8abf5d..4a4091438a40 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -255,15 +255,15 @@ namespace sax_fastparser { { if( HAS_NAMESPACE( nElement ) ) { auto const Namespace(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement))); - assert(Namespace.getLength() != 0); + assert(Namespace.hasElements()); writeBytes(Namespace); writeBytes(sColon, N_CHARS(sColon)); auto const Element(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement))); - assert(Element.getLength() != 0); + assert(Element.hasElements()); writeBytes(Element); } else { auto const Element(mxFastTokenHandler->getUTF8Identifier(nElement)); - assert(Element.getLength() != 0); + assert(Element.hasElements()); writeBytes(Element); } } |