summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
Diffstat (limited to 'sax')
-rw-r--r--sax/source/expatwrap/xml2utf.cxx11
-rw-r--r--sax/source/fastparser/fastparser.cxx7
-rw-r--r--sax/source/fastparser/legacyfastparser.cxx18
-rw-r--r--sax/source/tools/fastserializer.cxx4
4 files changed, 15 insertions, 25 deletions
diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx
index c71f0bf2a993..103ef46344cb 100644
--- a/sax/source/expatwrap/xml2utf.cxx
+++ b/sax/source/expatwrap/xml2utf.cxx
@@ -187,15 +187,8 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s
if( bCheckIfFirstClosingBracketExsists )
{
- for( sal_Int32 i = 0; i < seq.getLength() ; i ++ )
- {
- // whole <?xml tag is valid
- if( '>' == pSource[ i ] )
- {
- return true;
- }
- }
- return false;
+ // whole <?xml tag is valid
+ return std::find(seq.begin(), seq.end(), '>') != seq.end();
}
// No <? tag in front, no need for a bigger buffer
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 4f1641f80b76..517f16f7c14a 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -408,11 +408,10 @@ void Entity::startElement( Event const *pEvent )
if ( mxNamespaceHandler.is() )
{
- Sequence< xml::Attribute > NSDeclAttribs = pEvent->mxDeclAttributes->getUnknownAttributes();
- sal_uInt16 len = NSDeclAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::Attribute > NSDeclAttribs = pEvent->mxDeclAttributes->getUnknownAttributes();
+ for (const auto& rNSDeclAttrib : NSDeclAttribs)
{
- mxNamespaceHandler->registerNamespace( NSDeclAttribs[i].Name, NSDeclAttribs[i].Value );
+ mxNamespaceHandler->registerNamespace( rNSDeclAttrib.Name, rNSDeclAttrib.Value );
}
}
diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx
index 13dfc3b1d9bf..994835acc666 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -227,12 +227,11 @@ void SAL_CALL CallbackDocumentHandler::startUnknownElement( const OUString& /*Na
rtl::Reference < comphelper::AttributeList > rAttrList = new comphelper::AttributeList;
m_aNamespaceHandler->addNSDeclAttributes( rAttrList );
- Sequence< xml::FastAttribute > fastAttribs = Attribs->getFastAttributes();
- sal_uInt16 len = fastAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::FastAttribute > fastAttribs = Attribs->getFastAttributes();
+ for (const auto& rAttr : fastAttribs)
{
- const OUString& rAttrValue = fastAttribs[i].Value;
- sal_Int32 nToken = fastAttribs[i].Token;
+ const OUString& rAttrValue = rAttr.Value;
+ sal_Int32 nToken = rAttr.Token;
const OUString& rAttrNamespacePrefix = CallbackDocumentHandler::getNamespacePrefixFromToken( nToken );
OUString sAttrName = CallbackDocumentHandler::getNameFromToken( nToken );
if ( !rAttrNamespacePrefix.isEmpty() )
@@ -241,12 +240,11 @@ void SAL_CALL CallbackDocumentHandler::startUnknownElement( const OUString& /*Na
rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
}
- Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
- len = unknownAttribs.getLength();
- for (sal_uInt16 i = 0; i < len; i++)
+ const Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
+ for (const auto& rAttr : unknownAttribs)
{
- const OUString& rAttrValue = unknownAttribs[i].Value;
- const OUString& rAttrName = unknownAttribs[i].Name;
+ const OUString& rAttrValue = rAttr.Value;
+ const OUString& rAttrName = rAttr.Name;
rAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue );
}
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 70a359b1c5ee..444924f0d521 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -773,9 +773,9 @@ namespace sax_fastparser {
// Sort it all
std::map< sal_Int32, Int8Sequence >::iterator iter;
- for ( sal_Int32 i=0, len=maOrder.getLength(); i < len; i++ )
+ for ( const auto nIndex : std::as_const(maOrder) )
{
- iter = maData.find( maOrder[i] );
+ iter = maData.find( nIndex );
if ( iter != maData.end() )
ForMerge::append( iter->second );
}