[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - svl/source

Eike Rathke erack at redhat.com
Tue Oct 17 07:53:53 UTC 2017


 svl/source/numbers/zforscan.cxx |   38 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

New commits:
commit 18d0268acce2fdd10a1186e1466768887f64623e
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Oct 16 22:08:27 2017 +0200

    Resolves: tdf#112933 correct number of one decimal in fraction of seconds
    
    Regression from
    
        commit 0ac1e2ad19d4fdb46dcf54f67db2df081f4675bb
        Date:   Wed Aug 2 09:39:43 2017 +0100
    
            Resolves: ofz#2833 null deref
    
    and similar for date+time
    
        commit 42b894f80a6d0c39bb0f7092eb204a15c22c4f38
        Date:   Sat Aug 5 19:15:36 2017 +0100
    
            ofz#2867 null deref
    
    Effectively revert the code changes of those, leaving the test
    case files intact, and "do the right thing" (switching two lines,
    to
    
        nPos = nPos + sStrArray[i].getLength();
        i++;
    
    nPos actually had always to be incremented by the length of the
    *current* string position but was used after only as an error
    position indicator, meaningless if there was no error.
    
    (cherry picked from commit 4f72d2ec6c210232e0abd4965e215611e807c125)
    
     Conflicts:
            svl/source/numbers/zforscan.cxx
    
    Backported.
    
    Change-Id: I9bc4e5e56d70a275d26df0b72ed6a19e9297e0fa
    Reviewed-on: https://gerrit.libreoffice.org/43441
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 4098fc9e85b3..73e2c1d62f98 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -2349,21 +2349,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                         bDecSep = true;
                         nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
                         OUString& rStr = sStrArray[i];
+                        nPos = nPos + sStrArray[i].getLength();
+                        nCounter++;
                         i++;
-                        if (i < nAnzStrings)
+                        while (i < nAnzStrings &&
+                               sStrArray[i][0] == '0')
                         {
+                            rStr += sStrArray[i];
                             nPos = nPos + sStrArray[i].getLength();
+                            nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
+                            nAnzResStrings--;
                             nCounter++;
-                            while (i < nAnzStrings &&
-                                   sStrArray[i][0] == '0')
-                            {
-                                rStr += sStrArray[i];
-                                nPos = nPos + sStrArray[i].getLength();
-                                nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
-                                nAnzResStrings--;
-                                nCounter++;
-                                i++;
-                            }
+                            i++;
                         }
                     }
                     else
@@ -2502,21 +2499,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                             bDecSep = true;
                             nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
                             OUString& rStr = sStrArray[i];
+                            nPos = nPos + sStrArray[i].getLength();
                             i++;
-                            if (i < nAnzStrings)
+                            nCounter++;
+                            while (i < nAnzStrings &&
+                                   sStrArray[i][0] == '0')
                             {
+                                rStr += sStrArray[i];
                                 nPos = nPos + sStrArray[i].getLength();
+                                nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
+                                nAnzResStrings--;
                                 nCounter++;
-                                while (i < nAnzStrings &&
-                                       sStrArray[i][0] == '0')
-                                {
-                                    rStr += sStrArray[i];
-                                    nPos = nPos + sStrArray[i].getLength();
-                                    nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
-                                    nAnzResStrings--;
-                                    nCounter++;
-                                    i++;
-                                }
+                                i++;
                             }
                         }
                         else


More information about the Libreoffice-commits mailing list