tdf#120703 PVS: V547 Expression is always true/false

Change-Id: I27bf92770431f6a1f35e1c8224c0847555a8d43f
Reviewed-on: https://gerrit.libreoffice.org/62819
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index b9ecb6d..e52ab45 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -588,16 +588,11 @@

        try
        {
            bool bEnable = true;

            // only show the button when both forms are based on the same data source
            if ( bEnable )
            {
                OUString sMasterDS, sDetailDS;
                xMasterFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sMasterDS;
                xDetailFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDetailDS;
                bEnable = ( sMasterDS == sDetailDS );
            }
            OUString sMasterDS, sDetailDS;
            xMasterFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sMasterDS;
            xDetailFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDetailDS;
            bool bEnable = ( sMasterDS == sDetailDS );

            // only show the button when the connection supports relations
            if ( bEnable )
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index c7b5968..09ac290 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -467,14 +467,10 @@
        };
        const size_t nCount = SAL_N_ELEMENTS(aMap);
        // Preallocate vector elements.
        if (aVec.size() < nCount)
        {
            FormulaOpCodeMapEntry aEntry;
            aEntry.Token.OpCode = getOpCodeUnknown();
            aVec.resize( nCount, aEntry);
        } // if (aVec.size() < nCount)

        FormulaOpCodeMapEntry aEntry;
        aEntry.Token.OpCode = getOpCodeUnknown();
        aVec.resize(nCount, aEntry);

        for (auto& i : aMap)
        {
            size_t nIndex = static_cast< size_t >( i.nOff );
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index f34b437..28955cc 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -166,9 +166,6 @@
        if ( dwFlags & VALIDATEPATH_ALLOW_RELATIVE )
            dwFlags |= VALIDATEPATH_ALLOW_ELLIPSE;

        if ( !lpszPath )
            bValid = false;

        DWORD   dwCandidatPathType = PATHTYPE_ERROR;

        if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, o3tl::toU(WSTR_LONG_PATH_PREFIX_UNC), SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1, SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index d931d38..0ee2c0e 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2020,7 +2020,7 @@
    SvtScriptType nScript = SvtScriptType::NONE;      // GetSelectionScriptType never returns 0
    if ( rSet.GetItemState( ATTR_FONT ) != SfxItemState::UNKNOWN )
    {
        if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
        nScript = pTabViewShell->GetSelectionScriptType();
        ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript );
    }
    if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SfxItemState::UNKNOWN )
@@ -2237,7 +2237,7 @@
    SvtScriptType nScript = SvtScriptType::NONE;      // GetSelectionScriptType never returns 0
    if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SfxItemState::UNKNOWN )
    {
        if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
        nScript = pTabViewShell->GetSelectionScriptType();
        ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript );
    }
    if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SfxItemState::UNKNOWN )
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 4b335e8..4ee984b 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -109,7 +109,7 @@
    if ( !pFormModel || !pFormModel->ControlsUseRefDevice() )
        return;

    OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : nullptr;
    OutputDevice* pCurrentRefDevice = pFormModel->GetRefDevice();
    if ( ( m_pLastKnownRefDevice.get() == pCurrentRefDevice ) && !_force )
        return;

@@ -313,8 +313,7 @@
    m_xEnvironmentHistory = nullptr;
    m_aEventsHistory.realloc(0);

    if ( pNewFormPage )
        pNewFormPage->GetImpl().formObjectInserted( *this );
    pNewFormPage->GetImpl().formObjectInserted( *this );
}


diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index c3a202a..edb44f2 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3043,24 +3043,22 @@
            for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin();
                 j != rControllerList.end(); ++j)
            {
                if (bSave)
                {   // remember the current filter settings in case we're going to reload the forms below (which may fail)
                    try
                    {
                        Reference< XPropertySet > xFormAsSet((*j)->getModel(), UNO_QUERY);
                        aOriginalFilters.push_back(::comphelper::getString(xFormAsSet->getPropertyValue(FM_PROP_FILTER)));
                        aOriginalApplyFlags.push_back(::comphelper::getBOOL(xFormAsSet->getPropertyValue(FM_PROP_APPLYFILTER)));
                    }
                    catch(Exception&)
                    {
                        OSL_FAIL("FmXFormShell::stopFiltering : could not get the original filter !");
                        // put dummies into the arrays so the they have the right size
                // remember the current filter settings in case we're going to reload the forms below (which may fail)
                try
                {
                    Reference< XPropertySet > xFormAsSet((*j)->getModel(), UNO_QUERY);
                    aOriginalFilters.push_back(::comphelper::getString(xFormAsSet->getPropertyValue(FM_PROP_FILTER)));
                    aOriginalApplyFlags.push_back(::comphelper::getBOOL(xFormAsSet->getPropertyValue(FM_PROP_APPLYFILTER)));
                }
                catch(Exception&)
                {
                    OSL_FAIL("FmXFormShell::stopFiltering : could not get the original filter !");
                    // put dummies into the arrays so the they have the right size

                        if (aOriginalFilters.size() == aOriginalApplyFlags.size())
                            // the first getPropertyValue failed -> use two dummies
                            aOriginalFilters.emplace_back( );
                        aOriginalApplyFlags.push_back( false );
                    }
                    if (aOriginalFilters.size() == aOriginalApplyFlags.size())
                        // the first getPropertyValue failed -> use two dummies
                        aOriginalFilters.emplace_back( );
                    aOriginalApplyFlags.push_back( false );
                }
                saveFilter(*j);
            }