[Libreoffice-commits] core.git: filter/source package/source sc/source svl/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 06:09:36 UTC 2019


 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx |    2 
 package/source/xstor/xstorage.cxx                    |   92 ++++++++-----------
 sc/source/filter/xml/xmlfonte.cxx                    |    3 
 sc/source/filter/xml/xmlimprt.cxx                    |    1 
 sc/source/filter/xml/xmlstyle.cxx                    |    4 
 svl/source/numbers/zforscan.cxx                      |    2 
 xmloff/source/draw/XMLNumberStyles.cxx               |    6 -
 7 files changed, 52 insertions(+), 58 deletions(-)

New commits:
commit b143e7642f93e83f4f3c4df56c3e1e8e64e36ce0
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Feb 9 15:57:25 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 11 07:09:11 2019 +0100

    tdf#120703 PVS: V560 A part of conditional expression is always true/false
    
    Change-Id: Ib9ad5b874a210ef3862c668158fcc5d18eeab363
    Reviewed-on: https://gerrit.libreoffice.org/67579
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 673481b8e1b5..800cd20802dd 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -805,7 +805,7 @@ void XMLFilterSettingsDialog::onDelete()
                         PropertyValue* pValues = aValues.getArray();
                         sal_Int32 nValue;
 
-                        for( nValue = 0; (nValue < nValueCount) && !bTypeStillUsed; nValue++, pValues++ )
+                        for (nValue = 0; nValue < nValueCount; nValue++, pValues++)
                         {
                             if ( pValues->Name == "Type" )
                             {
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index a7cdc1de4d9e..a07d06cbaa20 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1674,69 +1674,63 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain
         if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN )
             throw io::IOException( THROW_WHERE );
 
-        if ( m_nRelInfoStatus == RELINFO_CHANGED
-          || m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
-          || m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
+        if (m_nRelInfoStatus == RELINFO_CHANGED)
         {
-            if ( m_nRelInfoStatus == RELINFO_CHANGED )
+            if (m_aRelInfo.getLength())
             {
-                if ( m_aRelInfo.getLength() )
-                {
-                    CreateRelStorage();
+                CreateRelStorage();
 
-                    uno::Reference< io::XStream > xRelsStream =
-                        m_xRelStorage->openStreamElement( ".rels" ,
-                                                            embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE );
+                uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement(
+                    ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
 
-                    uno::Reference< io::XOutputStream > xOutStream = xRelsStream->getOutputStream();
-                    if ( !xOutStream.is() )
-                        throw uno::RuntimeException( THROW_WHERE );
+                uno::Reference<io::XOutputStream> xOutStream = xRelsStream->getOutputStream();
+                if (!xOutStream.is())
+                    throw uno::RuntimeException(THROW_WHERE);
 
-                    ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, m_xContext );
+                ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence(xOutStream, m_aRelInfo,
+                                                                        m_xContext);
 
-                    // set the mediatype
-                    uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
-                    xPropSet->setPropertyValue(
-                        "MediaType",
-                        uno::makeAny( OUString( "application/vnd.openxmlformats-package.relationships+xml" ) ) );
+                // set the mediatype
+                uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
+                xPropSet->setPropertyValue(
+                    "MediaType", uno::makeAny(OUString(
+                                     "application/vnd.openxmlformats-package.relationships+xml")));
 
-                    m_nRelInfoStatus = RELINFO_READ;
-                }
-                else if ( m_xRelStorage.is() )
-                    RemoveStreamRelInfo( OUString() ); // remove own rel info
+                m_nRelInfoStatus = RELINFO_READ;
             }
-            else if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
-                      || m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
-            {
-                CreateRelStorage();
+            else if (m_xRelStorage.is())
+                RemoveStreamRelInfo(OUString()); // remove own rel info
+        }
+        else if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
+                 || m_nRelInfoStatus == RELINFO_CHANGED_STREAM)
+        {
+            CreateRelStorage();
 
-                uno::Reference< io::XStream > xRelsStream =
-                    m_xRelStorage->openStreamElement( ".rels",
-                                                        embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE );
+            uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement(
+                ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
 
-                uno::Reference< io::XOutputStream > xOutputStream = xRelsStream->getOutputStream();
-                if ( !xOutputStream.is() )
-                    throw uno::RuntimeException( THROW_WHERE );
+            uno::Reference<io::XOutputStream> xOutputStream = xRelsStream->getOutputStream();
+            if (!xOutputStream.is())
+                throw uno::RuntimeException(THROW_WHERE);
 
-                uno::Reference< io::XSeekable > xSeek( m_xNewRelInfoStream, uno::UNO_QUERY_THROW );
-                xSeek->seek( 0 );
-                ::comphelper::OStorageHelper::CopyInputToOutput( m_xNewRelInfoStream, xOutputStream );
+            uno::Reference<io::XSeekable> xSeek(m_xNewRelInfoStream, uno::UNO_QUERY_THROW);
+            xSeek->seek(0);
+            ::comphelper::OStorageHelper::CopyInputToOutput(m_xNewRelInfoStream, xOutputStream);
 
-                // set the mediatype
-                uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
-                xPropSet->setPropertyValue(
-                    "MediaType",
-                    uno::makeAny( OUString( "application/vnd.openxmlformats-package.relationships+xml" ) ) );
+            // set the mediatype
+            uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
+            xPropSet->setPropertyValue(
+                "MediaType",
+                uno::makeAny(OUString("application/vnd.openxmlformats-package.relationships+xml")));
 
-                m_xNewRelInfoStream.clear();
-                if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
-                {
-                    m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >();
-                    m_nRelInfoStatus = RELINFO_NO_INIT;
-                }
-                else
-                    m_nRelInfoStatus = RELINFO_READ;
+            m_xNewRelInfoStream.clear();
+            if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM)
+            {
+                m_aRelInfo = uno::Sequence<uno::Sequence<beans::StringPair>>();
+                m_nRelInfoStatus = RELINFO_NO_INIT;
             }
+            else
+                m_nRelInfoStatus = RELINFO_READ;
         }
 
         if ( m_xRelStorage.is() )
diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx
index eeb50130fbbc..d06a03d14aee 100644
--- a/sc/source/filter/xml/xmlfonte.cxx
+++ b/sc/source/filter/xml/xmlfonte.cxx
@@ -49,8 +49,9 @@ void ScXMLFontAutoStylePool_Impl::AddFontItems(const sal_uInt16* pWhichIds, sal_
     {
         const SfxPoolItem* pItem;
         sal_uInt16 nWhichId(pWhichIds[i]);
-        if (bExportDefaults && (nullptr != (pItem = &pItemPool->GetDefaultItem(nWhichId))))
+        if (bExportDefaults)
         {
+            pItem = &pItemPool->GetDefaultItem(nWhichId);
             const SvxFontItem *pFont(static_cast<const SvxFontItem *>(pItem));
             Add( pFont->GetFamilyName(), pFont->GetStyleName(),
                     pFont->GetFamily(), pFont->GetPitch(),
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index deda4347c027..1dc17706c224 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1272,7 +1272,6 @@ void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rPropertie
         // and description within there and ScXMLImport::SetCurrencySymbol().
         if ((nCellType != nCurrentCellType) &&
                 (nCellType != util::NumberFormat::NUMBER) &&
-                (nCellType != util::NumberFormat::TEXT) &&
                 (bIsStandard || (nCellType == util::NumberFormat::CURRENCY)))
         {
             if (!xNumberFormats.is())
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index 4026e098136f..a8ca7bbdce59 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -1042,12 +1042,12 @@ bool XmlScPropHdl_CellProtection::exportXML(
             rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
             bRetval = true;
         }
-        else if (aCellProtection.IsLocked && !(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden))
+        else if (aCellProtection.IsLocked && !aCellProtection.IsFormulaHidden)
         {
             rStrExpValue = GetXMLToken(XML_PROTECTED);
             bRetval = true;
         }
-        else if (aCellProtection.IsFormulaHidden && !(aCellProtection.IsLocked || aCellProtection.IsHidden))
+        else if (aCellProtection.IsFormulaHidden && !aCellProtection.IsLocked)
         {
             rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
             bRetval = true;
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 9b1378673a46..e75a8d5267bf 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -998,7 +998,7 @@ short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr,
                     break;
                 }
                 // anything not recognized will stop the scan
-                if ( eState != SsStop && !bDontStop )
+                if (!bDontStop)
                 {
                     eState = SsStop;
                     nPos--;
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 191bf5f75270..45a161a81421 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -395,7 +395,7 @@ void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32
         if( nDateStyle > 1 )
             nDateStyle -= 2;
 
-        SAL_WARN_IF( (nDateStyle < 0) || (nDateStyle >= SdXMLDateFormatCount), "xmloff", "unknown date style!" );
+        SAL_WARN_IF(nDateStyle >= SdXMLDateFormatCount, "xmloff", "unknown date style!");
 
         int nTimeStyle = (nStyle >> 4) & 0x0f;
         bool bHasTime = nTimeStyle != 0;
@@ -403,9 +403,9 @@ void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32
         if( nTimeStyle > 1 )
             nTimeStyle -= 2;
 
-        SAL_WARN_IF( (nTimeStyle < 0) || (nTimeStyle >= SdXMLTimeFormatCount), "xmloff", "Unknown time style!" );
+        SAL_WARN_IF(nTimeStyle >= SdXMLTimeFormatCount, "xmloff", "Unknown time style!");
 
-        if( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount) && (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount) )
+        if ((nDateStyle < SdXMLDateFormatCount) && (nTimeStyle < SdXMLTimeFormatCount))
         {
             if( bHasDate )
             {


More information about the Libreoffice-commits mailing list