svl/source/numbers/zforfind.cxx |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 6926c820ceea1a1337a97b0afda95b072027a6ff
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Dec 5 19:17:54 2024 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Dec 6 02:04:45 2024 +0100

    Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction
    
    In fact do not accept anything else than blanks after integer
    portion for a fraction.
    
    Change-Id: I29746bb7cd78ecc6a7810e8841bee748589a36e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177899
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 9e3a7bc277a7..13cdcb3ca53b 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2564,6 +2564,20 @@ bool ImpSvNumberInputScan::ScanStartString( const 
OUString& rString )
 }
 
 
+static bool lcl_isBlanks( const OUString& rStr )
+{
+    if (rStr.isEmpty())
+        return false;
+
+    for (sal_Int32 i = rStr.getLength(); i-- > 0; )
+    {
+        if (rStr[i] != ' ')
+            return false;
+    }
+    return true;
+}
+
+
 /**
  * Analyze string in the middle
  * All gone => true
@@ -2665,8 +2679,9 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& 
rString, sal_uInt16 nS
                   (nNumericsCnt == 3 &&                     // or 3 numbers
                    (nStringPos == 3 ||                      // and 4th string 
particle
                     (nStringPos == 4 && nSign)) &&          // or 5th if signed
-                   sStrArray[nStringPos-2].indexOf('/') == -1)))  // and not 
23/11/1999
-                                                                  // that was 
not accepted as date yet
+                   lcl_isBlanks(sStrArray[nStringPos-2])))) // and not 
23/11/1999
+                                                            // that was not 
accepted as date yet,
+                                                            // nor anything 
else than blanks after integer.
         {
             SkipBlanks(rString, nPos);
             if (nPos == rString.getLength())

Reply via email to