diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 16:10:06 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 15:05:32 +0100 |
commit | 3040d328c944d91b0cd612d86d358823b5c5b883 (patch) | |
tree | 689dd912ebff40137de98a7cf61b4042b9ec2cf2 | |
parent | d86778573a1ef207748cf8a6ca67eaef5cf04b02 (diff) |
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>
-rw-r--r-- | sal/osl/w32/socket.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/styleuno.cxx | 429 | ||||
-rw-r--r-- | sd/source/core/stlfamily.cxx | 12 | ||||
-rw-r--r-- | sd/source/core/stlpool.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 32 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx | 4 |
9 files changed, 249 insertions, 293 deletions
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx index 130bdcdb9f05..f3cf5016a14b 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 08bdca0627fb..204af6d01f8f 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: - { - // 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: + 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) { - sal_Int32 nRotVal = 0; - if ( *pValue >>= nRotVal ) - { - // stored value is always between 0 and 360 deg. - nRotVal %= 36000; - if ( nRotVal < 0 ) - nRotVal += 36000; - rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) ); - } + // 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: + } + break; + case ATTR_STACKED: + { + table::CellOrientation eOrient; + if (*pValue >>= eOrient) { - table::CellOrientation eOrient; - if( *pValue >>= eOrient ) + switch (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: - { - 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; + } + 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 ) + OUString aName; + if (*pValue >>= aName) + { + if (aName == SC_PAPERBIN_DEFAULTNAME) + bFound = true; + else { - if ( aName == SC_PAPERBIN_DEFAULTNAME ) - bFound = true; - else + Printer* pPrinter = pDocShell->GetPrinter(); + if (pPrinter) { - 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; - } - } + 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(); + } + if (!bFound) + throw lang::IllegalArgumentException(); - rSet.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN, nTray ) ); + 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 ) + } + break; + case ATTR_PAGE_SCALETO: + { + sal_Int16 nPages = 0; + if (*pValue >>= nPages) { - rSet.Put( rSet.Get(pEntry->nWID) ); + 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); } - pPropSet->setPropertyValue( *pEntry, *pValue, rSet ); - } + } + 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 ); + } + 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? - } + //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION? } - else if ( IsScUnoWid( pEntry->nWID ) ) + } + else if (IsScUnoWid(pEntry->nWID)) + { + switch (pEntry->nWID) { - switch ( pEntry->nWID ) - { - case SC_WID_UNO_TBLBORD: + 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) - { - 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); + } + } + break; + case SC_WID_UNO_TBLBORD2: + { + if (pValue) + { + table::TableBorder2 aBorder2; + if (*pValue >>= aBorder2) { - 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 52fb2d612b5d..54680db5d510 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 47c105a7d38a..cfbaf9f31079 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 a5f942cbb935..70df660c4d23 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 3d06277c40e8..a15f07f3831c 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 23f35442eae5..3f09010adfd0 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 da1e94b26d49..3dbb2b5beca6 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 4ba5ad8a4417..2a8ab3603de1 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); |