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(Date( 1, 1, GetYear() ).GetDayOfWeek()); - assert(n1WDay >= 0); short nDayOfYear = static_cast(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;