diff options
author | Eike Rathke <erack@redhat.com> | 2024-12-05 19:17:54 +0100 |
---|---|---|
committer | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2024-12-06 17:20:51 +0100 |
commit | da87646c4f407532b41e288f3ddac9f09e42be47 (patch) | |
tree | 0e47126eddfd5b1a64550c4e30bf91b62e6739f0 | |
parent | 5e84620b1a5a60e14da0da942c87a86326ae6dae (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 6926c820ceea1a1337a97b0afda95b072027a6ff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177959
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index c14e1b0abe30..9db901463a71 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2563,6 +2563,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 @@ -2664,8 +2678,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()) |