[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Fri Sep 16 21:21:13 UTC 2016


 sc/source/core/tool/interpr2.cxx |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 3bf31803959ccc54bb949630f936a768ef47a90b
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Fri Sep 9 13:18:42 2016 +0200

    tdf#101541 function WORKDAY.INTL not working properly
    
    When holidays are adjacent to weekend days, wrong results occurred.
    
    Change-Id: I9ec86e00f1a62ea941ff70617a1b448601aff9cc
    Reviewed-on: https://gerrit.libreoffice.org/28771
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 5e9d5eeb8a33fdcc500377d9eace40b5f5a7f750)
    Reviewed-on: https://gerrit.libreoffice.org/28970
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/28973

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index bd255fc..d287718 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -513,14 +513,16 @@ void ScInterpreter::ScWorkday_MS()
                     size_t nRef = 0;
                     while ( nDays )
                     {
-                        while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
-                            nRef++;
-                        if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax )
-                             nDays--;
-
                         do
+                        {
                             ++nDate;
+                        }
                         while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
+
+                        while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
+                            nRef++;
+                        if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax )
+                            nDays--;
                     }
                 }
                 else
@@ -528,14 +530,16 @@ void ScInterpreter::ScWorkday_MS()
                     sal_Int16 nRef = nMax - 1;
                     while ( nDays )
                     {
+                        do
+                        {
+                          --nDate;
+                        }
+                        while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
+
                         while ( nRef >= 0 && nSortArray.at( nRef ) > nDate )
                             nRef--;
                         if ( !( nRef >= 0 && nSortArray.at( nRef ) == nDate ) || nRef < 0 )
                              nDays++;
-
-                        do
-                          --nDate;
-                        while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s)
                     }
                 }
                 PushDouble( ( double ) ( nDate - nNullDate ) );


More information about the Libreoffice-commits mailing list