[Libreoffice-commits] core.git: 10 commits - chart2/source reportdesign/source sal/osl sc/source
Norbert Thiebaud
nthiebaud at gmail.com
Fri Mar 7 18:35:08 PST 2014
chart2/source/controller/main/DrawCommandDispatch.cxx | 8 +
chart2/source/view/charttypes/BarChart.cxx | 36 +++++---
reportdesign/source/ui/report/ReportController.cxx | 80 +++++++++---------
sal/osl/unx/socket.c | 12 +-
sc/source/ui/app/scmod.cxx | 40 ++++++---
5 files changed, 112 insertions(+), 64 deletions(-)
New commits:
commit ae4a27bd2cb652c5d681da2f57bf63c8bc394e38
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:34:27 2014 -0600
coverity#705404: Argument cannot be negative
Change-Id: I235a5323ee0fd60aee03c691c0c7fdf6e6e4c08b
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 1743dc08..1b0e736 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -1446,13 +1446,15 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
{
OSL_TRACE("socket call failed with error: %s", strerror(errno));
}
-
- nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr));
- if ( nRet < 0 )
+ else
{
- OSL_TRACE("connect call failed with error: %s", strerror(errno));
+ nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr));
+ if ( nRet < 0 )
+ {
+ OSL_TRACE("connect call failed with error: %s", strerror(errno));
+ }
+ close(nConnFD);
}
- close(nConnFD);
}
pSocket->m_bIsAccepting = sal_False;
}
commit dc563d3a4b772835d60068c81c77ffae8d11cc61
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:23:40 2014 -0600
coverity#704693 Unchecked dynamic cast
Change-Id: I5363aeccf469b70a76ee66f8f70dff1eb18cac52
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index dd0935c..c2a6438 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1728,7 +1728,14 @@ bool ScModule::IsTableLocked()
SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg();
if ( pChildWnd )
- bLocked = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())->IsTableLocked();
+ {
+ IAnyRefDialog* pRefDlg(dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()));
+ assert(pRefDlg);
+ if(pRefDlg)
+ {
+ bLocked = pRefDlg->IsTableLocked();
+ }
+ }
else if( pModalDlg )
bLocked = pModalDlg->IsTableLocked();
else
commit 807a7af5ea1ee8417794c0eab3ce57aa92c2ea16
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:21:37 2014 -0600
coverity#704692 Unchecked dynamic cast
Change-Id: Ida91761479f1f3685da56b6dc5adcdfd5eb70cdb
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 9f51991..dd0935c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1774,7 +1774,8 @@ bool ScModule::IsFormulaMode()
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- bIsFormula = pChildWnd->IsVisible() && pRefDlg->IsRefInputMode();
+ assert(prefDlg);
+ bIsFormula = pChildWnd->IsVisible() && pRefDlg && pRefDlg->IsRefInputMode();
}
else if(pModalDlg)
{
commit c62e9e1f8c93e2e9a73433f5e5caf119a89cfa40
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:20:42 2014 -0600
coverity#704691 Unchecked dynamic cast
Change-Id: I1a85857299ceadf2d91ec74bd12cefb856311ccb
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index ba35410..9f51991 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1834,11 +1834,14 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc,
}
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
-
- // hide the (color) selection now instead of later from LoseFocus,
- // don't abort the ref input that causes this call (bDoneRefMode = sal_False)
- pRefDlg->HideReference( false );
- pRefDlg->SetReference( aNew, pDoc );
+ assert(pRefDlg);
+ if(pRefDlg)
+ {
+ // hide the (color) selection now instead of later from LoseFocus,
+ // don't abort the ref input that causes this call (bDoneRefMode = sal_False)
+ pRefDlg->HideReference( false );
+ pRefDlg->SetReference( aNew, pDoc );
+ }
}
else if(pModalDlg)
{
commit 5c519207f2789ebfac25f0b41fb7af7202d8f226
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:19:32 2014 -0600
coverity#704690 Unchecked dynamic cast
Change-Id: Id392c07f27f8f7d8b05b0604ccf7b9180a6eb6a8
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 8aad911..ba35410 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1907,7 +1907,11 @@ void ScModule::EndReference()
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- pRefDlg->SetActive();
+ assert(pRefDlg);
+ if(pRefDlg)
+ {
+ pRefDlg->SetActive();
+ }
}
else
pModalDlg->SetActive();
commit 7adc93712e92afcd7e6db9f9d56dfa516d9b5573
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:18:28 2014 -0600
coverity#704689 Unchecked dynamic cast
Change-Id: I3c321b6008bccb4f67a023b34a5cf02d465b2909
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 26ce72d..8aad911 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1685,7 +1685,8 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh)
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- bIsModal = pChildWnd->IsVisible() &&
+ assert(pRefDlg);
+ bIsModal = pChildWnd->IsVisible() && pRefDlg &&
!( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) );
}
else if(pModalDlg)
commit 3008cb63f784634bcffc1267f069095149d0602c
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:16:23 2014 -0600
coverity#704688 Unchecked dynamic cast
Change-Id: Ie93b4be8ce0de0a2ba311df998316b81bd1838ef
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index ba7aec8..26ce72d 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1872,7 +1872,11 @@ void ScModule::AddRefEntry() // "Mehrfachselektion"
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- pRefDlg->AddRefEntry();
+ assert(pRefDlg);
+ if(pRefDlg)
+ {
+ pRefDlg->AddRefEntry();
+ }
}
else if(pModalDlg)
pModalDlg->AddRefEntry();
commit 5aed432830a2af9e74d35198515b5ab5beff253f
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 17:06:11 2014 -0600
coverity#704558 Unchecked dynamic cast
Change-Id: I45ce419c65e0fac28879747787ccf1ebc25e7698
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 799a151..60c759c 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3172,52 +3172,56 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
pNewControl = pControl;
OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl);
- uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
- xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
- uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
- uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
-
- const OUString sProps[] = { OUString(PROPERTY_NAME)
- ,OUString(PROPERTY_FONTDESCRIPTOR)
- ,OUString(PROPERTY_FONTDESCRIPTORASIAN)
- ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
- ,OUString(PROPERTY_ORIENTATION)
- ,OUString(PROPERTY_BORDER)
- ,OUString(PROPERTY_FORMATSSUPPLIER)
- ,OUString(PROPERTY_BACKGROUNDCOLOR)
- };
- for(size_t i = 0; i < sizeof (sProps) / sizeof (sProps[0]); ++i)
+ assert(pObj);
+ if(pObj)
{
- if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
- xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
- }
+ uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
+ xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
+ uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
+
+ const OUString sProps[] = { OUString(PROPERTY_NAME)
+ ,OUString(PROPERTY_FONTDESCRIPTOR)
+ ,OUString(PROPERTY_FONTDESCRIPTORASIAN)
+ ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
+ ,OUString(PROPERTY_ORIENTATION)
+ ,OUString(PROPERTY_BORDER)
+ ,OUString(PROPERTY_FORMATSSUPPLIER)
+ ,OUString(PROPERTY_BACKGROUNDCOLOR)
+ };
+ for(size_t i = 0; i < sizeof (sProps) / sizeof (sProps[0]); ++i)
+ {
+ if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
+ xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
+ }
- if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
- xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
+ if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
+ xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
- if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
- {
- ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
- xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFunctionFormula.getCompleteFormula() ) );
- }
+ if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
+ {
+ ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
+ xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFunctionFormula.getCompleteFormula() ) );
+ }
- sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
- if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
- xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( nFormatKey ) );
+ sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
+ if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
+ xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( nFormatKey ) );
- OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
- if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
- xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
+ OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
+ if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
+ xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
- pObj->CreateMediator(sal_True);
+ pObj->CreateMediator(sal_True);
- if ( _nObjectId == OBJ_DLG_FIXEDTEXT ) // special case for fixed text
- xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::makeAny(OUnoObject::GetDefaultName(pObj)));
- else if ( _nObjectId == OBJ_DLG_VFIXEDLINE )
- {
- awt::Size aOlSize = xShapeProp->getSize();
- xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
+ if ( _nObjectId == OBJ_DLG_FIXEDTEXT ) // special case for fixed text
+ xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::makeAny(OUnoObject::GetDefaultName(pObj)));
+ else if ( _nObjectId == OBJ_DLG_VFIXEDLINE )
+ {
+ awt::Size aOlSize = xShapeProp->getSize();
+ xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
+ }
}
}
commit 7b4d53699cf93188aa768d92e94409f245995b26
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 16:53:52 2014 -0600
coverity#704566 Unchecked dynamic cast
Change-Id: I13ecfc6cd816a1653a292d00de348ca7683783f1
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index 7b0ff82..6e6521b 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -86,23 +86,39 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
if( m_nDimension == 3 )
{
aRet = drawing::Direction3D(1.0,-1.0,1.0);
- BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) );
- drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() );
- if(aScale.DirectionX!=0.0)
+ BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) );
+ assert(pPosHelper);
+ if(pPosHelper)
{
- double fXSlotCount = 1.0;
- if(!m_aZSlots.empty())
- fXSlotCount = m_aZSlots.begin()->size();
-
- aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getScaledSlotWidth());
+ drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() );
+ if(aScale.DirectionX!=0.0)
+ {
+ double fXSlotCount = 1.0;
+ if(!m_aZSlots.empty())
+ {
+ fXSlotCount = m_aZSlots.begin()->size();
+ }
+ aRet.DirectionZ = aScale.DirectionZ /
+ (aScale.DirectionX + aScale.DirectionX * (fXSlotCount-1.0) * pPosHelper->getScaledSlotWidth());
+ }
+ else
+ {
+ return VSeriesPlotter::getPreferredDiagramAspectRatio();
+ }
}
else
+ {
return VSeriesPlotter::getPreferredDiagramAspectRatio();
+ }
+
if(aRet.DirectionZ<0.05)
+ {
aRet.DirectionZ=0.05;
- if(aRet.DirectionZ>10)
+ }
+ else if(aRet.DirectionZ>10)
+ {
aRet.DirectionZ=10;
-
+ }
if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() )
{
double fTemp = aRet.DirectionX;
commit 57b89ea1c2ff07b53c3cc002e5ec9e52abd0c1bd
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Mar 7 16:45:33 2014 -0600
coverity#704563 Unchecked dynamic cast
Change-Id: I314d1110a45275be905c60b36e3e3a560a052272
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index d8d8b95..0fab17d 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -176,7 +176,13 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
- ( dynamic_cast< SdrObjCustomShape* >( pObj ) )->MergeDefaultAttributes( &m_aCustomShapeType );
+
+ SdrObjCustomShape* pShape(dynamic_cast< SdrObjCustomShape* >( pObj ));
+ assert(pShape);
+ if(pShape)
+ {
+ pShape->MergeDefaultAttributes( &m_aCustomShapeType );
+ }
}
}
}
More information about the Libreoffice-commits
mailing list