svl/source/numbers/zforfind.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
New commits: commit c4cf076342f3e292a17ced3b9e33bf12e091b856 Author: Eike Rathke <er...@redhat.com> AuthorDate: Thu Dec 5 19:17:54 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Dec 10 11:23:48 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 (cherry picked from commit 6926c820ceea1a1337a97b0afda95b072027a6ff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177959 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> (cherry picked from commit da87646c4f407532b41e288f3ddac9f09e42be47) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178018 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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())