[Libreoffice-commits] core.git: accessibility/source basctl/source basic/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jun 20 05:50:35 UTC 2017


 accessibility/source/extended/accessiblelistbox.cxx      |   18 --------------
 accessibility/source/standard/vclxaccessiblecheckbox.cxx |    3 --
 basctl/source/basicide/baside2.cxx                       |    3 --
 basctl/source/basicide/baside2b.cxx                      |    2 -
 basctl/source/basicide/baside3.cxx                       |    6 +---
 basctl/source/basicide/basides1.cxx                      |    6 +---
 basctl/source/basicide/scriptdocument.cxx                |    9 ++-----
 basctl/source/dlged/dlgedobj.cxx                         |    4 ---
 basic/source/classes/sb.cxx                              |    6 +---
 basic/source/classes/sbunoobj.cxx                        |    7 +----
 basic/source/classes/sbxmod.cxx                          |    8 ++----
 basic/source/comp/dim.cxx                                |    3 --
 basic/source/comp/exprtree.cxx                           |    6 +---
 basic/source/runtime/iosys.cxx                           |    3 --
 basic/source/runtime/methods.cxx                         |    6 +---
 basic/source/runtime/methods1.cxx                        |   11 +++-----
 basic/source/runtime/runtime.cxx                         |    6 +---
 basic/source/sbx/sbxcurr.cxx                             |    6 ++--
 basic/source/sbx/sbxvalue.cxx                            |    6 +---
 basic/source/uno/namecont.cxx                            |   19 +++++----------
 basic/source/uno/scriptcont.cxx                          |   13 +++-------
 21 files changed, 47 insertions(+), 104 deletions(-)

New commits:
commit 6ee9f2c188290ba8a8bc6d435f645b31a05783ea
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jun 19 16:02:12 2017 +0200

    loplugin:oncevar accessibility..basic
    
    Change-Id: I8fb41b658ef0f6ad1774ea897eace3dc9bb12de6
    Reviewed-on: https://gerrit.libreoffice.org/38969
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index dd96005ee3dd..a79c7a67d4d6 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -120,23 +120,7 @@ namespace accessibility
             case VclEventId::ListboxTreeFocus:
                 {
                     VclPtr<SvTreeListBox> pBox = getListBox();
-                    bool bNeedFocus = false;
-                    if (pBox)
-                    {
-                        vcl::Window* pParent = static_cast<vcl::Window*>(pBox)->GetParent();
-                        if (pParent && pParent->GetType() == WindowType::FLOATINGWINDOW)
-                        {
-                            // MT: ImplGetAppSVData shouldn't be exported from VCL.
-                            // In which scenario is this needed?
-                            // If needed, we need to find an other solution
-                            /*
-                              ImplSVData* pSVData = ImplGetAppSVData();
-                              if (pSVData && pSVData->maWinData.mpFirstFloat == (FloatingWindow*)pParent)
-                              bNeedFocus = true;
-                            */
-                        }
-                    }
-                    if( pBox && (pBox->HasFocus() || bNeedFocus) )
+                    if( pBox && pBox->HasFocus() )
                     {
                         uno::Any aNewValue;
                         SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() );
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index c0c9ce262929..5e4adfc6d6c4 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -191,7 +191,6 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex )
     VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
     if ( pCheckBox && pVCLXCheckBox )
     {
-        sal_Int32 nValueMin = (sal_Int32) 0;
         sal_Int32 nValueMax = (sal_Int32) 1;
 
         if ( pCheckBox->IsTriStateEnabled() )
@@ -202,7 +201,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex )
         ++nValue;
 
         if ( nValue > nValueMax )
-            nValue = nValueMin;
+            nValue = 0;
 
         pVCLXCheckBox->setState( (sal_Int16) nValue );
     }
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index b18a1bb6b664..9219cde9e7cf 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -810,7 +810,6 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
     {
         nLineHeight = 1;
     }
-    sal_Int32 nParaSpace = 10;
 
     Size aPaperSz = pPrinter->GetOutputSize();
     aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin);
@@ -848,7 +847,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
             if( nCurPage-1 == nPrintPage )
                 pPrinter->DrawText( aPos, aTmpLine );
         }
-        aPos.Y() += nParaSpace;
+        aPos.Y() += 10; // nParaSpace
     }
 
     pPrinter->SetFont( aOldFont );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 825d5ffc70f3..b4e449b99fa9 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1596,7 +1596,7 @@ WatchWindow::WatchWindow (Layout* pParent)
 
     long nVarTabWidth = 220;
     long nValueTabWidth = 100;
-    long nTypeTabWidth = 1250;
+    long const nTypeTabWidth = 1250;
     aHeaderBar->InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE), nVarTabWidth );
     aHeaderBar->InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE), nValueTabWidth );
     aHeaderBar->InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE), nTypeTabWidth );
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index affd163b25ce..ddf2113b3fe3 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -676,7 +676,6 @@ void DialogWindow::SaveDialog()
                 OUString aDialogName( aURLObj.getName() );
                 aURLObj.removeSegment();
                 OUString aURL( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
-                bool bReadOnly = false;
                 OUString aComment = "# " + aDialogName + " strings" ;
                 Reference< task::XInteractionHandler > xDummyHandler;
 
@@ -719,7 +718,7 @@ void DialogWindow::SaveDialog()
                 }
 
                 Reference< XStringResourceWithLocation > xStringResourceWithLocation =
-                    StringResourceWithLocation::create( xContext, aURL, bReadOnly,
+                    StringResourceWithLocation::create( xContext, aURL, false/*bReadOnly*/,
                         xStringResourceResolver->getDefaultLocale(), aDialogName, aComment, xDummyHandler );
 
                 // Add locales
@@ -941,9 +940,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
             // Resource?
             css::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
             Reference< task::XInteractionHandler > xDummyHandler;
-            bool bReadOnly = true;
             Reference< XStringResourceWithLocation > xImportStringResource =
-                StringResourceWithLocation::create( xContext, aBasePath, bReadOnly,
+                StringResourceWithLocation::create( xContext, aBasePath, true/*bReadOnly*/,
                 aLocale, aXmlDlgName, OUString(), xDummyHandler );
 
             Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 61be4c544eed..a1c9304139ec 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -591,7 +591,6 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             {
                 OUString aName( pNameItem->GetValue() );
                 OUString aModType( "Module" );
-                OUString aDlgType( "Dialog" );
                 OUString aType( aModType );
                 const SfxStringItem* pTypeItem = rReq.GetArg<SfxStringItem>(SID_BASICIDE_ARG_TYPE);
                 if ( pTypeItem )
@@ -600,7 +599,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
                 BaseWindow* pWin = nullptr;
                 if ( aType == aModType )
                     pWin = FindBasWin( *pDocument, aLibName, aName );
-                else if ( aType == aDlgType )
+                else if ( aType == "Dialog" )
                     pWin = FindDlgWin( *pDocument, aLibName, aName );
 
                 if ( pWin )
@@ -873,8 +872,7 @@ void Shell::GetState(SfxItemSet &rSet)
             break;
             case SID_BASICIDE_STAT_DATE:
             {
-                OUString aDate( "Datum?!" );
-                SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate );
+                SfxStringItem aItem( SID_BASICIDE_STAT_DATE, "Datum?!" );
                 rSet.Put( aItem );
             }
             break;
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index f85c8ad4a800..abbb47cad672 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -953,12 +953,9 @@ namespace basctl
                 OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None );
                 OUString aCanonicalFileURL( aFileStatus.getFileURL() );
 
-                OUString aSearchURL1( "share/basic" );
-                OUString aSearchURL2( "share/uno_packages" );
-                OUString aSearchURL3( "share/extensions" );
-                if( aCanonicalFileURL.indexOf( aSearchURL1 ) >= 0 ||
-                    aCanonicalFileURL.indexOf( aSearchURL2 ) >= 0 ||
-                    aCanonicalFileURL.indexOf( aSearchURL3 ) >= 0 )
+                if( aCanonicalFileURL.indexOf( "share/basic" ) >= 0 ||
+                    aCanonicalFileURL.indexOf( "share/uno_packages" ) >= 0 ||
+                    aCanonicalFileURL.indexOf( "share/extensions" ) >= 0 )
                         bIsShared = true;
             }
         }
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 8c9f8a9431c7..257d17ec33f7 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -381,13 +381,11 @@ void DlgEdObj::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
     DBG_ASSERT( pDlgEdForm, "DlgEdObj::PositionAndSizeChange: no form!" );
     DlgEdPage& rPage = pDlgEdForm->GetDlgEditor().GetPage();
     {
-        sal_Int32 nPageXIn = 0;
-        sal_Int32 nPageYIn = 0;
         Size aPageSize = rPage.GetSize();
         sal_Int32 nPageWidthIn = aPageSize.Width();
         sal_Int32 nPageHeightIn = aPageSize.Height();
         sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
-        if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
+        if ( TransformSdrToControlCoordinates( 0/*nPageXIn*/, 0/*nPageYIn*/, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
         {
             Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
             if ( xPSet.is() )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3f59b63118ff..9e6e32a0d02a 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -511,8 +511,7 @@ SbxObject* SbFormFactory::CreateObject( const OUString& rClassName )
                 if( bInitState )
                 {
                     // Not the first instantiate, reset
-                    bool bTriggerTerminateEvent = false;
-                    pFormModule->ResetApiObj( bTriggerTerminateEvent );
+                    pFormModule->ResetApiObj( false/*bTriggerTerminateEvent*/ );
                     pFormModule->setInitState( false );
                 }
                 else
@@ -747,8 +746,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
                         }
                         else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
                         {
-                            OUString aCollectionName("Collection");
-                            BasicCollection* pNewCollection = new BasicCollection( aCollectionName );
+                            BasicCollection* pNewCollection = new BasicCollection( "Collection" );
                             pNewCollection->SetName( pProp->GetName() );
                             pNewCollection->SetParent( pClassModule->pParent );
                             pNewProp->PutObject( pNewCollection );
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index f102e4efa694..7b755de3ee16 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -2221,8 +2221,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                 }
                 else if( bInvocation && pParams && mxInvocation.is() )
                 {
-                    bool bOLEAutomation = true;
-                    processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
+                    processAutomationParams( pParams, args, true/*bOLEAutomation*/, nParamCount );
                 }
 
                 // call the method
@@ -2529,9 +2528,7 @@ SbxInfo* SbUnoMethod::GetInfo()
                 const ParamInfo& rInfo = pParamInfos[i];
                 OUString aParamName = rInfo.aName;
 
-                SbxDataType t = SbxVARIANT;
-                SbxFlagBits nFlags_ = SbxFlagBits::Read;
-                pInfo->AddParam( aParamName, t, nFlags_ );
+                pInfo->AddParam( aParamName, SbxVARIANT, SbxFlagBits::Read );
             }
         }
     }
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index cea279f14b7a..d56894fffe3d 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1999,7 +1999,7 @@ bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer )
         if (nFlag & 0x8000)
         {
             sal_uInt16 nMult = nFlag & 0x7FFF;
-            sal_Int16 nMax = std::numeric_limits<sal_Int16>::max();
+            sal_Int16 const nMax = std::numeric_limits<sal_Int16>::max();
             nStart = nMult * nMax + nTempStart;
         }
         else
@@ -2559,12 +2559,11 @@ void SbUserFormModule::Unload()
     SAL_INFO("basic", "** Unload() ");
 
     sal_Int8 nCancel = 0;
-    sal_Int8 nCloseMode = ::ooo::vba::VbQueryClose::vbFormCode;
 
     Sequence< Any > aParams;
     aParams.realloc(2);
     aParams[0] <<= nCancel;
-    aParams[1] <<= nCloseMode;
+    aParams[1] <<= sal_Int8(::ooo::vba::VbQueryClose::vbFormCode);
 
     triggerMethod( "Userform_QueryClose", aParams);
 
@@ -2609,8 +2608,7 @@ void SbUserFormModule::InitObject()
 {
     try
     {
-        OUString aHook("VBAGlobals");
-        SbUnoObject* pGlobs = static_cast<SbUnoObject*>(GetParent()->Find( aHook, SbxClassType::DontCare ));
+        SbUnoObject* pGlobs = static_cast<SbUnoObject*>(GetParent()->Find( "VBAGlobals", SbxClassType::DontCare ));
         if ( m_xModel.is() && pGlobs )
         {
             // broadcast INITIALIZE_USERFORM script event before the dialog is created
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 3b3a0e75bd5c..a5d5380a53ed 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -775,12 +775,11 @@ void SbiParser::DefEnum( bool bPrivate )
 
                 if( !bPrivate )
                 {
-                    SbiOpcode eOp = SbiOpcode::GLOBAL_;
                     aGen.BackChain( nGblChain );
                     nGblChain = 0;
                     bGblDefs = bNewGblDefs = true;
                     aGen.Gen(
-                        eOp, pElem->GetId(),
+                        SbiOpcode::GLOBAL_, pElem->GetId(),
                         sal::static_int_cast< sal_uInt16 >( pElem->GetType() ) );
 
                     aVar.Gen();
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index d75b32364e30..3039046f39bd 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -419,8 +419,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
 
     if( DoParametersFollow( pParser, eCurExpr, eTok ) )
     {
-        bool bStandaloneExpression = false;
-        pPar = SbiExprList::ParseParameters( pParser, bStandaloneExpression );
+        pPar = SbiExprList::ParseParameters( pParser, false/*bStandaloneExpression*/ );
         bError = bError || !pPar->IsValid();
         eTok = pParser->Peek();
 
@@ -605,8 +604,7 @@ SbiExprNode* SbiExpression::Unary()
         case TYPEOF:
         {
             pParser->Next();
-            bool bUsedForTypeOf = true;
-            SbiExprNode* pObjNode = Operand( bUsedForTypeOf );
+            SbiExprNode* pObjNode = Operand( true/*bUsedForTypeOf*/ );
             pParser->TestToken( IS );
             OUString aDummy;
             SbiSymDef* pTypeDef = new SbiSymDef( aDummy );
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 5782026bc946..472c4321e0ec 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -589,10 +589,9 @@ void SbiStream::ExpandFile()
         if( nCur < nExpandOnWriteTo )
         {
             sal_uInt64 nDiff = nExpandOnWriteTo - nCur;
-            char c = 0;
             while( nDiff-- )
             {
-                pStrm->WriteChar( c );
+                pStrm->WriteChar( 0 );
             }
         }
         else
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 15f357c9950f..1ca9282f5468 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -372,8 +372,7 @@ RTLFUNC(Chr)
     (void)pBasic;
     (void)bWrite;
 
-    bool bChrW = false;
-    implChr( rPar, bChrW );
+    implChr( rPar, false/*bChrW*/ );
 }
 
 RTLFUNC(ChrW)
@@ -381,8 +380,7 @@ RTLFUNC(ChrW)
     (void)pBasic;
     (void)bWrite;
 
-    bool bChrW = true;
-    implChr( rPar, bChrW );
+    implChr( rPar, true/*bChrW*/ );
 }
 
 RTLFUNC(CurDir)
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 8ebcab989e08..f8ad651fae30 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -2260,20 +2260,17 @@ RTLFUNC(DateDiff)
         }
         case INTERVAL_H:
         {
-            double dFactor = 24.0;
-            dRet = RoundImpl( dFactor * (dDate2 - dDate1) );
+            dRet = RoundImpl( 24.0 * (dDate2 - dDate1) );
             break;
         }
         case INTERVAL_N:
         {
-            double dFactor =1440.0;
-            dRet = RoundImpl( dFactor * (dDate2 - dDate1) );
+            dRet = RoundImpl( 1440.0 * (dDate2 - dDate1) );
             break;
         }
         case INTERVAL_S:
         {
-            double dFactor = 86400.0;
-            dRet = RoundImpl( dFactor * (dDate2 - dDate1) );
+            dRet = RoundImpl( 86400.0 * (dDate2 - dDate1) );
             break;
         }
     }
@@ -3174,7 +3171,7 @@ RTLFUNC(Rate)
     if ( nArgCount >= 6 )
     {
         if( rPar.Get(6)->GetType() != SbxEMPTY )
-            type = rPar.Get(6)->GetDouble();
+            guess = rPar.Get(6)->GetDouble();
     }
 
     Sequence< Any > aParams( 6 );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index f43e882d87a4..d33e584dce20 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -433,8 +433,7 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx
     pNumberFormater->PutandConvertEntry( aStr, nCheckPos, nType,
         rnStdDateIdx, LANGUAGE_ENGLISH_US, eLangType );
     nCheckPos = 0;
-    OUString aStrHHMMSS(" HH:MM:SS");
-    aDateStr += aStrHHMMSS;
+    aDateStr += " HH:MM:SS";
     aStr = aDateStr;
     pNumberFormater->PutandConvertEntry( aStr, nCheckPos, nType,
         rnStdDateTimeIdx, LANGUAGE_ENGLISH_US, eLangType );
@@ -486,8 +485,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
         aErrorMsg = rMsg;
         SbiRuntime::translateErrorToVba( n, aErrorMsg );
 
-        bool bVBATranslationAlreadyDone = true;
-        pRun->Error( ERRCODE_BASIC_COMPAT, bVBATranslationAlreadyDone );
+        pRun->Error( ERRCODE_BASIC_COMPAT, true/*bVBATranslationAlreadyDone*/ );
     }
 }
 
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 9f013ea64f8c..e4d525bd794e 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -31,7 +31,7 @@ static OUString ImpCurrencyToString( sal_Int64 rVal )
     bool isNeg = ( rVal < 0 );
     sal_Int64 absVal = isNeg ? -rVal : rVal;
 
-    sal_Unicode cDecimalSep = '.';
+    sal_Unicode const cDecimalSep = '.';
 
     OUString aAbsStr = OUString::number( absVal );
     OUStringBuffer aBuf;
@@ -92,8 +92,8 @@ static sal_Int64 ImpStringToCurrency( const OUString &rStr )
 
     sal_Int32   nFractDigit = 4;
 
-    sal_Unicode cDeciPnt = '.';
-    sal_Unicode c1000Sep = ',';
+    sal_Unicode const cDeciPnt = '.';
+    sal_Unicode const c1000Sep = ',';
 
     // lets use the existing string number conversions
     // there is a performance impact here ( multiple string copies )
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 10c3e0620016..e18e4afa7180 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1594,14 +1594,12 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
             r.WriteUInt32( aData.nULong ); break;
         case SbxINT:
         {
-            sal_uInt8 n = SAL_TYPES_SIZEOFINT;
-            r.WriteUChar( n ).WriteInt32( aData.nInt );
+            r.WriteUChar( SAL_TYPES_SIZEOFINT ).WriteInt32( aData.nInt );
             break;
         }
         case SbxUINT:
         {
-            sal_uInt8 n = SAL_TYPES_SIZEOFINT;
-            r.WriteUChar( n ).WriteUInt32( aData.nUInt );
+            r.WriteUChar( SAL_TYPES_SIZEOFINT ).WriteUInt32( aData.nUInt );
             break;
         }
         case SbxEMPTY:
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 0d5a4c1b0e22..a76d47a23723 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1036,11 +1036,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
                                           aCheckFileName, aXlbExtension, mxSFI );
 
                     // Check if module1.xba exists
-                    OUString aXbaExtension("xba");
                     aCheckFileName = "Module1";
                     checkAndCopyFileImpl( aUserBasicStandardInetObj,
                                           aPrevUserBasicStandardInetObj,
-                                          aCheckFileName, aXbaExtension, mxSFI );
+                                          aCheckFileName, "xba", mxSFI );
                 }
                 else
                 {
@@ -1102,8 +1101,8 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
 
                 OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
                 OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
-                OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
-                OUString aInstSearchStr("$(INST)");
+                OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+                OUString const aInstSearchStr("$(INST)");
 
                 Sequence< OUString > aNames = pPrevCont->getElementNames();
                 const OUString* pNames = aNames.getConstArray();
@@ -1413,8 +1412,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
                                                                     embed::ElementModes::READWRITE );
                 //    throw uno::RuntimeException(); // TODO: method must either return the stream or throw an exception
 
-                OUString aMime( "text/xml" );
-
                 uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
                 SAL_WARN_IF(
                     !xProps.is(), "basic",
@@ -1423,7 +1420,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
 
                 if ( xProps.is() )
                 {
-                    xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+                    xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
 
                     // #87671 Allow encryption
                     xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -1561,8 +1558,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
 
             if ( xProps.is() )
             {
-                OUString aMime("text/xml");
-                xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+                xProps->setPropertyValue("MediaType", uno::Any( OUString("text/xml") ) );
 
                 // #87671 Allow encryption
                 xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -2076,8 +2072,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
         {
             xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
             uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY_THROW );
-            OUString aMime( "text/xml" );
-            xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+            xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
 
             // #87671 Allow encryption
             xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -2224,7 +2219,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
 
     OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
     OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
-    OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+    OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
     if( StorageURL.indexOf( aUserSearchStr ) != -1 )
     {
         pNewLib->mbExtension = true;
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index b93217485929..327e9d33fd01 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -662,8 +662,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
                             aSourceStreamName,
                             embed::ElementModes::READWRITE );
                     uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW );
-                    OUString aMime( "text/xml" );
-                    xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+                    xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
 
                     // Set encryption key
                     setStreamKey( xSourceStream, pLib->maPassword );
@@ -746,10 +745,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
                     SbModule* pMod = pBasicLib->FindModule( aElementName );
                     if( pMod )
                     {
-                        OUString aCodeStreamName( "code.bin" );
-
                         uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement(
-                                            aCodeStreamName,
+                                            "code.bin",
                                             embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
 
                         SvMemoryStream aMemStream;
@@ -792,8 +789,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
                     }
 
                     uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW );
-                    OUString aMime( "text/xml" );
-                    xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+                    xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
 
                     Reference< XOutputStream > xOut = xSourceStream->getOutputStream();
                     Reference< XNameContainer > xLib( pLib );
@@ -1023,9 +1019,8 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
 
                         try
                         {
-                            OUString aCodeStreamName( "code.bin" );
                             uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement(
-                                                                        aCodeStreamName,
+                                                                        "code.bin",
                                                                         embed::ElementModes::READ );
 
                             std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream ));


More information about the Libreoffice-commits mailing list