From efe57384953c2a9eeb5f8fd65c2d548759ef05f7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 26 May 2016 15:28:05 +0100 Subject: cppcheck: variable scope Change-Id: I27ab82d32df984a86af1a2abda491581bff70a2c --- xmloff/source/forms/elementexport.cxx | 13 ++++++++----- .../text/XMLIndexBibliographyConfigurationContext.cxx | 7 +++---- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index b80d7b0bb2c6..688c6e8427fb 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -778,31 +778,34 @@ namespace xmloff // get the property names getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName); - static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue); - static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value); - static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentValue); - static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Value); - // add the attributes if necessary and possible if (pCurrentValuePropertyName && (CCAFlags::CurrentValue & m_nIncludeCommon)) { + static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue); // don't export the current-value if this value originates from a data binding // #i26944# if ( controlHasActiveDataBinding() ) exportedProperty( OUString::createFromAscii( pCurrentValuePropertyName ) ); else + { + static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentValue); exportGenericPropertyAttribute( nCurrentValueAttributeNamespaceKey, pCurrentValueAttributeName, pCurrentValuePropertyName ); + } } if (pValuePropertyName && (CCAFlags::Value & m_nIncludeCommon)) + { + static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value); + static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Value); exportGenericPropertyAttribute( nValueAttributeNamespaceKey, pValueAttributeName, pValuePropertyName); + } OSL_ENSURE((nullptr == pValuePropertyName) == (CCAFlags::NONE == (CCAFlags::Value & m_nIncludeCommon)), "OControlExport::exportCommonControlAttributes: no property found for the value attribute!"); diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx index 8e961ea92606..30d2dd4a924a 100644 --- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx @@ -151,19 +151,18 @@ void XMLIndexBibliographyConfigurationContext::ProcessAttribute( } } - SvXMLImportContext *XMLIndexBibliographyConfigurationContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference & xAttrList ) { - OUString sKey; - bool bSort(true); - // process children here and use default context! if ( ( nPrefix == XML_NAMESPACE_TEXT ) && IsXMLToken( rLocalName, XML_SORT_KEY ) ) { + OUString sKey; + bool bSort(true); + sal_Int16 nLength = xAttrList->getLength(); for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++) { -- cgit