[Libreoffice-commits] core.git: 6 commits - sc/qa sc/source
Caolán McNamara
caolanm at redhat.com
Fri Dec 26 01:48:45 PST 2014
sc/qa/unit/filters-test.cxx | 4 +--
sc/source/core/tool/scmatrix.cxx | 1
sc/source/filter/inc/condformatbuffer.hxx | 12 +++++-----
sc/source/filter/inc/extlstcontext.hxx | 10 +++++---
sc/source/filter/inc/worksheethelper.hxx | 4 ++-
sc/source/filter/oox/condformatbuffer.cxx | 36 +++++++++++++++---------------
sc/source/filter/oox/extlstcontext.cxx | 8 +++---
sc/source/filter/xml/xmlcondformat.cxx | 25 ++++++++++++--------
sc/source/filter/xml/xmlcondformat.hxx | 4 +--
9 files changed, 57 insertions(+), 47 deletions(-)
New commits:
commit abbfb33c8107e38470adc73f95ce3ac4a2b26d3b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 25 09:37:43 2014 +0000
coverity#982280 Resource leak in object
Change-Id: I005ed6f44925df7f380eadc4f9971bc1c030a0ca
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 8ddb537..ad49a09 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -86,8 +86,8 @@ ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImpo
ScRangeStringConverter::GetRangeListFromString(maRange, sRange, GetScImport().GetDocument(),
formula::FormulaGrammar::CONV_ODF);
- mpFormat = new ScConditionalFormat(0, GetScImport().GetDocument());
- mpFormat->AddRange(maRange);
+ mxFormat.reset(new ScConditionalFormat(0, GetScImport().GetDocument()));
+ mxFormat->AddRange(maRange);
}
SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt16 nPrefix,
@@ -101,19 +101,19 @@ SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt1
switch (nToken)
{
case XML_TOK_CONDFORMAT_CONDITION:
- pContext = new ScXMLCondContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat );
+ pContext = new ScXMLCondContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() );
break;
case XML_TOK_CONDFORMAT_COLORSCALE:
- pContext = new ScXMLColorScaleFormatContext( GetScImport(), nPrefix, rLocalName, mpFormat );
+ pContext = new ScXMLColorScaleFormatContext( GetScImport(), nPrefix, rLocalName, mxFormat.get() );
break;
case XML_TOK_CONDFORMAT_DATABAR:
- pContext = new ScXMLDataBarFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat );
+ pContext = new ScXMLDataBarFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() );
break;
case XML_TOK_CONDFORMAT_ICONSET:
- pContext = new ScXMLIconSetFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat );
+ pContext = new ScXMLIconSetFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() );
break;
case XML_TOK_CONDFORMAT_DATE:
- pContext = new ScXMLDateContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat );
+ pContext = new ScXMLDateContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() );
break;
default:
break;
@@ -127,10 +127,15 @@ void ScXMLConditionalFormatContext::EndElement()
ScDocument* pDoc = GetScImport().GetDocument();
SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
- sal_uLong nIndex = pDoc->AddCondFormat(mpFormat, nTab);
- mpFormat->SetKey(nIndex);
+ ScConditionalFormat* pFormat = mxFormat.release();
+ sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
+ pFormat->SetKey(nIndex);
- pDoc->AddCondFormatData( mpFormat->GetRange(), nTab, nIndex);
+ pDoc->AddCondFormatData( pFormat->GetRange(), nTab, nIndex);
+}
+
+ScXMLConditionalFormatContext::~ScXMLConditionalFormatContext()
+{
}
ScXMLColorScaleFormatContext::ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
diff --git a/sc/source/filter/xml/xmlcondformat.hxx b/sc/source/filter/xml/xmlcondformat.hxx
index 9e2e810..b209254 100644
--- a/sc/source/filter/xml/xmlcondformat.hxx
+++ b/sc/source/filter/xml/xmlcondformat.hxx
@@ -49,7 +49,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList);
- virtual ~ScXMLConditionalFormatContext() {}
+ virtual ~ScXMLConditionalFormatContext();
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
@@ -59,7 +59,7 @@ public:
virtual void EndElement() SAL_OVERRIDE;
private:
- ScConditionalFormat* mpFormat;
+ std::unique_ptr<ScConditionalFormat> mxFormat;
ScRangeList maRange;
};
commit 71c60f8f8956414034d105fe4cc64c12d3a5d2e3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 25 09:31:21 2014 +0000
coverity#982279 Resource leak in object
Change-Id: I8a616dee5795c3614baa69840b3a8808ef89b650
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 47d90d4..f983f7e 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -133,7 +133,7 @@ public:
private:
std::vector< ColorScaleRuleModelEntry > maEntries;
- ScIconSetFormatData* mpFormatData;
+ std::unique_ptr<ScIconSetFormatData> mxFormatData;
OUString maIconSetType;
};
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index f6e432c..6937ac7 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -287,7 +287,7 @@ void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScA
IconSetRule::IconSetRule( const CondFormat& rFormat ):
WorksheetHelper( rFormat ),
- mpFormatData( new ScIconSetFormatData )
+ mxFormatData( new ScIconSetFormatData )
{
}
@@ -302,8 +302,8 @@ void IconSetRule::importCfvo( const AttributeList& rAttribs )
void IconSetRule::importAttribs( const AttributeList& rAttribs )
{
maIconSetType = rAttribs.getString( XML_iconSet, OUString("3TrafficLights1") );
- mpFormatData->mbShowValue = rAttribs.getBool( XML_showValue, true );
- mpFormatData->mbReverse = rAttribs.getBool( XML_reverse, false );
+ mxFormatData->mbShowValue = rAttribs.getBool( XML_showValue, true );
+ mxFormatData->mbReverse = rAttribs.getBool( XML_reverse, false );
}
void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos )
@@ -311,7 +311,7 @@ void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScA
for(size_t i = 0; i < maEntries.size(); ++i)
{
ScColorScaleEntry* pModelEntry = ConvertToModel( maEntries[i], pDoc, rPos );
- mpFormatData->maEntries.push_back(pModelEntry);
+ mxFormatData->maEntries.push_back(pModelEntry);
}
ScIconSetType eIconSetType = IconSet_3TrafficLights1;
@@ -324,8 +324,8 @@ void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScA
break;
}
}
- mpFormatData->eIconSetType = eIconSetType;
- pFormat->SetIconSetData(mpFormatData);
+ mxFormatData->eIconSetType = eIconSetType;
+ pFormat->SetIconSetData(mxFormatData.release());
}
CondFormatRuleModel::CondFormatRuleModel() :
commit faace681fc6575dd8a16b0c8fead3ea7f0b93fe3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 25 08:45:49 2014 +0000
coverity#1260446 Uninitialized scalar field
and
coverity#1260447 Uninitialized scalar field
Change-Id: I3aa5a1caf776fddc8b6029e96c24aa86b21de880
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index af57384..7901dfe 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1908,6 +1908,7 @@ public:
wrapped_iterator(typename T::const_iterator it_, U aOp):
it(it_),
+ val(value_type()),
maOp(aOp)
{
}
commit cc5ceadf55b6f20575e819f6c5be6720093811ed
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 24 20:46:42 2014 +0000
coverity#735393 Resource leak in object
Change-Id: Ib39befba388568004a4cda57a1b161ba2a80c822
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index b3dc638..47d90d4 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -113,10 +113,10 @@ public:
void SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr );
- ScDataBarFormatData* getDataBarFormatData() { return mpFormat; }
+ ScDataBarFormatData* getDataBarFormatData() { return mxFormat.get(); }
private:
- ScDataBarFormatData* mpFormat;
+ std::unique_ptr<ScDataBarFormatData> mxFormat;
boost::scoped_ptr<ColorScaleRuleModelEntry> mpUpperLimit;
boost::scoped_ptr<ColorScaleRuleModelEntry> mpLowerLimit;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 3b10686..f6e432c 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -232,9 +232,9 @@ void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* pDoc,
DataBarRule::DataBarRule( const CondFormat& rFormat ):
WorksheetHelper( rFormat ),
- mpFormat(new ScDataBarFormatData)
+ mxFormat(new ScDataBarFormatData)
{
- mpFormat->meAxisPosition = databar::NONE;
+ mxFormat->meAxisPosition = databar::NONE;
}
void DataBarRule::importColor( const AttributeList& rAttribs )
@@ -250,7 +250,7 @@ void DataBarRule::importColor( const AttributeList& rAttribs )
::Color aColor = RgbToRgbComponents( nColor );
- mpFormat->maPositiveColor = aColor;
+ mxFormat->maPositiveColor = aColor;
}
void DataBarRule::importCfvo( const AttributeList& rAttribs )
@@ -272,7 +272,7 @@ void DataBarRule::importCfvo( const AttributeList& rAttribs )
void DataBarRule::importAttribs( const AttributeList& rAttribs )
{
- mpFormat->mbOnlyBar = !rAttribs.getBool( XML_showValue, true );
+ mxFormat->mbOnlyBar = !rAttribs.getBool( XML_showValue, true );
}
void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr )
@@ -280,9 +280,9 @@ void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScA
ScColorScaleEntry* pUpperEntry = ConvertToModel( *mpUpperLimit.get(), pDoc, rAddr);
ScColorScaleEntry* pLowerEntry = ConvertToModel( *mpLowerLimit.get(), pDoc, rAddr);
- mpFormat->mpUpperLimit.reset( pUpperEntry );
- mpFormat->mpLowerLimit.reset( pLowerEntry );
- pFormat->SetDataBarData(mpFormat);
+ mxFormat->mpUpperLimit.reset( pUpperEntry );
+ mxFormat->mpLowerLimit.reset( pLowerEntry );
+ pFormat->SetDataBarData(mxFormat.release());
}
IconSetRule::IconSetRule( const CondFormat& rFormat ):
commit 6809783a988ff2271850bb3b5f8843f03fb658c9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 24 20:34:47 2014 +0000
coverity#1260448 Uninitialized scalar field
Change-Id: I12292071f42ba3011172f35eba1be61ecd3d8483
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 3e3b02b..4beeb54 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -763,9 +763,9 @@ void ScFiltersTest::testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef x
}
}
-
ScFiltersTest::ScFiltersTest()
- : ScBootstrapFixture( "/sc/qa/unit/data" )
+ : ScBootstrapFixture( "/sc/qa/unit/data" )
+ , mbUpdateReferenceOnSort(false)
{
}
commit 8ec545531992251d3670c1bd3b1d1e0c9c998db0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 24 20:28:14 2014 +0000
what's with the void* + casting
Change-Id: I4e04db86518b9a767da23dda3678002460f6f41d
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index cdc2553..b3dc638 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -245,9 +245,9 @@ class ExtCfRule
};
ExCfRuleModel maModel;
RuleType mnRuleType;
- void* mpTarget;
+ ScDataBarFormatData* mpTarget;
public:
- ExtCfRule(void* pTarget = NULL ) : mnRuleType( ExtCfRule::UNKNOWN ), mpTarget(pTarget) {}
+ ExtCfRule(ScDataBarFormatData* pTarget = NULL ) : mnRuleType( ExtCfRule::UNKNOWN ), mpTarget(pTarget) {}
void finalizeImport();
void importDataBar( const AttributeList& rAttribs );
void importNegativeFillColor( const AttributeList& rAttribs );
@@ -268,7 +268,7 @@ public:
CondFormatRef importConditionalFormatting( const AttributeList& rAttribs );
/** Imports settings from the CONDFORMATTING record. */
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
- ExtCfRuleRef createExtCfRule( void* pTarget );
+ ExtCfRuleRef createExtCfRule(ScDataBarFormatData* pTarget);
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx
index 57675f2..e9ebd26 100644
--- a/sc/source/filter/inc/extlstcontext.hxx
+++ b/sc/source/filter/inc/extlstcontext.hxx
@@ -13,19 +13,21 @@
#include "excelhandlers.hxx"
#include "worksheetfragment.hxx"
+class ScDataBarFormatData;
+
namespace oox {
namespace xls {
class ExtCfRuleContext : public WorksheetContextBase
{
public:
- explicit ExtCfRuleContext( WorksheetContextBase& rFragment, void* pDataBar );
+ explicit ExtCfRuleContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pDataBar );
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
virtual void onStartElement( const AttributeList& rAttribs ) SAL_OVERRIDE;
private:
- void* mpTarget;
+ ScDataBarFormatData* mpTarget;
bool mbFirstEntry;
};
@@ -41,7 +43,7 @@ private:
class ExtLstLocalContext : public WorksheetContextBase
{
public:
- explicit ExtLstLocalContext( WorksheetContextBase& rFragment, void* pTarget ); // until now a ExtLst always extends an existing entry
+ explicit ExtLstLocalContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pTarget ); // until now a ExtLst always extends an existing entry
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
@@ -49,7 +51,7 @@ protected:
virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
private:
- void* mpTarget;
+ ScDataBarFormatData* mpTarget;
};
/**
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index a1bc389..4b7a927 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -26,6 +26,8 @@
#include "addressconverter.hxx"
#include "formulabase.hxx"
+class ScDataBarFormatData;
+
namespace com { namespace sun { namespace star {
namespace awt { struct Point; }
namespace awt { struct Rectangle; }
@@ -57,7 +59,7 @@ class SheetViewSettings;
class VmlDrawing;
class WorksheetSettings;
-typedef ::std::map< OUString, void* > ExtLst;
+typedef ::std::map< OUString, ScDataBarFormatData* > ExtLst;
typedef ::std::map< BinAddress, ApiTokenSequence > SharedFormulaMap;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 3edac09..3b10686 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1047,7 +1047,7 @@ CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm
return xCondFmt;
}
-ExtCfRuleRef CondFormatBuffer::createExtCfRule( void* pTarget )
+ExtCfRuleRef CondFormatBuffer::createExtCfRule(ScDataBarFormatData* pTarget)
{
ExtCfRuleRef extRule( new ExtCfRule( pTarget ) );
maCfRules.push_back( extRule );
@@ -1104,7 +1104,7 @@ void ExtCfRule::finalizeImport()
{
case DATABAR:
{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ ScDataBarFormatData* pDataBar = mpTarget;
if( maModel.maAxisPosition == "none" )
pDataBar->meAxisPosition = databar::NONE;
else if( maModel.maAxisPosition == "middle" )
@@ -1116,19 +1116,19 @@ void ExtCfRule::finalizeImport()
}
case AXISCOLOR:
{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ ScDataBarFormatData* pDataBar = mpTarget;
pDataBar->maAxisColor = RgbToRgbComponents(maModel.mnAxisColor);
break;
}
case NEGATIVEFILLCOLOR:
{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ ScDataBarFormatData* pDataBar = mpTarget;
pDataBar->mpNegativeColor.reset( new ::Color( RgbToRgbComponents(maModel.mnNegativeColor) ) );
break;
}
case CFVO:
{
- ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+ ScDataBarFormatData* pDataBar = mpTarget;
ScColorScaleEntry* pEntry = NULL;
if(maModel.mbIsLower)
pEntry = pDataBar->mpLowerLimit.get();
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 52a9e36..4f8f0ff 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -18,7 +18,7 @@ using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
-ExtCfRuleContext::ExtCfRuleContext( WorksheetContextBase& rFragment, void* pTarget ):
+ExtCfRuleContext::ExtCfRuleContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pTarget ):
WorksheetContextBase( rFragment ),
mpTarget( pTarget ),
mbFirstEntry(true)
@@ -65,7 +65,7 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
}
}
-ExtLstLocalContext::ExtLstLocalContext( WorksheetContextBase& rFragment, void* pTarget ):
+ExtLstLocalContext::ExtLstLocalContext( WorksheetContextBase& rFragment, ScDataBarFormatData* pTarget ):
WorksheetContextBase(rFragment),
mpTarget(pTarget)
{
@@ -103,7 +103,7 @@ void ExtLstLocalContext::onCharacters( const OUString& rChars )
{
if (getCurrentElement() == XLS_EXT_TOKEN( id ))
{
- getExtLst().insert( std::pair< OUString, void*>(rChars, mpTarget) );
+ getExtLst().insert( std::pair< OUString, ScDataBarFormatData*>(rChars, mpTarget) );
}
}
@@ -127,7 +127,7 @@ ContextHandlerRef ExtGlobalContext::onCreateContext( sal_Int32 nElement, const A
if(aExt == getExtLst().end())
return NULL;
- void* pInfo = aExt->second;
+ ScDataBarFormatData* pInfo = aExt->second;
if (!pInfo)
{
return NULL;
More information about the Libreoffice-commits
mailing list