diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-26 15:28:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-26 17:07:18 +0100 |
commit | efe57384953c2a9eeb5f8fd65c2d548759ef05f7 (patch) | |
tree | 87f9c6880c59398978c30a185fb15ea174c66130 | |
parent | 5784ba5ffed88c4fa5da0ac6d06fd2e70a8456c1 (diff) |
cppcheck: variable scope
Change-Id: I27ab82d32df984a86af1a2abda491581bff70a2c
-rw-r--r-- | vcl/source/window/splitwin.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/randrwrapper.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/forms/elementexport.cxx | 13 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx | 7 |
6 files changed, 18 insertions, 15 deletions
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 108251ca1f4c..752e193e9b37 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -567,7 +567,6 @@ static void ImplCalcSet( ImplSplitSet* pSet, { nAbsItems = 0; long nSizeWinSize = 0; - long nNewSizeWinSize = 0; // first resize absolute items relative for ( i = 0; i < nItems; i++ ) @@ -584,6 +583,8 @@ static void ImplCalcSet( ImplSplitSet* pSet, // do not compensate rounding errors here if ( (nAbsItems < (sal_uInt16)(std::abs( nSizeDelta ))) && nSizeWinSize ) { + long nNewSizeWinSize = 0; + for ( i = 0; i < nItems; i++ ) { if ( !(rItems[i]->mnBits & SplitWindowItemFlags::Invisible) ) @@ -595,6 +596,7 @@ static void ImplCalcSet( ImplSplitSet* pSet, } } } + nSizeDelta -= nNewSizeWinSize-nSizeWinSize; } diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx index 4913625b4cd8..54b822f2871f 100644 --- a/vcl/unx/generic/app/randrwrapper.cxx +++ b/vcl/unx/generic/app/randrwrapper.cxx @@ -137,11 +137,10 @@ void SalDisplay::DeInitRandR() void SalDisplay::processRandREvent( XEvent* pEvent ) { #ifdef USE_RANDR - int nRet = 0; XConfigureEvent* pCnfEvent=reinterpret_cast<XConfigureEvent*>(pEvent); if( m_bUseRandRWrapper && pWrapper && pWrapper->XRRRootToScreen(GetDisplay(),pCnfEvent->window) != -1 ) { - nRet = pWrapper->XRRUpdateConfiguration( pEvent ); + int nRet = pWrapper->XRRUpdateConfiguration( pEvent ); if( nRet == 1 && pEvent->type != ConfigureNotify) // this should then be a XRRScreenChangeNotifyEvent { // update screens diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index ec5325066e04..c715ce0a7f71 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -2368,7 +2368,6 @@ Time SalDisplay::GetLastUserEventTime( bool i_bAlwaysReget ) const bool SalDisplay::XIfEventWithTimeout( XEvent* o_pEvent, XPointer i_pPredicateData, X_if_predicate i_pPredicate ) const { - long nTimeout = 1000; /* #i99360# ugly workaround an X11 library bug this replaces the following call: XIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ); @@ -2382,6 +2381,7 @@ bool SalDisplay::XIfEventWithTimeout( XEvent* o_pEvent, XPointer i_pPredicateDat aFD.fd = ConnectionNumber(GetDisplay()); aFD.events = POLLIN; aFD.revents = 0; + long nTimeout = 1000; (void)poll(&aFD, 1, nTimeout); if( ! XCheckIfEvent( GetDisplay(), o_pEvent, i_pPredicate, i_pPredicateData ) ) { diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 957afb14b381..887c3ed80216 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -946,8 +946,6 @@ IMPL_LINK_NOARG_TYPED(PrintFontManager, autoInstallFontLangSupport, Timer *, voi void PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissingCodes ) { - bool bRet = false; - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); // build pattern argument for fontconfig query @@ -1016,6 +1014,8 @@ void PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi { if( pSet->nfont > 0 ) { + bool bRet = false; + //extract the closest match FcChar8* file = nullptr; FcResult eFileRes = FcPatternGetString(pSet->fonts[0], FC_FILE, 0, &file); 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<XAttributeList> & 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++) { |