diff options
author | Eike Rathke <erack@redhat.com> | 2017-07-18 23:23:24 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-07-19 20:12:58 +0200 |
commit | 772b846c462e6465955769ed93cde046603073bb (patch) | |
tree | ec8f7a343e088feb8c42f6a57acf1ac891f71ade /sc | |
parent | 4d783c45062d030d278c076d7817b9589fa77d91 (diff) |
Change the most obvious Date+=(long)... to Date+=static_cast<sal_Int32>(...)
Simple search
git grep -l 'Date.*[+-].*[(<] *long *[>)]'
Since
commit f5b0cc2a3690ba963b3f150886e1d5ddddee9530
Date: Sat Jul 1 16:01:15 2017 +0200
Date operators +,-,+=,-= have sal_Int32 operands instead of long.
Change-Id: I2387cbceadcb056831225e4111353980d50a94d4
Reviewed-on: https://gerrit.libreoffice.org/40163
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/conditio.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dputil.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/tool/interpr8.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 4 | ||||
-rw-r--r-- | sc/workben/addin.cxx | 2 |
10 files changed, 34 insertions, 34 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 5c5c3125851c..3e9ec4c10b80 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1619,12 +1619,12 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const const Date& rActDate = *mpCache; SvNumberFormatter* pFormatter = mpDoc->GetFormatTable(); - long nCurrentDate = rActDate - pFormatter->GetNullDate(); + sal_Int32 nCurrentDate = rActDate - pFormatter->GetNullDate(); double nVal = rCell.getValue(); - long nCellDate = (long) ::rtl::math::approxFloor(nVal); + sal_Int32 nCellDate = static_cast<sal_Int32>(::rtl::math::approxFloor(nVal)); Date aCellDate = pFormatter->GetNullDate(); - aCellDate += (long) ::rtl::math::approxFloor(nVal); + aCellDate += static_cast<sal_Int32>(::rtl::math::approxFloor(nVal)); switch(meType) { @@ -1647,8 +1647,8 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const case condformat::LASTWEEK: if( rActDate.GetDayOfWeek() != SUNDAY ) { - Date aBegin(rActDate - 8 - static_cast<long>(rActDate.GetDayOfWeek())); - Date aEnd(rActDate - 2 -static_cast<long>(rActDate.GetDayOfWeek())); + Date aBegin(rActDate - 8 - static_cast<sal_Int32>(rActDate.GetDayOfWeek())); + Date aEnd(rActDate - 2 - static_cast<sal_Int32>(rActDate.GetDayOfWeek())); return aCellDate.IsBetween( aBegin, aEnd ); } else @@ -1661,8 +1661,8 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const case condformat::THISWEEK: if( rActDate.GetDayOfWeek() != SUNDAY ) { - Date aBegin(rActDate - 1 - static_cast<long>(rActDate.GetDayOfWeek())); - Date aEnd(rActDate + 5 - static_cast<long>(rActDate.GetDayOfWeek())); + Date aBegin(rActDate - 1 - static_cast<sal_Int32>(rActDate.GetDayOfWeek())); + Date aEnd(rActDate + 5 - static_cast<sal_Int32>(rActDate.GetDayOfWeek())); return aCellDate.IsBetween( aBegin, aEnd ); } else @@ -1674,7 +1674,7 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const case condformat::NEXTWEEK: if( rActDate.GetDayOfWeek() != SUNDAY ) { - return aCellDate.IsBetween( rActDate + 6 - static_cast<long>(rActDate.GetDayOfWeek()), rActDate + 12 - static_cast<long>(rActDate.GetDayOfWeek()) ); + return aCellDate.IsBetween( rActDate + 6 - static_cast<sal_Int32>(rActDate.GetDayOfWeek()), rActDate + 12 - static_cast<sal_Int32>(rActDate.GetDayOfWeek()) ); } else { diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index 1c2dcaed5164..705d62dff6b5 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -203,7 +203,7 @@ bool ScDPGroupDateFilter::match( const ScDPItemData & rCellData ) const continue; } - Date date = maNullDate + static_cast<long>(approxFloor(rCellData.GetValue())); + Date date = maNullDate + static_cast<sal_Int32>(approxFloor(rCellData.GetValue())); switch (nGroupType) { case DataPilotFieldGroupBy::YEARS: diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 4d6094d39ff5..30272169f1cc 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -334,7 +334,7 @@ sal_Int32 ScDPUtil::getDatePartValue( else { Date aDate = pFormatter->GetNullDate(); - aDate += (long)::rtl::math::approxFloor(fValue); + aDate += static_cast<sal_Int32>(::rtl::math::approxFloor(fValue)); switch ( nDatePart ) { diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 77d51762f3ef..f211d97a5619 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -270,10 +270,10 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, Date aNullDate = pDocument->GetFormatTable()->GetNullDate(); Date aDate1 = aNullDate; nVal = aFirstCell.mfValue; - aDate1 += (long)nVal; + aDate1 += static_cast<sal_Int32>(nVal); Date aDate2 = aNullDate; nVal = GetValue(nCol+nAddX, nRow+nAddY); - aDate2 += (long)nVal; + aDate2 += static_cast<sal_Int32>(nVal); if ( aDate1 != aDate2 ) { long nCmpInc = 0; @@ -301,7 +301,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (aCell.meType == CELLTYPE_VALUE) { nVal = aCell.mfValue; - aDate2 = aNullDate + (long) nVal; + aDate2 = aNullDate + static_cast<sal_Int32>(nVal); if ( eType == FILL_DAY ) { if ( aDate2-aDate1 != nCmpInc ) @@ -1079,7 +1079,7 @@ void ScTable::IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillD long nInc = (long) nStep; // upper/lower limits ? Date aNullDate = pDocument->GetFormatTable()->GetNullDate(); Date aDate = aNullDate; - aDate += (long)rVal; + aDate += static_cast<sal_Int32>(rVal); switch (eCmd) { case FILL_WEEKDAY: diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 749673a0a7ec..ae9877e5a4fb 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -126,21 +126,21 @@ void ScInterpreter::ScGetActTime() void ScInterpreter::ScGetYear() { Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); PushDouble( (double) aDate.GetYear() ); } void ScInterpreter::ScGetMonth() { Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); PushDouble( (double) aDate.GetMonth() ); } void ScInterpreter::ScGetDay() { Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); PushDouble((double) aDate.GetDay()); } @@ -200,7 +200,7 @@ void ScInterpreter::ScGetDayOfWeek() nFlag = 1; Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); int nVal = (int) aDate.GetDayOfWeek(); // MONDAY = 0 switch (nFlag) { @@ -242,7 +242,7 @@ void ScInterpreter::ScWeeknumOOo() sal_Int16 nFlag = GetInt16(); Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); PushInt( (int) aDate.GetWeekOfYear( nFlag == 1 ? SUNDAY : MONDAY )); } } @@ -259,7 +259,7 @@ void ScInterpreter::ScGetWeekOfYear() nFlag = GetInt16(); Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); sal_Int32 nMinimumNumberOfDaysInWeek; DayOfWeek eFirstDayOfWeek; @@ -302,7 +302,7 @@ void ScInterpreter::ScGetIsoWeekOfYear() if ( MustHaveParamCount( GetByte(), 1 ) ) { Date aDate = pFormatter->GetNullDate(); - aDate += (long) GetInt32(); + aDate += GetInt32(); PushInt( (int) aDate.GetWeekOfYear() ); } } @@ -737,9 +737,9 @@ void ScInterpreter::ScGetDiffDate360() else fSign = 1.0; Date aDate1 = pFormatter->GetNullDate(); - aDate1 += (long) ::rtl::math::approxFloor(nDate1); + aDate1 += static_cast<sal_Int32>(::rtl::math::approxFloor(nDate1)); Date aDate2 = pFormatter->GetNullDate(); - aDate2 += (long) ::rtl::math::approxFloor(nDate2); + aDate2 += static_cast<sal_Int32>(::rtl::math::approxFloor(nDate2)); if (aDate1.GetDay() == 31) aDate1 -= (sal_uLong) 1; else if (!bFlag) diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index b964a0a209a5..389c223c2d69 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -193,11 +193,11 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co // If month interval is used, replace maRange.X with month values // for ease of calculations. Date aNullDate = mpFormatter->GetNullDate(); - Date aDate = aNullDate + static_cast< long >( maRange[ 0 ].X ); + Date aDate = aNullDate + static_cast< sal_Int32 >( maRange[ 0 ].X ); mnMonthDay = aDate.GetDay(); for ( SCSIZE i = 1; i < mnCount && mnMonthDay; i++ ) { - Date aDate1 = aNullDate + static_cast< long >( maRange[ i ].X ); + Date aDate1 = aNullDate + static_cast< sal_Int32 >( maRange[ i ].X ); if ( aDate != aDate1 ) { if ( aDate1.GetDay() != mnMonthDay ) @@ -210,7 +210,7 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co { for ( SCSIZE i = 0; i < mnCount; i++ ) { - aDate = aNullDate + static_cast< long >( maRange[ i ].X ); + aDate = aNullDate + static_cast< sal_Int32 >( maRange[ i ].X ); maRange[ i ].X = aDate.GetYear() * 12 + aDate.GetMonth(); } } @@ -332,13 +332,13 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co SCSIZE nMissingXCount = 0; double fOriginalCount = static_cast< double >( mnCount ); if ( mnMonthDay ) - aDate = aNullDate + static_cast< long >( maRange[ 0 ].X ); + aDate = aNullDate + static_cast< sal_Int32 >( maRange[ 0 ].X ); for ( SCSIZE i = 1; i < mnCount; i++ ) { double fDist; if ( mnMonthDay ) { - Date aDate1 = aNullDate + static_cast< long >( maRange[ i ].X ); + Date aDate1 = aNullDate + static_cast< sal_Int32 >( maRange[ i ].X ); fDist = 12 * ( aDate1.GetYear() - aDate.GetYear() ) + ( aDate1.GetMonth() - aDate.GetMonth() ); aDate = aDate1; @@ -812,7 +812,7 @@ void ScETSForecastCalculation::refill() double ScETSForecastCalculation::convertXtoMonths( double x ) { - Date aDate = mpFormatter->GetNullDate() + static_cast< long >( x ); + Date aDate = mpFormatter->GetNullDate() + static_cast< sal_Int32 >( x ); int nYear = aDate.GetYear(); int nMonth = aDate.GetMonth(); double fMonthLength; diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 86f8a2d446cf..b52ff6bf86b8 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1435,7 +1435,7 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b // Convert the numeric date value to a date object. Date aDate = pFormatter->GetNullDate(); - aDate += static_cast<long>(rtl::math::approxFloor(nVal)); + aDate += static_cast<sal_Int32>(rtl::math::approxFloor(nVal)); sal_Int16 nYear = aDate.GetYear(); sal_uInt16 nMonth = aDate.GetMonth(); diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 2cdcbbfe96c6..2f5b104ee18c 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -967,7 +967,7 @@ ErrCode ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding else { Date aDate = pNumFmt->GetNullDate(); // tools date - aDate += (long)fVal; //! approxfloor? + aDate += static_cast<sal_Int32>(fVal); //! approxfloor? xRowUpdate->updateDate( nCol+1, aDate.GetUNODate() ); } } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index c6c3d7631f71..1ffb68bcb209 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -691,9 +691,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { const Date& rNullDate = pDoc->GetFormatTable()->GetNullDate(); Date aStartDate = rNullDate; - aStartDate+= (long)fStartVal; + aStartDate += static_cast<sal_Int32>(fStartVal); Date aEndDate = rNullDate; - aEndDate+= (long)fInputEndVal; + aEndDate += static_cast<sal_Int32>(fInputEndVal); double fTempDate=0; if(aStartDate.GetYear()!=aEndDate.GetYear()) diff --git a/sc/workben/addin.cxx b/sc/workben/addin.cxx index 7689afe85b86..0361ff0731cc 100644 --- a/sc/workben/addin.cxx +++ b/sc/workben/addin.cxx @@ -346,7 +346,7 @@ OUString SAL_CALL ScTestAddIn::getDateString( const css::uno::Reference< css::be { Date aNewDate( aDate.Day, aDate.Month, aDate.Year ); - aNewDate += (long)(fValue+0.5); + aNewDate += static_cast<sal_Int32>(fValue+0.5); String aRet; aRet += aNewDate.GetDay(); |