summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 12:29:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-28 13:25:27 +0200
commit1705fbe9daac56ee9bea8d8fd7c7f57e2bec49b5 (patch)
treeaaf39244173a4cf20df6568140ebdbe5ec055656 /sw
parentdfa8e18e8e6c7ad87e423393f8293a20188de1fd (diff)
move the castToFastAttributeList function
to the slightly higher namespace, to make it easy and more readable to use directly in a for-loop-range expression. And make it return a reference rather than a pointer, since it is never allowed to be nullptr. Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/swg/SwXMLSectionList.cxx5
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx5
2 files changed, 2 insertions, 8 deletions
diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx
index d0df14d7e90d..13282cf12aac 100644
--- a/sw/source/core/swg/SwXMLSectionList.cxx
+++ b/sw/source/core/swg/SwXMLSectionList.cxx
@@ -121,11 +121,8 @@ css::uno::Reference<css::xml::sax::XFastContextHandler> SvXMLSectionListContext:
Element == XML_ELEMENT(TEXT_OOO, XML_SECTION ) ||
Element == XML_ELEMENT(TEXT_OOO, XML_BOOKMARK) )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
-
OUString sName;
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
if (aIter.getToken() == XML_ELEMENT(TEXT, XML_NAME) ||
aIter.getToken() == XML_ELEMENT(TEXT_OOO, XML_NAME))
sName = aIter.toString();
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 3f86ea101b75..8b57e2047a47 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -277,10 +277,7 @@ public:
OUString displayName;
XmlStyleFamily nFamily(XmlStyleFamily::DATA_STYLE);
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
-
- for (auto &aIter : *pAttribList)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
if (aIter.getToken() == (XML_NAMESPACE_STYLE | XML_FAMILY))
{
if (IsXMLToken(aIter.toString(), XML_TEXT))