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

Change-Id: Iaa1a1811b638aadfe6b06b3465a182cb675031b5
Reviewed-on: https://gerrit.libreoffice.org/62476
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 130bdcd..f3cf501 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -469,12 +469,6 @@ oslHostAddr SAL_CALL osl_createHostAddr (

    rtl_uString_newFromString( &cn, strHostname);

    if ( ! pSocketAddr )
    {
        rtl_uString_release(cn);
        return nullptr;
    }

    pAddr= static_cast<oslHostAddr>(malloc (sizeof (struct oslHostAddrImpl)));

    if (pAddr == nullptr)
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 08bdca0..204af6d 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1311,16 +1311,13 @@ uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName )
                case SC_WID_UNO_TBLBORD:
                case SC_WID_UNO_TBLBORD2:
                    {
                        const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
                        if ( pItem )
                        {
                            SvxBoxItem aOuter( * static_cast<const SvxBoxItem*>( pItem ) );
                            SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
                            if (nWhich == SC_WID_UNO_TBLBORD2)
                                ScHelperFunctions::AssignTableBorder2ToAny( aAny, aOuter, aInner, true);
                            else
                                ScHelperFunctions::AssignTableBorderToAny( aAny, aOuter, aInner, true);
                        }
                        const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER);
                        SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem));
                        SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
                        if (nWhich == SC_WID_UNO_TBLBORD2)
                            ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner, true);
                        else
                            ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner, true);
                    }
                    break;
            }
@@ -1530,236 +1527,233 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
        }
        if (!bDone)
        {
            if ( pEntry )
            if (IsScItemWid(pEntry->nWID))
            {
                if ( IsScItemWid( pEntry->nWID ) )
                if (pValue)
                {
                    if (pValue)
                    switch (pEntry->nWID)     // special item handling
                    {
                        switch ( pEntry->nWID )     // special item handling
                        {
                            case ATTR_VALUE_FORMAT:
                        case ATTR_VALUE_FORMAT:
                            {
                                // language for number formats
                                SvNumberFormatter* pFormatter
                                    = pDocShell->GetDocument().GetFormatTable();
                                sal_uInt32 nOldFormat = rSet.Get(ATTR_VALUE_FORMAT).GetValue();
                                LanguageType eOldLang
                                    = rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage();
                                pFormatter->GetFormatForLanguageIfBuiltIn(nOldFormat, eOldLang);

                                sal_uInt32 nNewFormat = 0;
                                *pValue >>= nNewFormat;
                                rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat));

                                const SvNumberformat* pNewEntry = pFormatter->GetEntry(nNewFormat);
                                LanguageType eNewLang
                                    = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
                                if (eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW)
                                    rSet.Put(SvxLanguageItem(eNewLang, ATTR_LANGUAGE_FORMAT));

                                //! keep default state of number format if only language changed?
                            }
                            break;
                        case ATTR_INDENT:
                            {
                                sal_Int16 nVal = 0;
                                *pValue >>= nVal;
                                rSet.Put(SfxUInt16Item(pEntry->nWID,
                                                       static_cast<sal_uInt16>(HMMToTwips(nVal))));
                            }
                            break;
                        case ATTR_ROTATE_VALUE:
                            {
                                sal_Int32 nRotVal = 0;
                                if (*pValue >>= nRotVal)
                                {
                                    // language for number formats
                                    SvNumberFormatter* pFormatter =
                                            pDocShell->GetDocument().GetFormatTable();
                                    sal_uInt32 nOldFormat =
                                            rSet.Get( ATTR_VALUE_FORMAT ).GetValue();
                                    LanguageType eOldLang =
                                            rSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
                                    pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );

                                    sal_uInt32 nNewFormat = 0;
                                    *pValue >>= nNewFormat;
                                    rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );

                                    const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
                                    LanguageType eNewLang =
                                        pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
                                    if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
                                        rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );

                                    //! keep default state of number format if only language changed?
                                    //  stored value is always between 0 and 360 deg.
                                    nRotVal %= 36000;
                                    if (nRotVal < 0)
                                        nRotVal += 36000;
                                    rSet.Put(SfxInt32Item(ATTR_ROTATE_VALUE, nRotVal));
                                }
                                break;
                            case ATTR_INDENT:
                            }
                            break;
                        case ATTR_STACKED:
                            {
                                table::CellOrientation eOrient;
                                if (*pValue >>= eOrient)
                                {
                                    sal_Int16 nVal = 0;
                                    *pValue >>= nVal;
                                    rSet.Put( SfxUInt16Item( pEntry->nWID, static_cast<sal_uInt16>(HMMToTwips(nVal)) ) );
                                }
                                break;
                            case ATTR_ROTATE_VALUE:
                                {
                                    sal_Int32 nRotVal = 0;
                                    if ( *pValue >>= nRotVal )
                                    switch (eOrient)
                                    {
                                        //  stored value is always between 0 and 360 deg.
                                        nRotVal %= 36000;
                                        if ( nRotVal < 0 )
                                            nRotVal += 36000;
                                        rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
                                    }
                                }
                                break;
                            case ATTR_STACKED:
                                {
                                    table::CellOrientation eOrient;
                                    if( *pValue >>= eOrient )
                                    {
                                        switch( eOrient )
                                        case table::CellOrientation_STANDARD:
                                            rSet.Put(SfxBoolItem(ATTR_STACKED, false));
                                        break;
                                        case table::CellOrientation_TOPBOTTOM:
                                            rSet.Put(SfxBoolItem(ATTR_STACKED, false));
                                            rSet.Put(SfxInt32Item(ATTR_ROTATE_VALUE, 27000));
                                        break;
                                        case table::CellOrientation_BOTTOMTOP:
                                            rSet.Put(SfxBoolItem(ATTR_STACKED, false));
                                            rSet.Put(SfxInt32Item(ATTR_ROTATE_VALUE, 9000));
                                        break;
                                        case table::CellOrientation_STACKED:
                                            rSet.Put(SfxBoolItem(ATTR_STACKED, true));
                                        break;
                                        default:
                                        {
                                            case table::CellOrientation_STANDARD:
                                                rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                                            break;
                                            case table::CellOrientation_TOPBOTTOM:
                                                rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                                                rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
                                            break;
                                            case table::CellOrientation_BOTTOMTOP:
                                                rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
                                                rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
                                            break;
                                            case table::CellOrientation_STACKED:
                                                rSet.Put( SfxBoolItem( ATTR_STACKED, true ) );
                                            break;
                                            default:
                                            {
                                                // added to avoid warnings
                                            }
                                            // added to avoid warnings
                                        }
                                    }
                                }
                                break;
                            case ATTR_PAGE_SCALE:
                            case ATTR_PAGE_SCALETOPAGES:
                            }
                            break;
                        case ATTR_PAGE_SCALE:
                        case ATTR_PAGE_SCALETOPAGES:
                            {
                                rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
                                rSet.ClearItem(ATTR_PAGE_SCALE);
                                rSet.ClearItem(ATTR_PAGE_SCALETO);
                                sal_Int16 nVal = 0;
                                *pValue >>= nVal;
                                rSet.Put(SfxUInt16Item(pEntry->nWID, nVal));
                            }
                            break;
                        case ATTR_PAGE_FIRSTPAGENO:
                            {
                                sal_Int16 nVal = 0;
                                *pValue >>= nVal;
                                rSet.Put(SfxUInt16Item(ATTR_PAGE_FIRSTPAGENO, nVal));
                            }
                            break;
                        case ATTR_PAGE_CHARTS:
                        case ATTR_PAGE_OBJECTS:
                        case ATTR_PAGE_DRAWINGS:
                            {
                                bool bBool = false;
                                *pValue >>= bBool;
                                //! need to define sal_Bool-MID for ScViewObjectModeItem?
                                rSet.Put(ScViewObjectModeItem(
                                    pEntry->nWID, bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE));
                            }
                            break;
                        case ATTR_PAGE_PAPERBIN:
                            {
                                sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
                                bool bFound = false;

                                OUString aName;
                                if (*pValue >>= aName)
                                {
                                    if (aName == SC_PAPERBIN_DEFAULTNAME)
                                        bFound = true;
                                    else
                                    {
                                        Printer* pPrinter = pDocShell->GetPrinter();
                                        if (pPrinter)
                                        {
                                            const sal_uInt16 nCount = pPrinter->GetPaperBinCount();
                                            for (sal_uInt16 i = 0; i < nCount; i++)
                                                if (aName == pPrinter->GetPaperBinName(i))
                                                {
                                                    nTray = static_cast<sal_uInt8>(i);
                                                    bFound = true;
                                                    break;
                                                }
                                        }
                                    }
                                }
                                if (!bFound)
                                    throw lang::IllegalArgumentException();

                                rSet.Put(SvxPaperBinItem(ATTR_PAGE_PAPERBIN, nTray));

                            }
                            break;
                        case ATTR_PAGE_SCALETO:
                            {
                                sal_Int16 nPages = 0;
                                if (*pValue >>= nPages)
                                {
                                    ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
                                    if (rPropertyName == SC_UNO_PAGE_SCALETOX)
                                        aItem.SetWidth(static_cast<sal_uInt16>(nPages));
                                    else
                                        aItem.SetHeight(static_cast<sal_uInt16>(nPages));
                                    rSet.Put(aItem);
                                    rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
                                    rSet.ClearItem(ATTR_PAGE_SCALE);
                                    rSet.ClearItem(ATTR_PAGE_SCALETO);
                                    sal_Int16 nVal = 0;
                                    *pValue >>= nVal;
                                    rSet.Put( SfxUInt16Item( pEntry->nWID, nVal ) );
                                }
                                break;
                            case ATTR_PAGE_FIRSTPAGENO:
                                {
                                    sal_Int16 nVal = 0;
                                    *pValue >>= nVal;
                                    rSet.Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, nVal ) );
                                }
                                break;
                            case ATTR_PAGE_CHARTS:
                            case ATTR_PAGE_OBJECTS:
                            case ATTR_PAGE_DRAWINGS:
                                {
                                    bool bBool = false;
                                    *pValue >>= bBool;
                                    //! need to define sal_Bool-MID for ScViewObjectModeItem?
                                    rSet.Put( ScViewObjectModeItem( pEntry->nWID,
                                        bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE ) );
                                }
                                break;
                            case ATTR_PAGE_PAPERBIN:
                                {
                                    sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
                                    bool bFound = false;

                                    OUString aName;
                                    if ( *pValue >>= aName )
                                    {
                                        if ( aName == SC_PAPERBIN_DEFAULTNAME )
                                            bFound = true;
                                        else
                                        {
                                            Printer* pPrinter = pDocShell->GetPrinter();
                                            if (pPrinter)
                                            {
                                                const sal_uInt16 nCount = pPrinter->GetPaperBinCount();
                                                for (sal_uInt16 i=0; i<nCount; i++)
                                                    if ( aName == pPrinter->GetPaperBinName(i) )
                                                    {
                                                        nTray = static_cast<sal_uInt8>(i);
                                                        bFound = true;
                                                        break;
                                                    }
                                            }
                                        }
                                    }
                                    if ( !bFound )
                                        throw lang::IllegalArgumentException();

                                    rSet.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN, nTray ) );

                                }
                                break;
                            case ATTR_PAGE_SCALETO:
                                {
                                    sal_Int16 nPages = 0;
                                    if (*pValue >>= nPages)
                                    {
                                        ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
                                        if ( rPropertyName == SC_UNO_PAGE_SCALETOX )
                                            aItem.SetWidth(static_cast<sal_uInt16>(nPages));
                                        else
                                            aItem.SetHeight(static_cast<sal_uInt16>(nPages));
                                        rSet.Put( aItem );
                                        rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
                                        rSet.ClearItem(ATTR_PAGE_SCALE);
                                    }
                                }
                                break;
                            case ATTR_HIDDEN:
                                {
                                    bool bHidden = false;
                                    if ( *pValue >>= bHidden )
                                        pStyle->SetHidden( bHidden );
                                }
                                break;
                            default:
                                // default items with wrong Slot-ID are not working in SfxItemPropertySet3
                                //! change Slot-IDs...
                                if ( rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID &&
                                     rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT )
                                {
                                    rSet.Put( rSet.Get(pEntry->nWID) );
                                }
                                pPropSet->setPropertyValue( *pEntry, *pValue, rSet );
                        }
                    }
                    else
                    {
                        rSet.ClearItem( pEntry->nWID );
                        // language for number formats
                        if ( pEntry->nWID == ATTR_VALUE_FORMAT )
                            rSet.ClearItem( ATTR_LANGUAGE_FORMAT );

                        //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
                            }
                            break;
                        case ATTR_HIDDEN:
                            {
                                bool bHidden = false;
                                if (*pValue >>= bHidden)
                                    pStyle->SetHidden(bHidden);
                            }
                            break;
                        default:
                            // default items with wrong Slot-ID are not working in SfxItemPropertySet3
                            //! change Slot-IDs...
                            if (rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID
                                && rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT)
                            {
                                rSet.Put(rSet.Get(pEntry->nWID));
                            }
                            pPropSet->setPropertyValue(*pEntry, *pValue, rSet);
                    }
                }
                else if ( IsScUnoWid( pEntry->nWID ) )
                else
                {
                    switch ( pEntry->nWID )
                    {
                        case SC_WID_UNO_TBLBORD:
                    rSet.ClearItem(pEntry->nWID);
                    // language for number formats
                    if (pEntry->nWID == ATTR_VALUE_FORMAT)
                        rSet.ClearItem(ATTR_LANGUAGE_FORMAT);

                    //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
                }
            }
            else if (IsScUnoWid(pEntry->nWID))
            {
                switch (pEntry->nWID)
                {
                    case SC_WID_UNO_TBLBORD:
                        {
                            if (pValue)
                            {
                                if (pValue)
                                table::TableBorder aBorder;
                                if (*pValue >>= aBorder)
                                {
                                    table::TableBorder aBorder;
                                    if ( *pValue >>= aBorder )
                                    {
                                        SvxBoxItem aOuter( ATTR_BORDER );
                                        SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
                                        ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
                                        rSet.Put( aOuter );
                                    }
                                }
                                else
                                {
                                    rSet.ClearItem( ATTR_BORDER );
                                    SvxBoxItem aOuter(ATTR_BORDER);
                                    SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
                                    ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder);
                                    rSet.Put(aOuter);
                                }
                            }
                            break;
                        case SC_WID_UNO_TBLBORD2:
                            else
                            {
                                if (pValue)
                                rSet.ClearItem(ATTR_BORDER);
                            }
                        }
                        break;
                    case SC_WID_UNO_TBLBORD2:
                        {
                            if (pValue)
                            {
                                table::TableBorder2 aBorder2;
                                if (*pValue >>= aBorder2)
                                {
                                    table::TableBorder2 aBorder2;
                                    if ( *pValue >>= aBorder2 )
                                    {
                                        SvxBoxItem aOuter( ATTR_BORDER );
                                        SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
                                        ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
                                        rSet.Put( aOuter );
                                    }
                                }
                                else
                                {
                                    rSet.ClearItem( ATTR_BORDER );
                                    SvxBoxItem aOuter(ATTR_BORDER);
                                    SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
                                    ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder2);
                                    rSet.Put(aOuter);
                                }
                            }
                            break;
                    }
                            else
                            {
                                rSet.ClearItem(ATTR_BORDER);
                            }
                        }
                        break;
                }
            }
        }
@@ -1904,16 +1898,15 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
                    case SC_WID_UNO_TBLBORD:
                    case SC_WID_UNO_TBLBORD2:
                        {
                            const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
                            if ( pItem )
                            {
                                SvxBoxItem aOuter( * static_cast<const SvxBoxItem*>( pItem ) );
                                SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
                                if (nWhich == SC_WID_UNO_TBLBORD2)
                                    ScHelperFunctions::AssignTableBorder2ToAny( aAny, aOuter, aInner, true);
                                else
                                    ScHelperFunctions::AssignTableBorderToAny( aAny, aOuter, aInner, true);
                            }
                            const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER);
                            SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem));
                            SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
                            if (nWhich == SC_WID_UNO_TBLBORD2)
                                ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner,
                                                                           true);
                            else
                                ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner,
                                                                          true);
                        }
                        break;
                }
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 52fb2d6..54680db 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -249,10 +249,7 @@ Sequence< OUString > SAL_CALL SdStyleFamily::getElementNames()
        {
            // we assume that we have only SdStyleSheets
            SdStyleSheet* pSdStyle = static_cast< SdStyleSheet* >( pStyle );
            if( pSdStyle )
            {
                aNames.push_back( pSdStyle->GetApiName() );
            }
            aNames.push_back(pSdStyle->GetApiName());
        }
        return Sequence< OUString >( &(*aNames.begin()), aNames.size() );
    }
@@ -279,12 +276,9 @@ sal_Bool SAL_CALL SdStyleFamily::hasByName( const OUString& aName )
            {
                // we assume that we have only SdStyleSheets
                SdStyleSheet* pSdStyle = static_cast< SdStyleSheet* >( pStyle );
                if( pSdStyle )
                if (pSdStyle->GetApiName() == aName)
                {
                    if (pSdStyle->GetApiName() == aName)
                    {
                        return true;
                    }
                    return true;
                }
            }
        }
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 47c105a..cfbaf9f 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -898,13 +898,10 @@ void SdStyleSheetPool::CreatePseudosIfNecessary()
        {
            pSheet = &Make(aLevelName, SfxStyleFamily::Pseudo, nUsedMask);

            if (pSheet)
            {
                if (pParent)
                    pSheet->SetParent(pParent->GetName());
                pParent = pSheet;
                static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
            }
            if (pParent)
                pSheet->SetParent(pParent->GetName());
            pParent = pSheet;
            static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
        }
        pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
    }
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index a5f942c..70df660 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -579,14 +579,10 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >&

    pImpl->aVerbList = aVerbs;

    if (pViewSh)
    {
        // The status of SID_OBJECT is collected in the controller directly on
        // the Shell, it is thus enough to encourage a new status update
        SfxBindings *pBindings = pViewSh->GetViewFrame()->GetDispatcher()->
                GetBindings();
        pBindings->Invalidate( SID_OBJECT, true, true );
    }
    // The status of SID_OBJECT is collected in the controller directly on
    // the Shell, it is thus enough to encourage a new status update
    SfxBindings* pBindings = pViewSh->GetViewFrame()->GetDispatcher()->GetBindings();
    pBindings->Invalidate(SID_OBJECT, true, true);
}

const css::uno::Sequence < css::embed::VerbDescriptor >& SfxShell::GetVerbs() const
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 3d06277..a15f07f 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1107,10 +1107,8 @@ uno::Sequence< sal_Int16 > SAL_CALL SfxBaseController::getSupportedCommandGroups
    SolarMutexGuard aGuard;

    std::vector< sal_Int16 > aGroupList;
    SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() );
    SfxSlotPool*  pPool = &SfxSlotPool::GetSlotPool( pViewFrame );

    SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
    SfxViewFrame* pViewFrame = m_pData->m_pViewShell ? m_pData->m_pViewShell->GetFrame() : nullptr;
    SfxSlotPool* pSlotPool = pViewFrame ? &SfxSlotPool::GetSlotPool(pViewFrame) : &SFX_SLOTPOOL();
    const SfxSlotMode nMode( SfxSlotMode::TOOLBOXCONFIG|SfxSlotMode::ACCELCONFIG|SfxSlotMode::MENUCONFIG );

    // Select Group ( Group 0 is internal )
@@ -1143,9 +1141,8 @@ uno::Sequence< frame::DispatchInformation > SAL_CALL SfxBaseController::getConfi
        const SfxSlotMode nMode( SfxSlotMode::TOOLBOXCONFIG|SfxSlotMode::ACCELCONFIG|SfxSlotMode::MENUCONFIG );

        SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() );
        SfxSlotPool*  pPool( &SfxSlotPool::GetSlotPool( pViewFrame ));

        SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
        SfxSlotPool* pSlotPool
            = pViewFrame ? &SfxSlotPool::GetSlotPool(pViewFrame) : &SFX_SLOTPOOL();
        for ( sal_uInt16 i=0; i<pSlotPool->GetGroupCount(); i++ )
        {
            pSlotPool->SeekGroup( i );
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 23f3544..3f09010 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2426,11 +2426,6 @@ void SdXMLExport::exportFormsElement( const Reference< XDrawPage >& xDrawPage )

void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
{
    rProps.realloc(4);
    beans::PropertyValue* pProps = rProps.getArray();
    if(!pProps)
        return;

    Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
    if( !xPropSet.is() )
        return;
@@ -2438,15 +2433,17 @@ void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
    awt::Rectangle aVisArea;
    xPropSet->getPropertyValue("VisibleArea") >>= aVisArea;

    sal_uInt16 i = 0;
    pProps[i].Name = "VisibleAreaTop";
    pProps[i++].Value <<= aVisArea.Y;
    pProps[i].Name = "VisibleAreaLeft";
    pProps[i++].Value <<= aVisArea.X;
    pProps[i].Name = "VisibleAreaWidth";
    pProps[i++].Value <<= aVisArea.Width;
    pProps[i].Name = "VisibleAreaHeight";
    pProps[i++].Value <<= aVisArea.Height;
    rProps.realloc(4);
    beans::PropertyValue* pProps = rProps.getArray();

    pProps[0].Name = "VisibleAreaTop";
    pProps[0].Value <<= aVisArea.Y;
    pProps[1].Name = "VisibleAreaLeft";
    pProps[1].Value <<= aVisArea.X;
    pProps[2].Name = "VisibleAreaWidth";
    pProps[2].Value <<= aVisArea.Width;
    pProps[3].Name = "VisibleAreaHeight";
    pProps[3].Value <<= aVisArea.Height;

}

diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index da1e94b..3dbb2b5 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2055,30 +2055,18 @@ void XMLShapeExport::ImpExportLineShape(
    if (auto pSourcePolyPolygon
            = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
    {
        drawing::PointSequence* pOuterSequence = const_cast<css::drawing::PointSequenceSequence *>(pSourcePolyPolygon)->getArray();
        if(pOuterSequence)
        if (pSourcePolyPolygon->getLength() > 1)
        {
            drawing::PointSequence* pInnerSequence = pOuterSequence++;
            if(pInnerSequence)
            const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[1];
            if (rInnerSequence.getLength() > 0)
            {
                awt::Point* pArray = pInnerSequence->getArray();
                if(pArray)
                {
                    if(pInnerSequence->getLength() > 0)
                    {
                        aStart = awt::Point(
                            pArray->X + aBasePosition.X,
                            pArray->Y + aBasePosition.Y);
                        pArray++;
                    }

                    if(pInnerSequence->getLength() > 1)
                    {
                        aEnd = awt::Point(
                            pArray->X + aBasePosition.X,
                            pArray->Y + aBasePosition.Y);
                    }
                }
                const awt::Point& rPoint = rInnerSequence[0];
                aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
            }
            if (rInnerSequence.getLength() > 1)
            {
                const awt::Point& rPoint = rInnerSequence[1];
                aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
            }
        }
    }
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 4ba5ad8..2a8ab36 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -585,8 +585,8 @@ uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( 

    }

    if( cryptSerialNumber.pbData ) free( cryptSerialNumber.pbData ) ;
    if( certInfo.Issuer.pbData ) free( certInfo.Issuer.pbData ) ;
    free(cryptSerialNumber.pbData);
    free(certInfo.Issuer.pbData);

    if( pCertContext != nullptr ) {
        xcert = MswcryCertContextToXCert(pCertContext);