diff options
author | Eike Rathke <erack@redhat.com> | 2017-07-18 20:10:15 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-07-18 20:10:52 +0200 |
commit | a4283e5b7b4397bfdad3605f1cd490961c28c0de (patch) | |
tree | 6a8aee361d75d545053996bb5d977c2193dd6674 | |
parent | 83b43ef2223b66484e0e90e7b614886e06f955b5 (diff) |
Eliminate some unnecessary temporary Date instances
Change-Id: Idede71608458acf4d23504b3a6a1cba557f370d1
-rw-r--r-- | sc/source/core/data/dputil.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr8.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/orcus/interface.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 10 |
5 files changed, 12 insertions, 15 deletions
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 5bff6bb4d927..4d6094d39ff5 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -122,8 +122,7 @@ OUString ScDPUtil::getDateGroupName( { Date aDate(1, 1, SC_DP_LEAPYEAR); aDate += (nValue - 1); // nValue is 1-based - Date aNullDate = pFormatter->GetNullDate(); - long nDays = aDate - aNullDate; + long nDays = aDate - pFormatter->GetNullDate(); const sal_uInt32 nFormat = pFormatter->GetFormatIndex(NF_DATE_SYS_DDMMM, ScGlobal::eLnge); Color* pColor; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 2eefbc3093c2..749673a0a7ec 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -513,8 +513,8 @@ void ScInterpreter::ScNetWorkdays( bool bOOXML_Version ) { vector<double> nSortArray; bool bWeekendMask[ 7 ]; - Date aNullDate = pFormatter->GetNullDate(); - sal_uInt32 nNullDate = Date::DateToDays( aNullDate.GetDay(), aNullDate.GetMonth(), aNullDate.GetYear() ); + const Date& rNullDate = pFormatter->GetNullDate(); + sal_uInt32 nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() ); FormulaError nErr; if ( bOOXML_Version ) { @@ -574,8 +574,8 @@ void ScInterpreter::ScWorkday_MS() nFuncFmtType = css::util::NumberFormat::DATE; vector<double> nSortArray; bool bWeekendMask[ 7 ]; - Date aNullDate = pFormatter->GetNullDate(); - sal_uInt32 nNullDate = Date::DateToDays( aNullDate.GetDay(), aNullDate.GetMonth(), aNullDate.GetYear() ); + const Date& rNullDate = pFormatter->GetNullDate(); + sal_uInt32 nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() ); FormulaError nErr = GetWeekendAndHolidayMasks_MS( nParamCount, nNullDate, nSortArray, bWeekendMask, true ); if ( nErr != FormulaError::NONE ) diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 96da08bb6e58..b964a0a209a5 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -812,8 +812,7 @@ void ScETSForecastCalculation::refill() double ScETSForecastCalculation::convertXtoMonths( double x ) { - Date aNullDate = mpFormatter->GetNullDate(); - Date aDate = aNullDate + static_cast< long >( x ); + Date aDate = mpFormatter->GetNullDate() + static_cast< long >( x ); int nYear = aDate.GetYear(); int nMonth = aDate.GetMonth(); double fMonthLength; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index c56f1c67cb80..1f59aa1f6675 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -529,8 +529,7 @@ void ScOrcusSheet::set_date_time( sal_uInt32 nSec = floor(second); sal_uInt32 nNanoSec = (second - nSec) * ::tools::Time::nanoSecPerSec; tools::Time aTime(hour, minute, nSec, nNanoSec); - Date aNullDate(pFormatter->GetNullDate()); - long nDateDiff = aDate - aNullDate; + long nDateDiff = aDate - pFormatter->GetNullDate(); double fTime = static_cast<double>(aTime.GetNanoSec()) / ::tools::Time::nanoSecPerSec + diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 99e6ba02476a..c6c3d7631f71 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -689,10 +689,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } if(eFillCmd==FILL_DATE) { - Date aNullDate = pDoc->GetFormatTable()->GetNullDate(); - Date aStartDate = aNullDate; + const Date& rNullDate = pDoc->GetFormatTable()->GetNullDate(); + Date aStartDate = rNullDate; aStartDate+= (long)fStartVal; - Date aEndDate = aNullDate; + Date aEndDate = rNullDate; aEndDate+= (long)fInputEndVal; double fTempDate=0; @@ -1119,10 +1119,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE( pFact, "ScAbstractFactory create fail!" ); - Date aNullDate( GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() ); + const Date& rNullDate( GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() ); ScopedVclPtr<AbstractScDPDateGroupDlg> pDlg( pFact->CreateScDPDateGroupDlg( pTabViewShell->GetDialogParent(), - aNumInfo, nParts, aNullDate ) ); + aNumInfo, nParts, rNullDate ) ); OSL_ENSURE( pDlg, "Dialog create fail!" ); if( pDlg->Execute() == RET_OK ) { |