scaddins/source/analysis/analysis.cxx | 3 ++- scaddins/source/analysis/analysishelper.hxx | 1 - sw/source/filter/ww8/writerwordglue.cxx | 1 + tools/source/datetime/tdate.cxx | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-)
New commits: commit 12cad7e619913323eb748464ffe1a3bae2a9dd4e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Nov 22 21:14:47 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Nov 24 15:14:59 2024 +0100 cid#1607163 silence Overflowed return value and cid#1608078 Overflowed return value cid#1608461 Overflowed return value Change-Id: Ic5fa20994c5be5d6c09a21c0bd1e3530ae9a6941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177164 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 81e12782a320..570d4e355261 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -407,7 +407,8 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( const uno::Reference< beans::XProp DaysToDate( nDate, nDay, nMonth, nYear ); sal_Int32 nFirstInYear = DateToDays( 1, 1, nYear ); - sal_Int16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 + sal_uInt16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); return ( nDate - nFirstInYear + ( ( nMode == 1 )? ( nFirstDayInYear + 1 ) % 7 : nFirstDayInYear ) ) / 7 + 1; } diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index fdb5d4a7994a..0fdae29ccd66 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -580,7 +580,6 @@ inline sal_Int32 GetDiffDate360( const css::uno::Reference< css::beans::XPropert inline sal_Int16 GetDayOfWeek( sal_Int32 n ) { // monday = 0, ..., sunday = 6 - assert(n >= 0); return static_cast< sal_Int16 >( ( n - 1 ) % 7 ); } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index e2c76cfaf257..1f3fa03fd962 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -744,6 +744,7 @@ namespace sw if ( rDT.GetDate() == 0 ) return 0; + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 sal_uInt32 nDT = ( rDT.GetDayOfWeek() + 1 ) % 7; nDT <<= 9; nDT += ( rDT.GetYear() - 1900 ) & 0x1ff; diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 03ec18e6f394..3548f08f06f8 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -209,9 +209,8 @@ sal_uInt16 Date::GetDayOfYear() const sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, sal_Int16 nMinimumNumberOfDaysInWeek ) const { - short nWeek; + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 short n1WDay = static_cast<short>(Date( 1, 1, GetYear() ).GetDayOfWeek()); - assert(n1WDay >= 0); short nDayOfYear = static_cast<short>(GetDayOfYear()); // weekdays start at 0, thus decrement one @@ -225,6 +224,7 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, nMinimumNumberOfDaysInWeek = 4; } + short nWeek; if ( nMinimumNumberOfDaysInWeek == 1 ) { nWeek = ((n1WDay+nDayOfYear)/7) + 1;