new loplugin: commaoperator

Change-Id: I03f24e61f696b7619855e3c7010aa0d874e5a4ff
This commit is contained in:
Noel Grandin 2016-02-17 13:14:50 +02:00
parent 003d0ccf90
commit c45d3badc9
97 changed files with 757 additions and 272 deletions

View File

@ -397,22 +397,26 @@ void SAL_CALL BaseControl::setPosSize( sal_Int32 nX ,
if ( nFlags & PosSize::X )
{
bChanged |= m_nX != nX, m_nX = nX;
bChanged |= m_nX != nX;
m_nX = nX;
}
if ( nFlags & PosSize::Y )
{
bChanged |= m_nY != nY, m_nY = nY;
bChanged |= m_nY != nY;
m_nY = nY;
}
if ( nFlags & PosSize::WIDTH )
{
bChanged |= m_nWidth != nWidth, m_nWidth = nWidth;
bChanged |= m_nWidth != nWidth;
m_nWidth = nWidth;
}
if ( nFlags & PosSize::HEIGHT )
{
bChanged |= m_nHeight != nHeight, m_nHeight = nHeight;
bChanged |= m_nHeight != nHeight;
m_nHeight = nHeight;
}
if ( bChanged && m_xPeerWindow.is() )

View File

@ -146,7 +146,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-first");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
}
else
aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 3 );
@ -154,17 +155,20 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-min");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-max");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-last");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
}
// 3. create series with remaining sequences
@ -194,7 +198,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-min");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
// 2. high
if( nSeqIdx < nRemaining )
@ -202,7 +207,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-max");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
}
// 3. close
@ -212,7 +218,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-last");
++nSourceIndex, ++nSeqIdx;
++nSourceIndex;
++nSeqIdx;
}
// 4. open

View File

@ -432,7 +432,7 @@ OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok,
break;
}
++pStr,
++pStr;
++i;
}

View File

@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <cassert>
#include <string>
#include <iostream>
#include <fstream>
#include <set>
#include "plugin.hxx"
#include "compat.hxx"
/**
the comma operator is best used sparingly
*/
namespace {
class CommaOperator:
public RecursiveASTVisitor<CommaOperator>, public loplugin::Plugin
{
public:
explicit CommaOperator(InstantiationData const & data): Plugin(data) {}
virtual void run() override
{
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
bool VisitBinaryOperator(const BinaryOperator* );
};
bool CommaOperator::VisitBinaryOperator(const BinaryOperator* binaryOp)
{
if (ignoreLocation(binaryOp)) {
return true;
}
if (binaryOp->getOpcode() != BO_Comma) {
return true;
}
const Stmt* parent = parentStmt(binaryOp);
if (isa<ParenExpr>(parent)) {
return true;
}
if (isa<BinaryOperator>(parent)) {
return true;
}
if (isa<ForStmt>(parent)) {
return true;
}
if (isa<ExprWithCleanups>(parent)) {
const Stmt* parent2 = parentStmt(parent);
if (isa<ForStmt>(parent2)) {
return true;
}
}
// parent->dump();
report(
DiagnosticsEngine::Warning, "comma operator hides code",
binaryOp->getSourceRange().getBegin())
<< binaryOp->getSourceRange();
return true;
}
loplugin::Plugin::Registration< CommaOperator > X("commaoperator", true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -845,7 +845,8 @@ bool java_sql_Connection::construct(const OUString& url,
{
ContextClassLoaderScope ccl( t.env(), getDriverClassLoader(), getLogger(), *this );
out = t.pEnv->CallObjectMethod( m_pDriverobject, mID, args[0].l,args[1].l );
delete pProps, pProps = nullptr;
delete pProps;
pProps = nullptr;
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
}

View File

@ -389,7 +389,10 @@ void ColorFieldControl::UpdateBitmap()
const Size aSize(GetOutputSizePixel());
if (mpBitmap && mpBitmap->GetSizePixel() != aSize)
delete mpBitmap, mpBitmap = nullptr;
{
delete mpBitmap;
mpBitmap = nullptr;
}
const sal_Int32 nWidth = aSize.Width();
const sal_Int32 nHeight = aSize.Height();
@ -783,7 +786,10 @@ void ColorSliderControl::UpdateBitmap()
Size aSize(1, GetOutputSizePixel().Height());
if (mpBitmap && mpBitmap->GetSizePixel() != aSize)
delete mpBitmap, mpBitmap = nullptr;
{
delete mpBitmap;
mpBitmap = nullptr;
}
if (!mpBitmap)
mpBitmap = new Bitmap(aSize, 24);

View File

@ -573,15 +573,15 @@ Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic, double
{
default: OSL_FAIL("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" );
/* Fall through */
case( RP_LT ): nAzim = 4500, nElev = 4500; break;
case( RP_MT ): nAzim = 9000, nElev = 4500; break;
case( RP_RT ): nAzim = 13500, nElev = 4500; break;
case( RP_LM ): nAzim = 0, nElev = 4500; break;
case( RP_MM ): nAzim = 0, nElev = 9000; break;
case( RP_RM ): nAzim = 18000, nElev = 4500; break;
case( RP_LB ): nAzim = 31500, nElev = 4500; break;
case( RP_MB ): nAzim = 27000, nElev = 4500; break;
case( RP_RB ): nAzim = 22500, nElev = 4500; break;
case( RP_LT ): nAzim = 4500; nElev = 4500; break;
case( RP_MT ): nAzim = 9000; nElev = 4500; break;
case( RP_RT ): nAzim = 13500; nElev = 4500; break;
case( RP_LM ): nAzim = 0; nElev = 4500; break;
case( RP_MM ): nAzim = 0; nElev = 9000; break;
case( RP_RM ): nAzim = 18000; nElev = 4500; break;
case( RP_LB ): nAzim = 31500; nElev = 4500; break;
case( RP_MB ): nAzim = 27000; nElev = 4500; break;
case( RP_RB ): nAzim = 22500; nElev = 4500; break;
}
BmpFilterParam aParam( nAzim, nElev );

View File

@ -225,7 +225,10 @@ IMPL_LINK_TYPED( SvBaseLinksDlg, LinksSelectHdl, SvTreeListBox *, pSvTabListBox,
m_pRbManual->Check();
m_pRbManual->Disable();
if( OBJECT_CLIENT_GRF == pLink->GetObjType() )
pLinkNm = nullptr, pFilter = &sLink;
{
pLinkNm = nullptr;
pFilter = &sLink;
}
}
else
{

View File

@ -202,7 +202,7 @@ public:
void SetMode( SvxModeType eMType ) { eMode = eMType; }
void SetPaperFormatRanges( Paper eStart, Paper eEnd )
{ ePaperStart = eStart, ePaperEnd = eEnd; }
{ ePaperStart = eStart; ePaperEnd = eEnd; }
void SetCollectionList(const std::vector<OUString> &aList);
virtual void PageCreated(const SfxAllItemSet& aSet) override;

View File

@ -1838,7 +1838,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pListContainer->set_width_request(aControlSize.Width());
pListContainer->set_height_request(aControlSize.Height());
m_pSwCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pListContainer),
m_pSwCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pListContainer);
get(m_pSingleTypoCB, "singlereplace");
get(m_pSglStartQuotePB, "startsingle");

View File

@ -385,7 +385,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(vcl::Window* pParent,
{
SetExchangeSupport();
get(m_pExamplesVS, "valueset");
m_pExamplesVS->init(NumberingPageType::BULLET),
m_pExamplesVS->init(NumberingPageType::BULLET);
m_pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
}

View File

@ -77,7 +77,7 @@ SvxTextAttrPage::SvxTextAttrPage(vcl::Window* pWindow, const SfxItemSet& rInAttr
get(m_pMtrFldBottom,"MTR_FLD_BOTTOM");
get(m_pFlPosition,"FL_POSITION");
get(m_pCtlPosition,"CTL_POSITION");
m_pCtlPosition->SetControlSettings(RP_MM, 240, 100),
m_pCtlPosition->SetControlSettings(RP_MM, 240, 100);
get(m_pTsbFullWidth,"TSB_FULL_WIDTH");

View File

@ -270,7 +270,7 @@ SvxTransparenceTabPage::SvxTransparenceTabPage(vcl::Window* pParent, const SfxIt
get(m_pMtrTrgrCenterX,"MTR_TRGR_CENTER_X");
get(m_pFtTrgrCenterY,"FT_TRGR_CENTER_Y");
get(m_pMtrTrgrCenterY,"MTR_TRGR_CENTER_Y");
get(m_pFtTrgrAngle,"FT_TRGR_ANGLE"),
get(m_pFtTrgrAngle,"FT_TRGR_ANGLE");
get(m_pMtrTrgrAngle,"MTR_TRGR_ANGLE");
get(m_pMtrTrgrBorder,"MTR_TRGR_BORDER");
get(m_pMtrTrgrStartValue,"MTR_TRGR_START_VALUE");

View File

@ -198,7 +198,8 @@ ODatabaseDocument::~ODatabaseDocument()
dispose();
}
delete m_pEventContainer, m_pEventContainer = nullptr;
delete m_pEventContainer;
m_pEventContainer = nullptr;
}
Any SAL_CALL ODatabaseDocument::queryInterface( const Type& _rType ) throw (RuntimeException, std::exception)

View File

@ -131,7 +131,8 @@ namespace dbaccess
SubComponentLoader::~SubComponentLoader()
{
delete m_pData, m_pData = nullptr;
delete m_pData;
m_pData = nullptr;
}
void SAL_CALL SubComponentLoader::windowResized( const WindowEvent& i_rEvent ) throw (RuntimeException, std::exception)

View File

@ -1661,7 +1661,8 @@ int Desktop::doShutdown()
pExecGlobals->xGlobalBroadcaster->documentEventOccured(aEvent);
}
delete pResMgr, pResMgr = nullptr;
delete pResMgr;
pResMgr = nullptr;
// Restore old value
const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
if ( rCmdLineArgs.IsHeadless() || rCmdLineArgs.IsEventTesting() )
@ -1703,7 +1704,8 @@ int Desktop::doShutdown()
pExecGlobals->pPathOptions.reset( nullptr );
bool bRR = pExecGlobals->bRestartRequested;
delete pExecGlobals, pExecGlobals = nullptr;
delete pExecGlobals;
pExecGlobals = nullptr;
if ( bRR )
{

View File

@ -42,7 +42,8 @@ int file_image_open (file_image * image, const char * filename)
if (image == NULL)
return EINVAL;
image->m_base = MAP_FAILED, image->m_size = 0;
image->m_base = MAP_FAILED;
image->m_size = 0;
if ((fd = open (filename, O_RDONLY)) == -1)
return errno;
@ -60,7 +61,8 @@ int file_image_open (file_image * image, const char * filename)
goto cleanup_and_leave;
}
image->m_base = p, image->m_size = st.st_size;
image->m_base = p;
image->m_size = st.st_size;
cleanup_and_leave:
close (fd);
@ -118,7 +120,8 @@ int file_image_close (file_image * image)
if (munmap (image->m_base, image->m_size) == -1)
return errno;
image->m_base = NULL, image->m_size = 0;
image->m_base = NULL;
image->m_size = 0;
return 0;
}

View File

@ -39,9 +39,8 @@ using namespace com::sun::star;
ImportInfo::ImportInfo( ImportState eSt, SvParser* pPrsrs, const ESelection& rSel )
: aSelection( rSel )
{
pParser = pPrsrs,
pParser = pPrsrs;
eState = eSt;
nToken = 0;
nTokenValue = 0;
pAttrs = nullptr;

View File

@ -1936,11 +1936,20 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
bRet = true;
// then remove all the lists fast!
if( CplSttLstLoad & nFlags && pCplStt_ExcptLst )
delete pCplStt_ExcptLst, pCplStt_ExcptLst = nullptr;
{
delete pCplStt_ExcptLst;
pCplStt_ExcptLst = nullptr;
}
if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst )
delete pWrdStt_ExcptLst, pWrdStt_ExcptLst = nullptr;
{
delete pWrdStt_ExcptLst;
pWrdStt_ExcptLst = nullptr;
}
if( ChgWordLstLoad & nFlags && pAutocorr_List )
delete pAutocorr_List, pAutocorr_List = nullptr;
{
delete pAutocorr_List;
pAutocorr_List = nullptr;
}
nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
}
aLastCheckTime = tools::Time( tools::Time::SYSTEM );

View File

@ -1027,11 +1027,11 @@ ATTR_SETEMPHASIS:
sal_Unicode cStt, cEnd;
switch ( nTokenValue )
{
case 1: cStt = '(', cEnd = ')'; break;
case 2: cStt = '[', cEnd = ']'; break;
case 3: cStt = '<', cEnd = '>'; break;
case 4: cStt = '{', cEnd = '}'; break;
default: cStt = 0, cEnd = 0; break;
case 1: cStt = '('; cEnd = ')'; break;
case 2: cStt = '['; cEnd = ']'; break;
case 3: cStt = '<'; cEnd = '>'; break;
case 4: cStt = '{'; cEnd = '}'; break;
default: cStt = 0; cEnd = 0; break;
}
pSet->Put( SvxTwoLinesItem( true, cStt, cEnd,

View File

@ -432,7 +432,9 @@ void SvxRTFParser::ReadColorTable()
sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && sal_uInt8(-1) == nBlue )
pColor->SetColor( COL_AUTO );
aColorTbl.push_back( pColor );
nRed = 0, nGreen = 0, nBlue = 0;
nRed = 0;
nGreen = 0;
nBlue = 0;
// Color has been completely read,
// so this is still a stable status

View File

@ -183,7 +183,8 @@ namespace extensions { namespace resource
if ( !m_pResourceManager->IsValid() )
{
delete m_pResourceManager, m_pResourceManager = nullptr;
delete m_pResourceManager;
m_pResourceManager = nullptr;
throw MissingResourceException();
}

View File

@ -80,7 +80,8 @@ namespace frm
PropertyBagHelper::~PropertyBagHelper()
{
delete m_pPropertyArrayHelper, m_pPropertyArrayHelper = nullptr;
delete m_pPropertyArrayHelper;
m_pPropertyArrayHelper = nullptr;
}
@ -99,7 +100,8 @@ namespace frm
void PropertyBagHelper::impl_nts_invalidatePropertySetInfo()
{
delete m_pPropertyArrayHelper, m_pPropertyArrayHelper = nullptr;
delete m_pPropertyArrayHelper;
m_pPropertyArrayHelper = nullptr;
}

View File

@ -1732,7 +1732,8 @@ bool FormulaCompiler::MergeRangeReference( FormulaToken * * const pCode1, Formul
p1->DecRef();
p2->DecRef();
*pCode1 = p.get();
--pCode, --pc;
--pCode;
--pc;
return true;
}

View File

@ -146,7 +146,10 @@ void FormulaHelper::FillArgStrings( const OUString& rFormula,
if ( nEnd != nStart )
_rArgs.push_back(rFormula.copy( nStart, nEnd-1-nStart ));
else
_rArgs.push_back(OUString()), bLast = true;
{
_rArgs.push_back(OUString());
bLast = true;
}
}
else
{

View File

@ -979,7 +979,7 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(Runti
Sequence< Any > aArgs(1);
beans::PropertyValue aPath;
aPath.Name = "nodepath";
aPath.Value <<= OUString("/org.openoffice.Office.Common/I18N"),
aPath.Value <<= OUString("/org.openoffice.Office.Common/I18N");
aArgs[0] <<= aPath;
Reference<XInterface> xInterface = xConfigProvider->createInstanceWithArguments(

View File

@ -452,11 +452,17 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
++nSavErr; // format codes not affected
}
if (aTimeSep == aTime100Sep)
++nWarn, fprintf( stderr, "Warning: %s\n",
{
++nWarn;
fprintf( stderr, "Warning: %s\n",
"Time100SecSeparator equals TimeSeparator, this is probably an error.");
}
if (aDecSep != aTime100Sep)
++nWarn, fprintf( stderr, "Warning: %s\n",
{
++nWarn;
fprintf( stderr, "Warning: %s\n",
"Time100SecSeparator is different from DecimalSeparator, this may be correct or not. Intended?");
}
if (nSavErr != nError || nWarn)
fprintf( stderr, "Warning: %s\n",
"Don't forget to adapt corresponding FormatCode elements when changing separators.");

View File

@ -136,10 +136,14 @@ void TextSearch::setOptions2( const SearchOptions2& rOptions ) throw( RuntimeExc
{
aSrchPara = rOptions;
delete pRegexMatcher, pRegexMatcher = nullptr;
delete pWLD, pWLD = nullptr;
delete pJumpTable, pJumpTable = nullptr;
delete pJumpTable2, pJumpTable2 = nullptr;
delete pRegexMatcher;
pRegexMatcher = nullptr;
delete pWLD;
pWLD = nullptr;
delete pJumpTable;
pJumpTable = nullptr;
delete pJumpTable2;
pJumpTable2 = nullptr;
maWildcardReversePattern.clear();
maWildcardReversePattern2.clear();

View File

@ -249,21 +249,42 @@ void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase,
bOk |= aExport.ReadSvIdl( SvHash_Export(), rInStm );
if( aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ) )
SetToggle( aToggle ), bOk = true;
{
SetToggle( aToggle );
bOk = true;
}
if( aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ) )
SetAutoUpdate( aAutoUpdate ), bOk = true;
{
SetAutoUpdate( aAutoUpdate );
bOk = true;
}
if( aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ) )
SetAsynchron( aAsynchron ), bOk = true;
{
SetAsynchron( aAsynchron );
bOk = true;
}
if( aRecordAbsolute.ReadSvIdl( SvHash_RecordAbsolute(), rInStm ) )
SetRecordAbsolute( aRecordAbsolute), bOk = true;
{
SetRecordAbsolute( aRecordAbsolute);
bOk = true;
}
if( aRecordPerItem.ReadSvIdl( SvHash_RecordPerItem(), rInStm ) )
SetRecordPerItem( aRecordPerItem ), bOk = true;
{
SetRecordPerItem( aRecordPerItem );
bOk = true;
}
if( aRecordPerSet.ReadSvIdl( SvHash_RecordPerSet(), rInStm ) )
SetRecordPerSet( aRecordPerSet ), bOk = true;
{
SetRecordPerSet( aRecordPerSet );
bOk = true;
}
if( aNoRecord.ReadSvIdl( SvHash_NoRecord(), rInStm ) )
SetNoRecord( aNoRecord ), bOk = true;
{
SetNoRecord( aNoRecord );
bOk = true;
}
bOk |= aPseudoPrefix.ReadSvIdl( SvHash_PseudoPrefix(), rInStm );
bOk |= aMenuConfig.ReadSvIdl( SvHash_MenuConfig(), rInStm );

View File

@ -68,12 +68,21 @@ public:
inline void SetEscapement( const SvxEscapement eNew )
{
if( SVX_ESCAPEMENT_OFF == eNew )
nEsc = 0, nProp = 100;
{
nEsc = 0;
nProp = 100;
}
else
if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
{
nEsc = DFLT_ESC_SUPER;
nProp = DFLT_ESC_PROP;
}
else
nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
{
nEsc = DFLT_ESC_SUB;
nProp = DFLT_ESC_PROP;
}
}
inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }

View File

@ -171,7 +171,7 @@ struct ParaRange
sal_Int32 nStartPara;
sal_Int32 nEndPara;
ParaRange( sal_Int32 nS, sal_Int32 nE ) { nStartPara = nS, nEndPara = nE; }
ParaRange( sal_Int32 nS, sal_Int32 nE ) : nStartPara(nS), nEndPara(nE) {}
void Adjust();
};
@ -180,9 +180,7 @@ inline void ParaRange::Adjust()
{
if ( nStartPara > nEndPara )
{
sal_Int32 nTmp = nStartPara;
nStartPara = nEndPara;
nEndPara = nTmp;
std::swap(nStartPara, nEndPara);
}
}

View File

@ -828,7 +828,8 @@ inline void RegistryKey::releaseKey()
{
if (m_registry.isValid() && (m_hImpl != nullptr))
{
m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = nullptr;
m_registry.m_pApi->releaseKey(m_hImpl);
m_hImpl = nullptr;
}
}

View File

@ -391,7 +391,9 @@ inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
inline BitmapColor& BitmapColor::Invert()
{
DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
mcBlueOrIndex = ~mcBlueOrIndex, mcGreen = ~mcGreen, mcRed = ~mcRed;
mcBlueOrIndex = ~mcBlueOrIndex;
mcGreen = ~mcGreen;
mcRed = ~mcRed;
return *this;
}

View File

@ -75,9 +75,12 @@ void VMLExport::SetFS( ::sax_fastparser::FSHelperPtr pSerializer )
VMLExport::~VMLExport()
{
delete mpOutStrm, mpOutStrm = nullptr;
delete m_pShapeStyle, m_pShapeStyle = nullptr;
delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = nullptr;
delete mpOutStrm;
mpOutStrm = nullptr;
delete m_pShapeStyle;
m_pShapeStyle = nullptr;
delete[] m_pShapeTypeWritten;
m_pShapeTypeWritten = nullptr;
}
void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )

View File

@ -456,7 +456,8 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
sal_uInt32* pLen)
{
assert((pValueList != nullptr) && (pLen != nullptr) && "registry::getLongListValue(): invalid parameter");
*pValueList = nullptr, *pLen = 0;
*pValueList = nullptr;
*pLen = 0;
ORegKey* pKey = static_cast< ORegKey* >(hKey);
if (!pKey)
@ -495,7 +496,8 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey,
sal_uInt32* pLen)
{
OSL_PRECOND((pValueList != nullptr) && (pLen != nullptr), "registry::getStringListValue(): invalid parameter");
*pValueList = nullptr, *pLen = 0;
*pValueList = nullptr;
*pLen = 0;
ORegKey* pKey = static_cast< ORegKey* >(hKey);
if (!pKey)
@ -532,7 +534,8 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey,
sal_uInt32* pLen)
{
assert((pValueList != nullptr) && (pLen != nullptr) && "registry::getUnicodeListValue(): invalid parameter");
*pValueList = nullptr, *pLen = 0;
*pValueList = nullptr;
*pLen = 0;
ORegKey* pKey = static_cast< ORegKey* >(hKey);
if (!pKey)

View File

@ -147,7 +147,8 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
&nSrcCvtBytes );
rtl_destroyTextToUnicodeConverter( hConv );
delete[] pOrgStr, pOrgStr = nullptr;
delete[] pOrgStr;
pOrgStr = nullptr;
hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
// factor of 6 is the maximum size of an UNICODE character as utf8
@ -162,7 +163,8 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
&nSrcCvtBytes );
rtl_destroyTextToUnicodeConverter( hConv );
delete[] pUniCode, pUniCode = nullptr;
delete[] pUniCode;
pUniCode = nullptr;
return pUtf8;
};

View File

@ -202,14 +202,18 @@ FileHandle_Impl::Allocator::Allocator()
}
FileHandle_Impl::Allocator::~Allocator()
{
rtl_cache_destroy (m_cache), m_cache = nullptr;
rtl_cache_destroy (m_cache);
m_cache = nullptr;
}
void FileHandle_Impl::Allocator::allocate (sal_uInt8 ** ppBuffer, size_t * pnSize)
{
OSL_PRECOND((nullptr != ppBuffer) && (nullptr != pnSize), "FileHandle_Impl::Allocator::allocate(): contract violation");
if ((nullptr != ppBuffer) && (nullptr != pnSize))
*ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)), *pnSize = m_bufsiz;
{
*ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache));
*pnSize = m_bufsiz;
}
}
void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer)
{
@ -253,8 +257,12 @@ FileHandle_Impl::FileHandle_Impl (int fd, enum Kind kind, char const * path)
FileHandle_Impl::~FileHandle_Impl()
{
if (m_kind == KIND_FD)
Allocator::get().deallocate (m_buffer), m_buffer = nullptr;
rtl_string_release (m_strFilePath), m_strFilePath = nullptr;
{
Allocator::get().deallocate (m_buffer);
m_buffer = nullptr;
}
rtl_string_release (m_strFilePath);
m_strFilePath = nullptr;
(void) pthread_mutex_destroy(&m_mutex); // ignoring EBUSY ...
}
@ -441,7 +449,8 @@ oslFileError FileHandle_Impl::readFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return result;
m_bufptr = -1, m_buflen = 0;
m_bufptr = -1;
m_buflen = 0;
if (nBytesRequested >= m_bufsiz)
{
@ -460,7 +469,8 @@ oslFileError FileHandle_Impl::readFileAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
m_bufptr = bufptr, m_buflen = uDone;
m_bufptr = bufptr;
m_buflen = uDone;
}
if (bufpos >= m_buflen)
{
@ -472,7 +482,9 @@ oslFileError FileHandle_Impl::readFileAt (
SAL_INFO("sal.file", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
memcpy (&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
nBytesRequested -= bytes, *pBytesRead += bytes, nOffset += bytes;
nBytesRequested -= bytes;
*pBytesRead += bytes;
nOffset += bytes;
}
return osl_File_E_None;
}
@ -511,7 +523,8 @@ oslFileError FileHandle_Impl::writeFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return result;
m_bufptr = -1, m_buflen = 0;
m_bufptr = -1;
m_buflen = 0;
if (nBytesToWrite >= m_bufsiz)
{
@ -532,14 +545,17 @@ oslFileError FileHandle_Impl::writeFileAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
m_bufptr = bufptr, m_buflen = uDone;
m_bufptr = bufptr;
m_buflen = uDone;
}
size_t const bytes = std::min (m_bufsiz - bufpos, nBytesToWrite);
SAL_INFO("sal.file", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
memcpy (&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
nBytesToWrite -= bytes, *pBytesWritten += bytes, nOffset += bytes;
nBytesToWrite -= bytes;
*pBytesWritten += bytes;
nOffset += bytes;
m_buflen = std::max(m_buflen, bufpos + bytes);
m_state |= STATE_MODIFIED;
@ -569,7 +585,8 @@ oslFileError FileHandle_Impl::readLineAt (
if (result != osl_File_E_None)
return result;
m_bufptr = bufptr, m_buflen = uDone;
m_bufptr = bufptr;
m_buflen = uDone;
}
static int const LINE_STATE_BEGIN = 0;
@ -591,7 +608,8 @@ oslFileError FileHandle_Impl::readLineAt (
ppSequence, &dstpos, &(m_buffer[bufpos]), curpos - bufpos);
if (result != osl_File_E_None)
return result;
*pBytesRead += curpos - bufpos, nOffset += curpos - bufpos;
*pBytesRead += curpos - bufpos;
nOffset += curpos - bufpos;
}
bufptr = nOffset / m_bufsiz * m_bufsiz;
@ -602,10 +620,12 @@ oslFileError FileHandle_Impl::readLineAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
m_bufptr = bufptr, m_buflen = uDone;
m_bufptr = bufptr;
m_buflen = uDone;
}
bufpos = nOffset - m_bufptr, curpos = bufpos;
bufpos = nOffset - m_bufptr;
curpos = bufpos;
if (bufpos >= m_buflen)
break;
}
@ -648,7 +668,8 @@ oslFileError FileHandle_Impl::readLineAt (
ppSequence, &dstpos, &(m_buffer[bufpos]), curpos - bufpos - 1);
if (result != osl_File_E_None)
return result;
*pBytesRead += curpos - bufpos, nOffset += curpos - bufpos;
*pBytesRead += curpos - bufpos;
nOffset += curpos - bufpos;
}
break;
}
@ -684,7 +705,8 @@ oslFileError FileHandle_Impl::writeSequence_Impl (
if (*ppSequence != nullptr && nBytes != 0)
{
/* fill sequence */
memcpy(&((*ppSequence)->elements[*pnOffset]), pBuffer, nBytes), *pnOffset += nBytes;
memcpy(&((*ppSequence)->elements[*pnOffset]), pBuffer, nBytes);
*pnOffset += nBytes;
}
return (*ppSequence != nullptr) ? osl_File_E_None : osl_File_E_NOMEM;
}
@ -1479,7 +1501,8 @@ SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize )
oslFileError result = pImpl->syncFile();
if (result != osl_File_E_None)
return result;
pImpl->m_bufptr = -1, pImpl->m_buflen = 0;
pImpl->m_bufptr = -1;
pImpl->m_buflen = 0;
return pImpl->setSize (uSize);
}

View File

@ -334,7 +334,8 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirect
DirectoryItem_Impl * pImpl = static_cast< DirectoryItem_Impl* >(*pItem);
if (nullptr != pImpl)
{
pImpl->release(), pImpl = nullptr;
pImpl->release();
pImpl = nullptr;
}
#ifdef _DIRENT_HAVE_D_TYPE
pImpl = new DirectoryItem_Impl(ustrFilePath, pEntry->d_type);

View File

@ -365,7 +365,8 @@ rtl_arena_hash_remove (
{
if (segment->m_addr == addr)
{
*segpp = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment;
*segpp = segment->m_fnext;
segment->m_fnext = segment->m_fprev = segment;
break;
}
@ -785,7 +786,8 @@ rtl_arena_deactivate (
while ((segment = arena->m_hash_table[i]) != nullptr)
{
/* pop from hash table */
arena->m_hash_table[i] = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment;
arena->m_hash_table[i] = segment->m_fnext;
segment->m_fnext = segment->m_fprev = segment;
/* coalesce w/ adjacent free segment(s) */
rtl_arena_segment_coalesce (arena, segment);
@ -1034,7 +1036,8 @@ SAL_CALL rtl_arena_free (
rtl_arena_segment_coalesce (arena, segment);
/* determine (new) next and prev segment */
next = segment->m_snext, prev = segment->m_sprev;
next = segment->m_snext;
prev = segment->m_sprev;
/* entire span free when prev is a span, and next is either a span or a list head */
if (((prev->m_type == RTL_ARENA_SEGMENT_TYPE_SPAN)) &&

View File

@ -189,7 +189,8 @@ rtl_cache_hash_remove (
{
if (bufctl->m_addr == addr)
{
*ppHead = bufctl->m_next, bufctl->m_next = nullptr;
*ppHead = bufctl->m_next;
bufctl->m_next = nullptr;
break;
}
@ -322,7 +323,8 @@ rtl_cache_slab_destroy (
rtl_cache_bufctl_type * bufctl = slab->m_sp;
/* pop from freelist */
slab->m_sp = bufctl->m_next, bufctl->m_next = nullptr;
slab->m_sp = bufctl->m_next;
bufctl->m_next = nullptr;
/* return bufctl struct to bufctl cache */
rtl_cache_free (gp_cache_bufctl_cache, bufctl);
@ -914,7 +916,8 @@ rtl_cache_deactivate (
rtl_cache_magazine_type * mag;
/* prevent recursion */
mag_cache = cache->m_magazine_cache, cache->m_magazine_cache = nullptr;
mag_cache = cache->m_magazine_cache;
cache->m_magazine_cache = nullptr;
/* cleanup cpu layer */
if ((mag = cache->m_cpu_curr) != nullptr)
@ -978,7 +981,8 @@ rtl_cache_deactivate (
while ((bufctl = cache->m_hash_table[i]) != nullptr)
{
/* pop from hash table */
cache->m_hash_table[i] = bufctl->m_next, bufctl->m_next = nullptr;
cache->m_hash_table[i] = bufctl->m_next;
bufctl->m_next = nullptr;
/* return to bufctl cache */
rtl_cache_free (gp_cache_bufctl_cache, bufctl);
@ -1137,7 +1141,8 @@ SAL_CALL rtl_cache_alloc (
if (!((cache->m_constructor)(obj, cache->m_userarg)))
{
/* construction failure */
rtl_freeMemory(obj), obj = nullptr;
rtl_freeMemory(obj);
obj = nullptr;
}
}
return obj;
@ -1194,7 +1199,8 @@ SAL_CALL rtl_cache_alloc (
if (!((cache->m_constructor)(obj, cache->m_userarg)))
{
/* construction failure */
rtl_cache_slab_free (cache, obj), obj = nullptr;
rtl_cache_slab_free (cache, obj);
obj = nullptr;
}
}
return (obj);
@ -1643,19 +1649,22 @@ rtl_cache_fini()
if (gp_cache_bufctl_cache != nullptr)
{
cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = nullptr;
cache = gp_cache_bufctl_cache;
gp_cache_bufctl_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}
if (gp_cache_slab_cache != nullptr)
{
cache = gp_cache_slab_cache, gp_cache_slab_cache = nullptr;
cache = gp_cache_slab_cache;
gp_cache_slab_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}
if (gp_cache_magazine_cache != nullptr)
{
cache = gp_cache_magazine_cache, gp_cache_magazine_cache = nullptr;
cache = gp_cache_magazine_cache;
gp_cache_magazine_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}

View File

@ -173,7 +173,8 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT
}
else if (p != nullptr)
{
rtl_freeMemory (p), p = nullptr;
rtl_freeMemory (p);
p = nullptr;
}
return p;
}

View File

@ -74,16 +74,31 @@ highbit(sal_Size n)
return 0;
#if SAL_TYPES_SIZEOFLONG == 8
if (n & 0xffffffff00000000ul)
k |= 32, n >>= 32;
{
k |= 32;
n >>= 32;
}
#endif
if (n & 0xffff0000)
k |= 16, n >>= 16;
{
k |= 16;
n >>= 16;
}
if (n & 0xff00)
k |= 8, n >>= 8;
{
k |= 8;
n >>= 8;
}
if (n & 0xf0)
k |= 4, n >>= 4;
{
k |= 4;
n >>= 4;
}
if (n & 0x0c)
k |= 2, n >>= 2;
{
k |= 2;
n >>= 2;
}
if (n & 0x02)
k++;
@ -102,16 +117,31 @@ lowbit(sal_Size n)
return 0;
#if SAL_TYPES_SIZEOFLONG == 8
if (!(n & 0xffffffff))
k |= 32, n >>= 32;
{
k |= 32;
n >>= 32;
}
#endif
if (!(n & 0xffff))
k |= 16, n >>= 16;
{
k |= 16;
n >>= 16;
}
if (!(n & 0xff))
k |= 8, n >>= 8;
{
k |= 8;
n >>= 8;
}
if (!(n & 0xf))
k |= 4, n >>= 4;
{
k |= 4;
n >>= 4;
}
if (!(n & 0x3))
k |= 2, n >>= 2;
{
k |= 2;
n >>= 2;
}
if (!(n & 0x1))
k++;
return k;

View File

@ -1175,7 +1175,10 @@ static rtlCipherError rtl_cipherARCFOUR_init_Impl (
for (x = 0, y = 0; x < CIPHER_CBLOCK_ARCFOUR; x++)
{
y = (y + S[x] + K[x]) % CIPHER_CBLOCK_ARCFOUR;
t = S[x], S[x] = S[y], S[y] = t; /* swap S[x] and S[y] */
/* swap S[x] and S[y] */
t = S[x];
S[x] = S[y];
S[y] = t;
}
/* Initialize counters X and Y. */
@ -1217,7 +1220,9 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl (
ctx->m_Y = y;
/* Swap S[x] and S[y]. */
t = S[x], S[x] = S[y], S[y] = t;
t = S[x];
S[x] = S[y];
S[y] = t;
/* Evaluate next key byte S[t]. */
t = (S[x] + S[y]) % CIPHER_CBLOCK_ARCFOUR;

View File

@ -3318,7 +3318,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
if ( pOut )
{
pClientTextBox->Write( pOut->GetData(), pOut->Tell() );
delete pOut, aTextRule.pOut = nullptr;
delete pOut;
aTextRule.pOut = nullptr;
}
if ( aExtBu.Tell() )
{
@ -3381,7 +3382,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
.WriteUInt32( pClientData->Tell() );
mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
delete pClientData, pClientData = nullptr;
delete pClientData;
pClientData = nullptr;
}
if ( pClientTextBox )
{
@ -3389,7 +3391,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
.WriteUInt32( pClientTextBox->Tell() );
mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
delete pClientTextBox, pClientTextBox = nullptr;
delete pClientTextBox;
pClientTextBox = nullptr;
}
mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
}
@ -3454,7 +3457,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
.WriteUInt32( pClientTextBox->Tell() );
mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
delete pClientTextBox, pClientTextBox = nullptr;
delete pClientTextBox;
pClientTextBox = nullptr;
mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
@ -3701,7 +3705,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc
.WriteUInt32( pClientData->Tell() );
mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
delete pClientData, pClientData = nullptr;
delete pClientData;
pClientData = nullptr;
}
aPropOptSp.Commit( *mpStrm );

View File

@ -2696,7 +2696,8 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
maAnimations[pMediaObj] = pAnimation;
}
SdrObject::Free( pObj ), pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
SdrObject::Free( pObj );
pObj = pMediaObj; // SJ: hoping that pObj is not inserted in any list
pMediaObj->setURL( aMediaURL, ""/*TODO?*/ );
}
}

View File

@ -1715,7 +1715,7 @@ void AnimationImporter::importAnimateSetContainer( const Atom* pAtom, const Refe
sal_Int32 nU1, nU2;
mrStCtrl.ReadInt32( nU1 ).ReadInt32( nU2 );
dump( " set_1=\"%ld\"", nU1 ),
dump( " set_1=\"%ld\"", nU1 );
dump( " set_2=\"%ld\"", nU2 );
}
break;

View File

@ -126,8 +126,10 @@ void SdModule::Notify( SfxBroadcaster&, const SfxHint& rHint )
const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING )
{
delete pImpressOptions, pImpressOptions = nullptr;
delete pDrawOptions, pDrawOptions = nullptr;
delete pImpressOptions;
pImpressOptions = nullptr;
delete pDrawOptions;
pDrawOptions = nullptr;
}
}

View File

@ -152,10 +152,14 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
{
if( pObj )
{
delete mpOLEDataHelper, mpOLEDataHelper = nullptr;
delete mpGraphic, mpGraphic = nullptr;
delete mpBookmark, mpBookmark = nullptr;
delete mpImageMap, mpImageMap = nullptr;
delete mpOLEDataHelper;
mpOLEDataHelper = nullptr;
delete mpGraphic;
mpGraphic = nullptr;
delete mpBookmark;
mpBookmark = nullptr;
delete mpImageMap;
mpImageMap = nullptr;
if( nullptr!= dynamic_cast< const SdrOle2Obj* >( pObj ) )
{

View File

@ -126,7 +126,8 @@ void SAL_CALL PPPOptimizerDialog::dispatch( const URL& rURL,
OUString sResult( sBuf.makeStringAndClear() );
SAL_INFO("sdext.minimizer", sResult );
}
delete mpOptimizerDialog, mpOptimizerDialog = nullptr;
delete mpOptimizerDialog;
mpOptimizerDialog = nullptr;
}
catch( ... )
{

View File

@ -717,7 +717,10 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const
}
}
else
*ppStream = nullptr, *pBytes = 0;
{
*ppStream = nullptr;
*pBytes = 0;
}
return bIsDeflated;
}

View File

@ -983,7 +983,10 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::co
double page_width = convPx2mm( elem.w ), page_height = convPx2mm( elem.h );
// calculate page margins out of the relevant children (paragraphs)
elem.TopMargin = elem.h, elem.BottomMargin = 0, elem.LeftMargin = elem.w, elem.RightMargin = 0;
elem.TopMargin = elem.h;
elem.BottomMargin = 0;
elem.LeftMargin = elem.w;
elem.RightMargin = 0;
for( std::list< Element* >::const_iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )
{

View File

@ -1086,7 +1086,10 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::
double page_width = convPx2mm( elem.w ), page_height = convPx2mm( elem.h );
// calculate page margins out of the relevant children (paragraphs)
elem.TopMargin = elem.h, elem.BottomMargin = 0, elem.LeftMargin = elem.w, elem.RightMargin = 0;
elem.TopMargin = elem.h;
elem.BottomMargin = 0;
elem.LeftMargin = elem.w;
elem.RightMargin = 0;
// first element should be a paragraphy
ParagraphElement* pFirstPara = nullptr;
for( std::list< Element* >::const_iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )

View File

@ -101,7 +101,8 @@ void SfxApplication::Deinitialize()
DBG_ASSERT( pAppData_Impl->pViewFrame == nullptr, "active foreign ViewFrame" );
delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = nullptr;
delete[] pAppData_Impl->pInterfaces;
pAppData_Impl->pInterfaces = nullptr;
// free administration managers
DELETEZ(pAppData_Impl->pAppDispat);

View File

@ -341,7 +341,8 @@ void SfxModule::DestroyModules_Impl()
SfxModule* pMod = rModules[nPos];
delete pMod;
}
delete pModules, pModules = nullptr;
delete pModules;
pModules = nullptr;
}
}

View File

@ -34,7 +34,10 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream )
{
bool bRet = false;
if( pStrm )
delete pStrm, pStrm = nullptr;
{
delete pStrm;
pStrm = nullptr;
}
OString sLine, sVersion;
sal_Int32 nStt = -1, nEnd = -1, nFragStart = -1, nFragEnd = -1;

View File

@ -1894,7 +1894,7 @@ static void SetToken( OUString& rOrigStr, sal_Int32 nToken, sal_Unicode cTok, co
}
}
++pStr,
++pStr;
++i;
}

View File

@ -521,7 +521,8 @@ SfxBaseModel::~SfxBaseModel()
{
//In SvxDrawingLayerImport when !xTargetDocument the fallback SvxUnoDrawingModel created there
//never gets disposed called on it, so m_pData leaks.
delete m_pData, m_pData = nullptr;
delete m_pData;
m_pData = nullptr;
}
// XInterface

View File

@ -563,10 +563,12 @@ char *get_line(struct filepointer *filep)
for(bol = p--; ++p < eof; ) {
if (*p == '/' && *(p+1) == '*') { /* consume comments */
*p++ = ' ', *p++ = ' ';
*p++ = ' ';
*p++ = ' ';
while (*p) {
if (*p == '*' && *(p+1) == '/') {
*p++ = ' ', *p = ' ';
*p++ = ' ';
*p = ' ';
break;
}
else if (*p == '\n')
@ -576,7 +578,8 @@ char *get_line(struct filepointer *filep)
continue;
}
else if (*p == '/' && *(p+1) == '/') { /* consume comments */
*p++ = ' ', *p++ = ' ';
*p++ = ' ';
*p++ = ' ';
while (*p && *p != '\n')
*p++ = ' ';
if ( *p == '\n' )

View File

@ -70,7 +70,10 @@ short StgAvlNode::Locate
{
// check for pPivot
if( pCur->m_nBalance != 0 )
*pPivot = pCur, *pParent = *pPrev;
{
*pPivot = pCur;
*pParent = *pPrev;
}
// save pPrev location and see what direction to go
*pPrev = pCur;
nRes = pCur->Compare( pFind );

View File

@ -336,7 +336,8 @@ bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
// fixed address and size for the header
if( nPage == -1 )
{
nPos = 0L, nBytes = 512;
nPos = 0L;
nBytes = 512;
nPg2 = nPg;
}
if( m_pStrm->Tell() != nPos )
@ -365,7 +366,10 @@ bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
// fixed address and size for the header
// nPageSize must be >= 512, otherwise the header can not be written here, we check it on import
if( nPage == -1 )
nPos = 0L, nBytes = 512;
{
nPos = 0L;
nBytes = 512;
}
if( m_pStrm->Tell() != nPos )
{
m_pStrm->Seek(nPos);

View File

@ -200,7 +200,8 @@ bool StgDirEntry::StoreStream( StgIo& rIo )
if( !m_pStgStrm )
{
OpenStream( rIo );
delete m_pStgStrm, m_pStgStrm = nullptr;
delete m_pStgStrm;
m_pStgStrm = nullptr;
}
else
m_pStgStrm->SetSize( 0 );
@ -532,7 +533,11 @@ bool StgDirEntry::Commit()
if( m_aEntry.GetType() == STG_STREAM )
{
if( m_pTmpStrm )
delete m_pCurStrm, m_pCurStrm = m_pTmpStrm, m_pTmpStrm = nullptr;
{
delete m_pCurStrm;
m_pCurStrm = m_pTmpStrm;
m_pTmpStrm = nullptr;
}
if( m_bRemoved )
// Delete the stream if needed
if( m_pStgStrm )
@ -616,7 +621,10 @@ bool StgDirEntry::Tmp2Strm()
{
// We did commit once, but have not written since then
if( !m_pTmpStrm )
m_pTmpStrm = m_pCurStrm, m_pCurStrm = nullptr;
{
m_pTmpStrm = m_pCurStrm;
m_pCurStrm = nullptr;
}
if( m_pTmpStrm )
{
OSL_ENSURE( m_pStgStrm, "The pointer may not be NULL!" );

View File

@ -221,39 +221,65 @@ void StgHeader::SetFATPage( short n, sal_Int32 nb )
if( n >= 0 && n < cFATPagesInHeader )
{
if( m_nMasterFAT[ n ] != nb )
m_bDirty = sal_uInt8(true), m_nMasterFAT[ n ] = nb;
{
m_bDirty = sal_uInt8(true);
m_nMasterFAT[ n ] = nb;
}
}
}
void StgHeader::SetTOCStart( sal_Int32 n )
{
if( n != m_nTOCstrm ) m_bDirty = sal_uInt8(true), m_nTOCstrm = n;
if( n != m_nTOCstrm )
{
m_bDirty = sal_uInt8(true);
m_nTOCstrm = n;
}
}
void StgHeader::SetDataFATStart( sal_Int32 n )
{
if( n != m_nDataFAT ) m_bDirty = sal_uInt8(true), m_nDataFAT = n;
if( n != m_nDataFAT )
{
m_bDirty = sal_uInt8(true);
m_nDataFAT = n;
}
}
void StgHeader::SetDataFATSize( sal_Int32 n )
{
if( n != m_nDataFATSize ) m_bDirty = sal_uInt8(true), m_nDataFATSize = n;
if( n != m_nDataFATSize )
{
m_bDirty = sal_uInt8(true);
m_nDataFATSize = n;
}
}
void StgHeader::SetFATSize( sal_Int32 n )
{
if( n != m_nFATSize ) m_bDirty = sal_uInt8(true), m_nFATSize = n;
if( n != m_nFATSize )
{
m_bDirty = sal_uInt8(true);
m_nFATSize = n;
}
}
void StgHeader::SetFATChain( sal_Int32 n )
{
if( n != m_nMasterChain )
m_bDirty = sal_uInt8(true), m_nMasterChain = n;
{
m_bDirty = sal_uInt8(true);
m_nMasterChain = n;
}
}
void StgHeader::SetMasters( sal_Int32 n )
{
if( n != m_nMaster ) m_bDirty = sal_uInt8(true), m_nMaster = n;
if( n != m_nMaster )
{
m_bDirty = sal_uInt8(true);
m_nMaster = n;
}
}
///////////////////////////// class StgEntry

View File

@ -195,7 +195,10 @@ bool EasyFat::HasUnrefChains()
sal_uLong EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect )
{
if( nCount > 0 )
--nCount /= GetPageSize(), nCount++;
{
--nCount /= GetPageSize();
nCount++;
}
sal_Int32 nCurPage = nPage;
while( nCount != 0 )

View File

@ -110,8 +110,10 @@ sal_Int32 StgFAT::FindBlock( sal_Int32& nPgs )
if( nTmpLen )
nTmpLen++;
else
nTmpStart = i,
{
nTmpStart = i;
nTmpLen = 1;
}
if( nTmpLen == nPgs
// If we already did find a block, stop when reaching the limit
|| ( bFound && ( nEntry >= m_nLimit ) ) )
@ -120,12 +122,17 @@ sal_Int32 StgFAT::FindBlock( sal_Int32& nPgs )
else if( nTmpLen )
{
if( nTmpLen > nPgs && nTmpLen < nMaxLen )
{
// block > requested size
nMaxLen = nTmpLen, nMaxStart = nTmpStart, bFound = true;
nMaxLen = nTmpLen;
nMaxStart = nTmpStart;
bFound = true;
}
else if( nTmpLen >= nMinLen )
{
// block < requested size
nMinLen = nTmpLen, nMinStart = nTmpStart;
nMinLen = nTmpLen;
nMinStart = nTmpStart;
bFound = true;
if( nTmpLen == nPgs )
break;
@ -138,11 +145,17 @@ sal_Int32 StgFAT::FindBlock( sal_Int32& nPgs )
if( nTmpLen )
{
if( nTmpLen > nPgs && nTmpLen < nMaxLen )
{
// block > requested size
nMaxLen = nTmpLen, nMaxStart = nTmpStart;
nMaxLen = nTmpLen;
nMaxStart = nTmpStart;
}
else if( nTmpLen >= nMinLen )
{
// block < requested size
nMinLen = nTmpLen, nMinStart = nTmpStart;
nMinLen = nTmpLen;
nMinStart = nTmpStart;
}
}
if( nMinStart != STG_EOF && nMaxStart != STG_EOF )
{

View File

@ -490,7 +490,8 @@ struct FileMapping
{
// Release mapping.
unmapFile (rMapping.m_hFile, rMapping.m_pAddr, rMapping.m_nSize);
rMapping.m_pAddr = nullptr, rMapping.m_nSize = 0;
rMapping.m_pAddr = nullptr;
rMapping.m_nSize = 0;
}
};
typedef UnmapFile destructor_type;
@ -556,7 +557,10 @@ void MappedLockBytes::allocate_Impl (void ** ppPage, sal_uInt16 * pnSize)
{
OSL_PRECOND((ppPage != nullptr) && (pnSize != nullptr), "contract violation");
if ((ppPage != nullptr) && (pnSize != nullptr))
*ppPage = nullptr, *pnSize = m_nPageSize;
{
*ppPage = nullptr;
*pnSize = m_nPageSize;
}
}
void MappedLockBytes::deallocate_Impl (void * pPage)
@ -778,7 +782,8 @@ storeError MemoryLockBytes::setSize_Impl (sal_uInt32 nSize)
if (nSize != 0)
return store_E_OutOfMemory;
}
m_pData = pData, m_nSize = nSize;
m_pData = pData;
m_nSize = nSize;
}
return store_E_None;
}

View File

@ -61,7 +61,8 @@ SharedCount::Allocator::Allocator()
SharedCount::Allocator::~Allocator()
{
rtl_cache_destroy (m_cache), m_cache = nullptr;
rtl_cache_destroy (m_cache);
m_cache = nullptr;
}
/*========================================================================
@ -124,14 +125,18 @@ PageData::Allocator_Impl::initialize (sal_uInt16 nPageSize)
PageData::Allocator_Impl::~Allocator_Impl()
{
rtl_cache_destroy(m_page_cache), m_page_cache = nullptr;
rtl_cache_destroy(m_page_cache);
m_page_cache = nullptr;
}
void PageData::Allocator_Impl::allocate_Impl (void ** ppPage, sal_uInt16 * pnSize)
{
OSL_PRECOND((ppPage != nullptr) && (pnSize != nullptr), "contract violation");
if ((ppPage != nullptr) && (pnSize != nullptr))
*ppPage = rtl_cache_alloc(m_page_cache), *pnSize = m_page_size;
{
*ppPage = rtl_cache_alloc(m_page_cache);
*pnSize = m_page_size;
}
}
void PageData::Allocator_Impl::deallocate_Impl (void * pPage)

View File

@ -392,7 +392,8 @@ OStorePageBIOS::Ace::Ace()
OStorePageBIOS::Ace::~Ace()
{
m_next->m_prev = m_prev, m_prev->m_next = m_next;
m_next->m_prev = m_prev;
m_prev->m_next = m_next;
}
int
@ -485,7 +486,8 @@ OStorePageBIOS::AceCache::AceCache()
OStorePageBIOS::AceCache::~AceCache()
{
rtl_cache_destroy (m_ace_cache), m_ace_cache = nullptr;
rtl_cache_destroy (m_ace_cache);
m_ace_cache = nullptr;
}
OStorePageBIOS::Ace *
@ -510,7 +512,8 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace)
if (ace != nullptr)
{
// remove from queue (if any).
ace->m_next->m_prev = ace->m_prev, ace->m_prev->m_next = ace->m_next;
ace->m_next->m_prev = ace->m_prev;
ace->m_prev->m_next = ace->m_next;
// restore invariant state.
ace->m_next = ace->m_prev = ace;
@ -667,7 +670,8 @@ void OStorePageBIOS::cleanup_Impl()
}
// Release SuperBlock page.
delete m_pSuper, m_pSuper = nullptr;
delete m_pSuper;
m_pSuper = nullptr;
// Release PageCache.
m_xCache.clear();

View File

@ -107,7 +107,8 @@ EntryCache::EntryCache()
EntryCache::~EntryCache()
{
rtl_cache_destroy (m_entry_cache), m_entry_cache = nullptr;
rtl_cache_destroy (m_entry_cache);
m_entry_cache = nullptr;
}
Entry * EntryCache::create (PageHolder const & rxPage, sal_uInt32 nOffset)
@ -142,16 +143,31 @@ static int highbit(sal_Size n)
return 0;
#if SAL_TYPES_SIZEOFLONG == 8
if (n & 0xffffffff00000000ul)
k |= 32, n >>= 32;
{
k |= 32;
n >>= 32;
}
#endif
if (n & 0xffff0000)
k |= 16, n >>= 16;
{
k |= 16;
n >>= 16;
}
if (n & 0xff00)
k |= 8, n >>= 8;
{
k |= 8;
n >>= 8;
}
if (n & 0xf0)
k |= 4, n >>= 4;
{
k |= 4;
n >>= 4;
}
if (n & 0x0c)
k |= 2, n >>= 2;
{
k |= 2;
n >>= 2;
}
if (n & 0x02)
k++;
@ -183,7 +199,8 @@ PageCache::~PageCache()
Entry * entry = m_hash_table[i];
while (entry != nullptr)
{
m_hash_table[i] = entry->m_pNext, entry->m_pNext = nullptr;
m_hash_table[i] = entry->m_pNext;
entry->m_pNext = nullptr;
EntryCache::get().destroy (entry);
entry = m_hash_table[i];
x += 1;
@ -234,7 +251,8 @@ void PageCache::rescale_Impl (sal_Size new_size)
{
Entry * next = curr->m_pNext;
int index = hash_index_Impl(curr->m_nOffset);
curr->m_pNext = m_hash_table[index], m_hash_table[index] = curr;
curr->m_pNext = m_hash_table[index];
m_hash_table[index] = curr;
curr = next;
}
old_table[i] = nullptr;
@ -314,7 +332,8 @@ storeError PageCache::insertPageAt (PageHolder const & rxPage, sal_uInt32 nOffse
{
// Insert new entry.
int index = hash_index_Impl(nOffset);
entry->m_pNext = m_hash_table[index], m_hash_table[index] = entry;
entry->m_pNext = m_hash_table[index];
m_hash_table[index] = entry;
// Update stats and leave.
m_hash_entries += 1;
@ -368,7 +387,8 @@ storeError PageCache::removePageAt (sal_uInt32 nOffset)
Entry * entry = (*ppEntry);
// Dequeue and destroy entry.
(*ppEntry) = entry->m_pNext, entry->m_pNext = nullptr;
(*ppEntry) = entry->m_pNext;
entry->m_pNext = nullptr;
EntryCache::get().destroy (entry);
// Update stats and leave.

View File

@ -190,7 +190,8 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
xNext.swap (xPage);
// Check index.
i = xPage->find (rEntry), n = xPage->usageCount();
i = xPage->find (rEntry);
n = xPage->usageCount();
if (!(i < n))
{
// Path to entry not exists (Must not happen(?)).

View File

@ -637,7 +637,8 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
{
if ( !*pOld && !*pNew )
return;
++pOld, ++pNew;
++pOld;
++pNew;
}
// create new item-array (by iterating through all new ranges)

View File

@ -1902,9 +1902,15 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
sal_uInt16 nNewPos = GetColumnPos(nColId);
bool bMoveAllowed = false;
if ( BROWSER_MOVECOLUMNLEFT == nId && nNewPos > 1 )
--nNewPos,bMoveAllowed = true;
{
--nNewPos;
bMoveAllowed = true;
}
else if ( BROWSER_MOVECOLUMNRIGHT == nId && nNewPos < (ColCount()-1) )
++nNewPos,bMoveAllowed = true;
{
++nNewPos;
bMoveAllowed = true;
}
if ( bMoveAllowed )
{

View File

@ -538,7 +538,8 @@ IcnGridMap_Impl::IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView)
IcnGridMap_Impl::~IcnGridMap_Impl()
{
delete[] _pGridMap, _pGridMap=nullptr;
delete[] _pGridMap;
_pGridMap = nullptr;
}
void IcnGridMap_Impl::Expand()
@ -719,7 +720,8 @@ void IcnGridMap_Impl::Clear()
{
if( _pGridMap )
{
delete[] _pGridMap, _pGridMap=nullptr;
delete[] _pGridMap;
_pGridMap = nullptr;
_nGridRows = 0;
_nGridCols = 0;
_aLastOccupiedGrid.SetEmpty();

View File

@ -391,7 +391,8 @@ void ExportDialog::GetGraphicStream()
{
if ( !IsTempExportAvailable() )
{
delete mpTempStream, mpTempStream = new SvMemoryStream();
delete mpTempStream;
mpTempStream = new SvMemoryStream();
maBitmap = Bitmap();
return;
}
@ -409,7 +410,8 @@ void ExportDialog::GetGraphicStream()
{
if ( bRecreateOutputStream )
{
delete mpTempStream, mpTempStream = new SvMemoryStream();
delete mpTempStream;
mpTempStream = new SvMemoryStream();
maBitmap = Bitmap();
uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) );

View File

@ -208,13 +208,22 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
const Graphic& rGraphic = rObj.GetGraphic();
if( mpBmpEx )
delete mpBmpEx, mpBmpEx = nullptr;
{
delete mpBmpEx;
mpBmpEx = nullptr;
}
if( mpMtf )
delete mpMtf, mpMtf = nullptr;
{
delete mpMtf;
mpMtf = nullptr;
}
if( mpAnimation )
delete mpAnimation, mpAnimation = nullptr;
{
delete mpAnimation;
mpAnimation = nullptr;
}
switch( rGraphic.GetType() )
{
@ -361,9 +370,12 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*
if( mbSwappedAll )
{
delete mpBmpEx, mpBmpEx = nullptr;
delete mpMtf, mpMtf = nullptr;
delete mpAnimation, mpAnimation = nullptr;
delete mpBmpEx;
mpBmpEx = nullptr;
delete mpMtf;
mpMtf = nullptr;
delete mpAnimation;
mpAnimation = nullptr;
// #119176# also reset SvgData
maSvgData.reset();

View File

@ -126,7 +126,10 @@ GraphicObject::~GraphicObject()
mpMgr->ImplUnregisterObj( *this );
if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() )
delete mpGlobalMgr, mpGlobalMgr = nullptr;
{
delete mpGlobalMgr;
mpGlobalMgr = nullptr;
}
}
delete mpSwapOutTimer;
@ -177,7 +180,10 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OSt
mpMgr->ImplUnregisterObj( *this );
if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() )
delete mpGlobalMgr, mpGlobalMgr = nullptr;
{
delete mpGlobalMgr;
mpGlobalMgr = nullptr;
}
}
if( !pMgr )
@ -350,7 +356,8 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
mpMgr->ImplUnregisterObj( *this );
maSwapStreamHdl = Link<const GraphicObject*, SvStream*>();
delete mpSimpleCache, mpSimpleCache = nullptr;
delete mpSimpleCache;
mpSimpleCache = nullptr;
maGraphic = rGraphicObj.GetGraphic();
maAttr = rGraphicObj.maAttr;
@ -400,7 +407,10 @@ void GraphicObject::SetAttr( const GraphicAttr& rAttr )
maAttr = rAttr;
if( mpSimpleCache && ( mpSimpleCache->maAttr != rAttr ) )
delete mpSimpleCache, mpSimpleCache = nullptr;
{
delete mpSimpleCache;
mpSimpleCache = nullptr;
}
}
void GraphicObject::SetLink()
@ -454,7 +464,10 @@ void GraphicObject::SetSwapStreamHdl(const Link<const GraphicObject*, SvStream*>
mpSwapOutTimer->Start();
}
else
delete mpSwapOutTimer, mpSwapOutTimer = nullptr;
{
delete mpSwapOutTimer;
mpSwapOutTimer = nullptr;
}
}
void GraphicObject::FireSwapInRequest()
@ -684,7 +697,8 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC
mbAutoSwapped = false;
ImplAssignGraphicData();
maLink.clear();
delete mpSimpleCache, mpSimpleCache = nullptr;
delete mpSimpleCache;
mpSimpleCache = nullptr;
mpMgr->ImplRegisterObj( *this, maGraphic, nullptr, pCopyObj);

View File

@ -478,8 +478,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
if( ( nUnRotX >= 0L ) && ( nUnRotX < aUnrotatedWidth ) &&
( nUnRotY >= 0L ) && ( nUnRotY < aUnrotatedHeight ) )
{
nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ];
nTmpX = pMapIX[ nUnRotX ];
nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ];
nTmpFY = pMapFY[ nUnRotY ];
const BitmapColor& rCol0 = pReadAccess->GetPaletteColor( pReadAccess->GetPixelIndex( nTmpY, nTmpX ) );
const BitmapColor& rCol1 = pReadAccess->GetPaletteColor( pReadAccess->GetPixelIndex( nTmpY, ++nTmpX ) );
@ -518,8 +520,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
if( ( nUnRotX >= 0L ) && ( nUnRotX < aUnrotatedWidth ) &&
( nUnRotY >= 0L ) && ( nUnRotY < aUnrotatedHeight ) )
{
nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ];
nTmpX = pMapIX[ nUnRotX ];
nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ];
nTmpFY = pMapFY[ nUnRotY ];
aCol0 = pReadAccess->GetPixel( nTmpY, nTmpX );
aCol1 = pReadAccess->GetPixel( nTmpY, ++nTmpX );
@ -643,7 +647,8 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
for( long nY = 0; nY < aTargetHeight; nY++ )
{
nSinY = pSinY[ nY ], nCosY = pCosY[ nY ];
nSinY = pSinY[ nY ];
nCosY = pCosY[ nY ];
pLineW = pWriteAccess->GetScanline( nY );
for( long nX = 0; nX < aTargetWidth; nX++ )
@ -654,8 +659,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
if( ( nUnRotX >= 0L ) && ( nUnRotX < aUnrotatedWidth ) &&
( nUnRotY >= 0L ) && ( nUnRotY < aUnrotatedHeight ) )
{
nTmpX = pMapIX[ nUnRotX ], nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ];
nTmpX = pMapIX[ nUnRotX ];
nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ];
nTmpFY = pMapFY[ nUnRotY ];
pLine0 = pReadAccess->GetScanline( nTmpY++ );
pLine1 = pReadAccess->GetScanline( nTmpY );
@ -740,7 +747,8 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
for( long nY = 0; nY < aTargetHeight; nY++ )
{
nSinY = pSinY[ nY ], nCosY = pCosY[ nY ];
nSinY = pSinY[ nY ];
nCosY = pCosY[ nY ];
for( long nX = 0; nX < aTargetWidth; nX++ )
{
@ -750,8 +758,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
if( ( nUnRotX >= 0L ) && ( nUnRotX < aUnrotatedWidth ) &&
( nUnRotY >= 0L ) && ( nUnRotY < aUnrotatedHeight ) )
{
nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ];
nTmpX = pMapIX[ nUnRotX ];
nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ];
nTmpFY = pMapFY[ nUnRotY ];
const long nAlpha0 = pReadAccess->GetPixel( nTmpY, nTmpX ).GetIndex();
const long nAlpha1 = pReadAccess->GetPixel( nTmpY, ++nTmpX ).GetIndex();

View File

@ -664,8 +664,16 @@ void EmbeddedObjectRef::DrawPaintReplacement( const Rectangle &rRect, const OUSt
aPt.Y() = (rRect.GetHeight() - pOut->GetTextHeight()) / 2;
bool bTiny = false;
if( aPt.X() < 0 ) bTiny = true, aPt.X() = 0;
if( aPt.Y() < 0 ) bTiny = true, aPt.Y() = 0;
if( aPt.X() < 0 )
{
bTiny = true;
aPt.X() = 0;
}
if( aPt.Y() < 0 )
{
bTiny = true;
aPt.Y() = 0;
}
if( bTiny )
{
// decrease for small images

View File

@ -1181,8 +1181,10 @@ TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDat
StopClipboardListening();
mxTransfer = rDataHelper.mxTransfer;
delete mpFormats, mpFormats = new DataFlavorExVector( *rDataHelper.mpFormats );
delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor( *rDataHelper.mpObjDesc );
delete mpFormats;
mpFormats = new DataFlavorExVector( *rDataHelper.mpFormats );
delete mpObjDesc;
mpObjDesc = new TransferableObjectDescriptor( *rDataHelper.mpObjDesc );
mxClipboard = rDataHelper.mxClipboard;
if ( bWasClipboardListening )
@ -1198,8 +1200,10 @@ TransferableDataHelper::~TransferableDataHelper()
StopClipboardListening( );
{
::osl::MutexGuard aGuard( mpImpl->maMutex );
delete mpFormats, mpFormats = nullptr;
delete mpObjDesc, mpObjDesc = nullptr;
delete mpFormats;
mpFormats = nullptr;
delete mpObjDesc;
mpObjDesc = nullptr;
}
}
@ -1303,7 +1307,8 @@ void TransferableDataHelper::InitFormats()
::osl::MutexGuard aGuard( mpImpl->maMutex );
mpFormats->clear();
delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor;
delete mpObjDesc;
mpObjDesc = new TransferableObjectDescriptor;
if( mxTransfer.is() )
{

View File

@ -1502,12 +1502,16 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
if( bStripCRLF )
aToken = aToken.replaceAt( nPos, 1, "" );
else
nPos++, nLen++;
{
nPos++;
nLen++;
}
break;
case '\\':
if( bOldEscape )
{
nPos++, nLen++;
nPos++;
nLen++;
}
else
{
@ -1519,10 +1523,14 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
case '\'':
bDone = !bOldEscape && cChar==cEnd;
if( !bDone )
nPos++, nLen++;
{
nPos++;
nLen++;
}
break;
default:
nPos++, nLen++;
nPos++;
nLen++;
break;
}
}
@ -1544,7 +1552,10 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
case ' ':
bDone = !bOldEscape;
if( !bDone )
nPos++, nLen++;
{
nPos++;
nLen++;
}
break;
case '\t':
@ -1556,7 +1567,8 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
case '\\':
if( bOldEscape )
{
nPos++, nLen++;
nPos++;
nLen++;
}
else
{
@ -1567,7 +1579,10 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
default:
if( HTML_ISPRINTABLE( c ) )
nPos++, nLen++;
{
nPos++;
nLen++;
}
else
bDone = true;
break;

View File

@ -56,7 +56,7 @@ AccessibleShapeTreeInfo& AccessibleShapeTreeInfo::operator= (const AccessibleSha
mxDocumentWindow = rInfo.mxDocumentWindow;
mxModelBroadcaster = rInfo.mxModelBroadcaster;
mpView = rInfo.mpView;
mxController = rInfo.mxController,
mxController = rInfo.mxController;
mpWindow = rInfo.mpWindow;
mpViewForwarder = rInfo.mpViewForwarder;
}

View File

@ -621,7 +621,8 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
if( pIStm->GetError() )
{
delete pTheme, pTheme = nullptr;
delete pTheme;
pTheme = nullptr;
}
}
catch (const css::ucb::ContentCreationException&)

View File

@ -454,7 +454,10 @@ void GalleryTransferable::InitData( bool bLazy )
mpURL = new INetURLObject;
if( !mpTheme->GetURL( mnObjectPos, *mpURL ) )
delete mpURL, mpURL = nullptr;
{
delete mpURL;
mpURL = nullptr;
}
}
if( ( SGA_OBJ_SOUND != meObjectKind ) && !mpGraphicObject )
@ -570,9 +573,12 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased()
{
mxModelStream.Clear();
delete mpGraphicObject, mpGraphicObject = nullptr;
delete mpImageMap, mpImageMap = nullptr;
delete mpURL, mpURL = nullptr;
delete mpGraphicObject;
mpGraphicObject = nullptr;
delete mpImageMap;
mpImageMap = nullptr;
delete mpURL;
mpURL = nullptr;
}
void GalleryTransferable::CopyToClipboard( vcl::Window* pWindow )

View File

@ -56,7 +56,12 @@ SfxPoolItem* SvxGrfCrop::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
rStrm.ReadInt32( top ).ReadInt32( left ).ReadInt32( right ).ReadInt32( bottom );
if( GRFCROP_VERSION_SWDEFAULT == nVersion )
top = -top, bottom = -bottom, left = -left, right = -right;
{
top = -top;
bottom = -bottom;
left = -left;
right = -right;
}
SvxGrfCrop* pNew = static_cast<SvxGrfCrop*>(Clone());
pNew->SetLeft( left );
@ -72,7 +77,12 @@ SvStream& SvxGrfCrop::Store( SvStream& rStrm, sal_uInt16 nVersion ) const
sal_Int32 left = GetLeft(), right = GetRight(),
top = GetTop(), bottom = GetBottom();
if( GRFCROP_VERSION_SWDEFAULT == nVersion )
top = -top, bottom = -bottom, left = -left, right = -right;
{
top = -top;
bottom = -bottom;
left = -left;
right = -right;
}
rStrm.WriteInt32( top ).WriteInt32( left ).WriteInt32( right ).WriteInt32( bottom );

View File

@ -109,7 +109,8 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString&
{
Size aSize( GetTextWidth( "-100 %" ), GetTextHeight() );
aSize.Width() += 20, aSize.Height() += 6;
aSize.Width() += 20;
aSize.Height() += 6;
SetSizePixel( aSize );
if ( maCommand == ".uno:GrafGamma" )
@ -274,9 +275,15 @@ ImplGrafControl::ImplGrafControl(
SetBackground( Wallpaper( COL_TRANSPARENT ) );
if( aImgSize.Height() > aFldSize.Height() )
nImgY = 0, nFldY = ( aImgSize.Height() - aFldSize.Height() ) >> 1;
{
nImgY = 0;
nFldY = ( aImgSize.Height() - aFldSize.Height() ) >> 1;
}
else
nFldY = 0, nImgY = ( aFldSize.Height() - aImgSize.Height() ) >> 1;
{
nFldY = 0;
nImgY = ( aFldSize.Height() - aImgSize.Height() ) >> 1;
}
long nOffset = SYMBOL_TO_FIELD_OFFSET / 2;
maImage->SetPosPixel( Point( nOffset, nImgY ) );

View File

@ -235,7 +235,8 @@ SvxShape::~SvxShape() throw()
SdrObject::Free( pObject );
}
delete mpImpl, mpImpl = nullptr;
delete mpImpl;
mpImpl = nullptr;
EndListeningAll(); // call explictily within SolarMutexGuard
}

View File

@ -336,8 +336,10 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
maGrfObj = aGraphic;
if( maGrfObj.GetType() != GRAPHIC_NONE )
{
delete mpOStm, mpOStm = nullptr;
delete mpTmp, mpTmp = nullptr;
delete mpOStm;
mpOStm = nullptr;
delete mpTmp;
mpTmp = nullptr;
}
}

View File

@ -550,8 +550,8 @@
// -> remove from the aggregate property sequence
::comphelper::removeElementAt( aAggregateProps, pAggPropPos - pAggProps );
// which means we have to adjust the pointers
pAggProps = aAggregateProps.getConstArray(),
pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength(),
pAggProps = aAggregateProps.getConstArray();
pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength();
// and additionally, remember the id of this property
rDuplicateIds.push_back( pProp->Handle );

View File

@ -768,8 +768,12 @@ Polygon::Polygon( const Point& rBezPt1, const Point& rCtrlPt1,
{
Point& rPt = mpImplPolygon->mpPointAry[ i ];
fK_2 = fK_1, fK_3 = ( fK_2 *= fK_1 ), fK_3 *= fK_1;
fK1_2 = fK1_1, fK1_3 = ( fK1_2 *= fK1_1 ), fK1_3 *= fK1_1;
fK_2 = fK_1;
fK_3 = ( fK_2 *= fK_1 );
fK_3 *= fK_1;
fK1_2 = fK1_1;
fK1_3 = ( fK1_2 *= fK1_1 );
fK1_3 *= fK1_1;
double fK12 = fK_1 * fK1_2;
double fK21 = fK_2 * fK1_1;
@ -1129,7 +1133,7 @@ private:
public:
explicit Vector2D( const Point& rPair ) : mfX( rPair.A() ), mfY( rPair.B() ) {};
double GetLength() const { return hypot( mfX, mfY ); }
Vector2D& operator-=( const Vector2D& rVec ) { mfX -= rVec.mfX, mfY -= rVec.mfY; return *this; }
Vector2D& operator-=( const Vector2D& rVec ) { mfX -= rVec.mfX; mfY -= rVec.mfY; return *this; }
double Scalar( const Vector2D& rVec ) const { return mfX * rVec.mfX + mfY * rVec.mfY ; }
Vector2D& Normalize();
bool IsPositive( Vector2D& rVec ) const { return ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0; }
@ -1140,7 +1144,10 @@ Vector2D& Vector2D::Normalize()
double fLen = Scalar( *this );
if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 ) )
mfX /= fLen, mfY /= fLen;
{
mfX /= fLen;
mfY /= fLen;
}
return *this;
}

View File

@ -35,7 +35,8 @@ FixedMemPool::FixedMemPool(char const * pTypeName, sal_uInt16 nTypeSize)
FixedMemPool::~FixedMemPool()
{
SAL_INFO("tools.memtools","FixedMemPool::dtor(\"" << m_pTypeName << "\"): " << m_pImpl);
rtl_cache_destroy (reinterpret_cast<rtl_cache_type*>(m_pImpl)), m_pImpl = nullptr;
rtl_cache_destroy (reinterpret_cast<rtl_cache_type*>(m_pImpl));
m_pImpl = nullptr;
}
void* FixedMemPool::Alloc()

View File

@ -690,7 +690,10 @@ OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream)
sal_Size nReallyRead = nLen;
const sal_Char* pPtr = buf;
while (nLen && *pPtr)
++pPtr, --nLen;
{
++pPtr;
--nLen;
}
bEnd = ( nReallyRead < sizeof(buf)-1 ) // read less than attempted to read
|| ( ( nLen > 0 ) // OR it is inside the block we read

View File

@ -213,18 +213,17 @@ BaseContent::dispose()
aEvt.Source = static_cast< XContent* >( this );
pDisposeEventListeners =
m_pDisposeEventListeners, m_pDisposeEventListeners = nullptr;
pDisposeEventListeners = m_pDisposeEventListeners;
m_pDisposeEventListeners = nullptr;
pContentEventListeners =
m_pContentEventListeners, m_pContentEventListeners = nullptr;
pContentEventListeners = m_pContentEventListeners;
m_pContentEventListeners = nullptr;
pPropertySetInfoChangeListeners =
m_pPropertySetInfoChangeListeners,
pPropertySetInfoChangeListeners = m_pPropertySetInfoChangeListeners;
m_pPropertySetInfoChangeListeners = nullptr;
pPropertyListener =
m_pPropertyListener, m_pPropertyListener = nullptr;
pPropertyListener = m_pPropertyListener;
m_pPropertyListener = nullptr;
}
if ( pDisposeEventListeners && pDisposeEventListeners->getLength() )

View File

@ -413,7 +413,8 @@ oslFileHandle FTPURL::open()
"osl_setFilePos failed");
}
else {
osl_closeFile(res),res = nullptr;
osl_closeFile(res);
res = nullptr;
throw curl_exception(err);
}
}

View File

@ -124,7 +124,10 @@ namespace ucbhelper
{
osl::MutexGuard aGuard(m_aMutex);
if(m_tmpfl)
osl_closeFile(m_tmpfl),m_tmpfl = nullptr;
{
osl_closeFile(m_tmpfl);
m_tmpfl = nullptr;
}
}

View File

@ -108,7 +108,8 @@ bool splitLastFromConfigurationPath(OUString const& _sInPath,
}
else // defined behavior for invalid paths
{
nStart = 0, nEnd = _sInPath.getLength();
nStart = 0;
nEnd = _sInPath.getLength();
nPos = -1;
}

View File

@ -65,7 +65,8 @@ namespace utl
void OComponentResModuleImpl::freeResManager()
{
delete m_pResources, m_pResources = nullptr;
delete m_pResources;
m_pResources = nullptr;
m_bInitialized = false;
}

View File

@ -947,7 +947,9 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath
void Databases::changeCSS(const OUString& newStyleSheet)
{
m_aCSS = newStyleSheet.toAsciiLowerCase();
delete[] m_pCustomCSSDoc, m_pCustomCSSDoc = nullptr,m_nCustomCSSDocLength = 0;
delete[] m_pCustomCSSDoc;
m_pCustomCSSDoc = nullptr;
m_nCustomCSSDocLength = 0;
}
void Databases::cascadingStylesheet( const OUString& Language,

View File

@ -3281,7 +3281,8 @@ namespace xmloff { namespace token {
{
assert(nPos == static_cast<sal_uInt16>(pEntry->eToken));
// "xmloff::GetXMLToken: inconsistency in the token list!"
++pEntry, ++nPos;
++pEntry;
++nPos;
}
s_bChecked = true; // it's all static, checking once is enough
}