[Libreoffice-commits] core.git: oox/qa oox/source opencl/source package/source reportdesign/source sal/osl sal/textenc sax/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jun 26 06:57:09 UTC 2017


 oox/qa/unit/vba_encryption.cxx                     |    2 +-
 oox/source/core/binarycodec.cxx                    |    4 +---
 oox/source/crypto/Standard2007Engine.cxx           |    3 +--
 oox/source/drawingml/shape.cxx                     |    5 +----
 oox/source/export/ColorPropertySet.cxx             |    3 +--
 oox/source/export/chartexport.cxx                  |   15 +++++----------
 oox/source/export/shapes.cxx                       |    3 +--
 oox/source/ole/olehelper.cxx                       |    2 +-
 opencl/source/opencl_device.cxx                    |    3 +--
 package/source/xstor/xstorage.cxx                  |    5 +----
 package/source/zippackage/ZipPackage.cxx           |   15 ++++-----------
 package/source/zippackage/ZipPackageFolder.cxx     |    4 +---
 reportdesign/source/core/api/ReportDefinition.cxx  |   12 +++---------
 reportdesign/source/core/api/ReportEngineJFree.cxx |    5 ++---
 reportdesign/source/core/misc/reportformula.cxx    |    4 +---
 reportdesign/source/ui/dlg/Navigator.cxx           |    3 +--
 reportdesign/source/ui/report/ReportController.cxx |    3 +--
 reportdesign/source/ui/report/dlgedfunc.cxx        |    3 +--
 sal/osl/all/filepath.cxx                           |    3 +--
 sal/osl/unx/file_misc.cxx                          |    4 +---
 sal/osl/unx/pipe.cxx                               |    3 +--
 sal/textenc/convertisciidevangari.cxx              |    2 +-
 sal/textenc/convertsinglebytetobmpunicode.cxx      |    3 +--
 sax/source/expatwrap/saxwriter.cxx                 |    6 ++----
 24 files changed, 35 insertions(+), 80 deletions(-)

New commits:
commit 979c8c56b7d52fe9a5d4b1fbfdab0adaba04c470
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sun Jun 25 18:20:04 2017 +0200

    loplugin:oncevar in oox..sax
    
    Change-Id: I0fee8bcddaeea48335e3be05761d2ad2c45020e2
    Reviewed-on: https://gerrit.libreoffice.org/39238
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/oox/qa/unit/vba_encryption.cxx b/oox/qa/unit/vba_encryption.cxx
index 37dfeff636f4..60164cb4bc32 100644
--- a/oox/qa/unit/vba_encryption.cxx
+++ b/oox/qa/unit/vba_encryption.cxx
@@ -73,7 +73,7 @@ void TestVbaEncryption::testSimple2()
 
 void TestVbaEncryption::testProjKey1()
 {
-    OUString aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}");
+    OUString const aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}");
     sal_uInt8 nProjKey = VBAEncryption::calculateProjKey(aProjectID);
     CPPUNIT_ASSERT_EQUAL((int)0xdf, (int)nProjKey);
 }
diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx
index 72ae862a0f14..84660d6abb54 100644
--- a/oox/source/core/binarycodec.cxx
+++ b/oox/source/core/binarycodec.cxx
@@ -146,8 +146,6 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] )
     for (sal_Int32 nIndex = nLen; nIndex < static_cast<sal_Int32>(sizeof(mpnKey)); ++nIndex, ++pnFillChar )
         mpnKey[ nIndex ] = *pnFillChar;
 
-    size_t nRotateSize = 2;
-
     // use little-endian base key to create key array
     sal_uInt8 pnBaseKeyLE[ 2 ];
     pnBaseKeyLE[ 0 ] = static_cast< sal_uInt8 >( mnBaseKey );
@@ -156,7 +154,7 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] )
     for (sal_Int32 nIndex = 0; nIndex < static_cast<sal_Int32>(sizeof(mpnKey)); ++nIndex, ++pnKeyChar )
     {
         *pnKeyChar ^= pnBaseKeyLE[ nIndex & 1 ];
-        lclRotateLeft( *pnKeyChar, nRotateSize );
+        lclRotateLeft( *pnKeyChar, 2/*nRotateSize*/ );
     }
 }
 
diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx
index b9c259fa02ac..a11780fddc52 100644
--- a/oox/source/crypto/Standard2007Engine.cxx
+++ b/oox/source/crypto/Standard2007Engine.cxx
@@ -203,8 +203,7 @@ void Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu
     rStream.writeUnicodeArray(lclCspName);
     rStream.WriteUInt16(0);
 
-    sal_uInt32 encryptionVerifierSize = static_cast<sal_uInt32>(sizeof(msfilter::EncryptionVerifierAES));
-    rStream.writeMemory(&mInfo.verifier, encryptionVerifierSize);
+    rStream.writeMemory(&mInfo.verifier, sizeof(msfilter::EncryptionVerifierAES));
 }
 
 void Standard2007Engine::encrypt(BinaryXInputStream& aInputStream,
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7d04518b5f25..a01fd47075d0 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1197,9 +1197,6 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
         Reference < io::XStream > xStream( new utl::OStreamWrapper( aTempStream ) );
         Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
 
-        // Rendering format
-        OUString sFormat( "SVM" );
-
         // Size of the rendering
         awt::Size aActualSize = mxShape->getSize();
         Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MapUnit::MapCM ) );
@@ -1221,7 +1218,7 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
         aDescriptor[ 0 ].Name = "OutputStream";
         aDescriptor[ 0 ].Value <<= xOutputStream;
         aDescriptor[ 1 ].Name = "FilterName";
-        aDescriptor[ 1 ].Value <<= sFormat;
+        aDescriptor[ 1 ].Value <<= OUString("SVM"); // Rendering format
         aDescriptor[ 2 ].Name = "FilterData";
         aDescriptor[ 2 ].Value <<= aFilterData;
 
diff --git a/oox/source/export/ColorPropertySet.cxx b/oox/source/export/ColorPropertySet.cxx
index 768763bf91d4..ec25b10c3c49 100644
--- a/oox/source/export/ColorPropertySet.cxx
+++ b/oox/source/export/ColorPropertySet.cxx
@@ -120,8 +120,7 @@ uno::Any SAL_CALL ColorPropertySet::getPropertyValue( const OUString& aPropertyN
 {
     if( aPropertyName == "FillStyle" && m_bIsFillColor )
     {
-        css::drawing::FillStyle aFillStyle = css::drawing::FillStyle_SOLID;
-        return uno::makeAny(aFillStyle);
+        return uno::makeAny(css::drawing::FillStyle_SOLID);
     }
     else if (aPropertyName == m_aColorPropName)
         return uno::makeAny( m_nColor );
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index d893cc678cb8..2d2d5fdd3536 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -781,8 +781,7 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen
         // Converting absolute path to relative path.
         if( externalDataPath[ 0 ] != '.' && externalDataPath[ 1 ] != '.')
         {
-            sal_Int32 nStartPos = 0;
-            sal_Int32 nSepPos = externalDataPath.indexOf( '/', nStartPos );
+            sal_Int32 nSepPos = externalDataPath.indexOf( '/', 0 );
             if( nSepPos > 0)
             {
                 relationPath = relationPath.copy( nSepPos,  ::std::max< sal_Int32 >( externalDataPath.getLength(), 0 ) -  nSepPos );
@@ -1630,9 +1629,8 @@ void ChartExport::exportDoughnutChart( const Reference< chart2::XChartType >& xC
     // firstSliceAng
     exportFirstSliceAng( );
     //FIXME: holeSize
-    sal_Int32 nHoleSize = 50;
     pFS->singleElement( FSNS( XML_c, XML_holeSize ),
-            XML_val, I32S( nHoleSize ),
+            XML_val, I32S( 50 ),
             FSEND );
 
     pFS->endElement( FSNS( XML_c, XML_doughnutChart ) );
@@ -1876,9 +1874,8 @@ void ChartExport::exportUpDownBars( const Reference< chart2::XChartType >& xChar
         pFS->startElement( FSNS( XML_c, XML_upDownBars ),
                 FSEND );
         // TODO: gapWidth
-        sal_Int32 nGapWidth = 150;
         pFS->singleElement( FSNS( XML_c, XML_gapWidth ),
-                XML_val, I32S( nGapWidth ),
+                XML_val, I32S( 150 ),
                     FSEND );
 
         Reference< beans::XPropertySet > xChartPropSet = xChartPropProvider->getUpBar();
@@ -2626,9 +2623,8 @@ void ChartExport::_exportAxis(
         if( bLogarithmic )
         {
             // default value is 10?
-            sal_Int32 nLogBase = 10;
             pFS->singleElement( FSNS( XML_c, XML_logBase ),
-                XML_val, I32S( nLogBase ),
+                XML_val, I32S( 10 ),
                 FSEND );
         }
     }
@@ -2871,9 +2867,8 @@ void ChartExport::_exportAxis(
         }
 
         // FIXME: seems not support? lblOffset
-        sal_Int32 nLblOffset = 100;
         pFS->singleElement( FSNS( XML_c, XML_lblOffset ),
-            XML_val, I32S( nLblOffset ),
+            XML_val, I32S( 100 ),
             FSEND );
     }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4775b1bfb901..ff909e7bc625 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -970,9 +970,8 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
         WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV );
         if( nAdjustmentValuesIndex != -1 )
         {
-            sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
             WritePresetShape( sPresetShape, eShapeType, bPredefinedHandlesUsed,
-                              nAdjustmentsWhichNeedsToBeConverted, aGeometrySeq[ nAdjustmentValuesIndex ] );
+                              0/*nAdjustmentsWhichNeedsToBeConverted*/, aGeometrySeq[ nAdjustmentValuesIndex ] );
         }
         else
             WritePresetShape( sPresetShape );
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 285942923cc6..5c1fce46d5f9 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -172,7 +172,7 @@ classIdToGUIDCNamePairMap::classIdToGUIDCNamePairMap()
              { AX_GUID_SCROLLBAR, "ScrollBar"},
         }
     };
-    int length = SAL_N_ELEMENTS( initialCntrlData );
+    int const length = SAL_N_ELEMENTS( initialCntrlData );
     IdCntrlData* pData = initialCntrlData;
     for ( int index = 0; index < length; ++index, ++pData )
         mnIdToGUIDCNamePairMap[ pData->nId ] = pData->aData;
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index d6ec25c1630d..dae0551f2e44 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -371,8 +371,7 @@ ds_status evaluateScoreForDevice(ds_device& rDevice, std::unique_ptr<LibreOffice
         // as any good openCL implementation: no SIMD, tons of branching
         // in the inner loops etc. Generously characterise it as only 10x
         // slower than the above.
-        float fInterpretTailFactor = 10.0;
-        rDevice.fTime *= fInterpretTailFactor;
+        rDevice.fTime *= 10.0;
         rDevice.bErrors = false;
     }
     return DS_SUCCESS;
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 5a06602448ca..89dae3f7bfdc 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -2622,9 +2622,6 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo(
     if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" )
         throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name
 
-    // it's always possible to read written storage in this implementation
-    sal_Int32 nStorageMode = embed::ElementModes::READ;
-
     try
     {
         SotElement_Impl *pElement = m_pImpl->FindElement( aStorName );
@@ -2639,7 +2636,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo(
         }
 
         if (!pElement->m_xStorage)
-            m_pImpl->OpenSubStorage( pElement, nStorageMode );
+            m_pImpl->OpenSubStorage( pElement, embed::ElementModes::READ );
 
         if (pElement->m_xStorage)
         {
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index f121a80b1c52..841d559af6d8 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -382,8 +382,6 @@ void ZipPackage::parseManifest()
         bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
         if ( !m_bForceRecovery && bODF12AndNewer )
         {
-            bool bDifferentStartKeyAlgorithm = false;
-
             if ( m_bInconsistent )
             {
                 // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
@@ -392,13 +390,9 @@ void ZipPackage::parseManifest()
                 throw ZipIOException(
                     THROW_WHERE "there are streams not referred in manifest.xml" );
             }
-            else if ( bDifferentStartKeyAlgorithm )
-            {
-                // all the streams should be encrypted with the same StartKey in ODF1.2
-                // TODO/LATER: in future the exception should be thrown
-                OSL_ENSURE( false, "ODF1.2 contains different StartKey Algorithms" );
-                // throw ZipIOException( THROW_WHERE "More than one Start Key Generation algorithm is specified!" );
-            }
+            // all the streams should be encrypted with the same StartKey in ODF1.2
+            // TODO/LATER: in future the exception should be thrown
+            // throw ZipIOException( THROW_WHERE "More than one Start Key Generation algorithm is specified!" );
         }
 
         // in case it is a correct ODF1.2 document, the version must be set
@@ -1309,8 +1303,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
             try
             {
                 Exception aDetect;
-                sal_Int64 aSize = 0;
-                Any aAny = aOriginalContent.setPropertyValue("Size", makeAny( aSize ) );
+                Any aAny = aOriginalContent.setPropertyValue("Size", makeAny( sal_Int64(0) ) );
                 if( !( aAny >>= aDetect ) )
                     bTruncSuccess = true;
             }
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index ca09ef5a6288..8e7408aa9d81 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -263,8 +263,6 @@ bool ZipPackageFolder::saveChild(
         const uno::Sequence < sal_Int8 >& rEncryptionKey,
         const rtlRandomPool &rRandomPool)
 {
-    bool bSuccess = true;
-
     const OUString sMediaTypeProperty ("MediaType");
     const OUString sVersionProperty ("Version");
     const OUString sFullPathProperty ("FullPath");
@@ -290,7 +288,7 @@ bool ZipPackageFolder::saveChild(
     if ( aPropSet.getLength() && ( m_nFormat == embed::StorageFormats::PACKAGE ) )
         rManList.push_back( aPropSet );
 
-    return bSuccess;
+    return true;
 }
 
 void ZipPackageFolder::saveContents(
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index eeb651da8a0f..ecdc92676273 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1398,13 +1398,10 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
     }
     if ( aImage.hasValue() )
     {
-        OUString sObject1("report");
-        OUString sPng("image/png");
-
         uno::Sequence<sal_Int8> aSeq;
         aImage >>= aSeq;
         uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq );
-        m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng);
+        m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream, "report", "image/png");
     }
 
     if ( !bErr )
@@ -1508,9 +1505,7 @@ bool OReportDefinition::WriteThroughComponent(
             xSeek->seek(0);
         }
 
-        OUString aPropName("MediaType");
-        OUString aMime("text/xml");
-        xStreamProp->setPropertyValue( aPropName, uno::Any(aMime) );
+        xStreamProp->setPropertyValue( "MediaType", uno::Any(OUString("text/xml")) );
 
         // encrypt all streams
         xStreamProp->setPropertyValue( "UseCommonStoragePasswordEncryption",
@@ -1707,9 +1702,8 @@ embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepres
     ::osl::MutexGuard aGuard(m_aMutex);
     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
     embed::VisualRepresentation aResult;
-    OUString sImageName("report");
     OUString sMimeType;
-    uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType);
+    uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream("report", &sMimeType);
     if ( xStream.is() )
     {
         uno::Sequence<sal_Int8> aSeq;
diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx
index 37d20bd89c15..9c04a42119f7 100644
--- a/reportdesign/source/core/api/ReportEngineJFree.cxx
+++ b/reportdesign/source/core/api/ReportEngineJFree.cxx
@@ -285,9 +285,8 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive
         {
             // if there is no frame given, find the right
             xFrameLoad.set( frame::Desktop::create(m_xContext), uno::UNO_QUERY);
-            OUString sTarget("_blank");
-            sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
-            uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag);
+            sal_Int32 const nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
+            uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame("_blank",nFrameSearchFlag);
             xFrameLoad.set( xFrame,uno::UNO_QUERY);
         }
 
diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx
index bdecbc69cd46..cbea9f8ad459 100644
--- a/reportdesign/source/core/misc/reportformula.cxx
+++ b/reportdesign/source/core/misc/reportformula.cxx
@@ -83,11 +83,9 @@ namespace rptui
         m_sCompleteFormula = _rFormula;
 
         // is it an ordinary expression?
-        if ( m_sCompleteFormula.startsWith( sExpressionPrefix ) )
+        if ( m_sCompleteFormula.startsWith( sExpressionPrefix, &m_sUndecoratedContent ) )
         {
-            sal_Int32 nPrefixLen = strlen(sExpressionPrefix);
             m_eType = Expression;
-            m_sUndecoratedContent = m_sCompleteFormula.copy( nPrefixLen );
             return;
         }
 
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 2fc0ec31f3b6..4d1b2d745925 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -373,7 +373,6 @@ void NavigatorTree::Command( const CommandEvent& rEvt )
 
 sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& _rEvt )
 {
-    sal_Int8 nDropOption = DND_ACTION_NONE;
     ::Point aDropPos = _rEvt.maPosPixel;
     if (_rEvt.mbLeaving)
     {
@@ -421,7 +420,7 @@ sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& _rEvt )
             m_aDropActionTimer.Stop();
     }
 
-    return nDropOption;
+    return DND_ACTION_NONE;
 }
 
 sal_Int8 NavigatorTree::ExecuteDrop( const ExecuteDropEvent& /*_rEvt*/ )
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index f813e8f55c08..41cf6fc02472 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3020,7 +3020,6 @@ void OReportController::insertGraphic()
 sal_Bool SAL_CALL OReportController::select( const Any& aSelection )
 {
     ::osl::MutexGuard aGuard( getMutex() );
-    bool bRet = true;
     if ( getDesignView() )
     {
         getDesignView()->unmarkAllObjects();
@@ -3054,7 +3053,7 @@ sal_Bool SAL_CALL OReportController::select( const Any& aSelection )
         }
         InvalidateAll();
     }
-    return bRet;
+    return true;
 }
 
 Any SAL_CALL OReportController::getSelection(  )
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index a513fab6efe1..98f4ae2857da 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -218,9 +218,8 @@ bool DlgEdFunc::MouseButtonDown( const MouseEvent& rMEvt )
 
 bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
 {
-    bool bHandled = false;
     m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
-    return bHandled;
+    return false;
 }
 
 void DlgEdFunc::checkTwoCklicks(const MouseEvent& rMEvt)
diff --git a/sal/osl/all/filepath.cxx b/sal/osl/all/filepath.cxx
index c6d12caf11f5..1b2bcace133f 100644
--- a/sal/osl/all/filepath.cxx
+++ b/sal/osl/all/filepath.cxx
@@ -27,7 +27,6 @@ static sal_uInt32 SAL_CALL osl_defCalcTextWidth( rtl_uString *ustrText )
 
 oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl_uString **pustrCompacted, sal_uInt32 uMaxWidth, oslCalcTextWidthFunc pfnCalcWidth )
 {
-    oslFileError    error = osl_File_E_None;
     rtl_uString     *ustrPath = nullptr;
     rtl_uString     *ustrFile = nullptr;
     sal_uInt32      uPathWidth, uFileWidth;
@@ -108,7 +107,7 @@ oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl
     if ( ustrFile )
         rtl_uString_release( ustrFile );
 
-    return error;
+    return osl_File_E_None;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 52fd6b780bb0..816a4f729405 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -497,9 +497,7 @@ static int create_dir_with_callback(
     oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc,
     void* pData)
 {
-    int mode = S_IRWXU | S_IRWXG | S_IRWXO;
-
-    if (osl::mkdir(directory_path, mode) == 0)
+    if (osl::mkdir(directory_path, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
     {
         if (aDirectoryCreationCallbackFunc)
         {
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index ead32377303f..40c93e0c7add 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -368,9 +368,8 @@ void SAL_CALL osl_closePipe(oslPipe pPipe)
 
         addr.sun_family = AF_UNIX;
         strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path) - 1);
-        size_t len = sizeof(addr);
 
-        nRet = connect(fd, reinterpret_cast< sockaddr* >(&addr), len);
+        nRet = connect(fd, reinterpret_cast< sockaddr* >(&addr), sizeof(addr));
         if (nRet < 0)
             SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno));
 
diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx
index 2e7f09e5e48e..ed87c5819586 100644
--- a/sal/textenc/convertisciidevangari.cxx
+++ b/sal/textenc/convertisciidevangari.cxx
@@ -234,7 +234,7 @@ sal_Size UnicodeToIsciiDevanagari::convert(sal_Unicode const* pSrcBuf, sal_Size
     char* pDestBuf, sal_Size nDestBytes, sal_uInt32 nFlags,
     sal_uInt32 * pInfo, sal_Size* pSrcCvtChars)
 {
-    size_t entries = SAL_N_ELEMENTS(unicodeToISCIIEncoding);
+    size_t const entries = SAL_N_ELEMENTS(unicodeToISCIIEncoding);
     BmpUnicodeToSingleByteRange const * ranges = unicodeToISCIIEncoding;
 
     sal_Unicode cHighSurrogate = m_cHighSurrogate;
diff --git a/sal/textenc/convertsinglebytetobmpunicode.cxx b/sal/textenc/convertsinglebytetobmpunicode.cxx
index 9bb994d2a9c8..5890a9dc8220 100644
--- a/sal/textenc/convertsinglebytetobmpunicode.cxx
+++ b/sal/textenc/convertsinglebytetobmpunicode.cxx
@@ -42,7 +42,6 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode(
     sal_Unicode * destBufPtr = destBuf;
     sal_Unicode * destBufEnd = destBuf + destChars;
     for (; converted < srcBytes; ++converted) {
-        bool undefined = true;
         sal_Char b = *srcBuf++;
         sal_Unicode c = map[static_cast< sal_uInt8 >(b)];
         if (c == 0xFFFF) {
@@ -55,7 +54,7 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode(
         continue;
     bad_input:
         switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
-                    undefined, false, b, flags, &destBufPtr, destBufEnd,
+                    true/*undefined*/, false, b, flags, &destBufPtr, destBufEnd,
                     &infoFlags))
         {
         case sal::detail::textenc::BAD_INPUT_STOP:
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index bd00da63dd84..29ad4bf376c3 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -1275,8 +1275,7 @@ void SAXWriter::startCDATA()
         throw SAXException ();
     }
 
-    sal_Int32 nLength = 9;
-    sal_Int32 nPrefix = getIndentPrefixLength( nLength );
+    sal_Int32 nPrefix = getIndentPrefixLength( 9 );
     if( nPrefix >= 0 )
         m_pSaxWriterHelper->insertIndentation( nPrefix );
 
@@ -1294,8 +1293,7 @@ void SAXWriter::endCDATA()
         throw except;
     }
 
-    sal_Int32 nLength = 3;
-    sal_Int32 nPrefix = getIndentPrefixLength( nLength );
+    sal_Int32 nPrefix = getIndentPrefixLength( 3 );
     if( nPrefix >= 0 )
         m_pSaxWriterHelper->insertIndentation( nPrefix );
 


More information about the Libreoffice-commits mailing list