[Libreoffice-commits] core.git: svl/source

Eike Rathke erack at redhat.com
Mon Oct 16 20:13:03 UTC 2017


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

New commits:
commit 4f72d2ec6c210232e0abd4965e215611e807c125
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.
    
    Change-Id: I9bc4e5e56d70a275d26df0b72ed6a19e9297e0fa

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 77e0f75c4afc..5855f8928220 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -2411,21 +2411,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 < nStringsCnt)
+                        while (i < nStringsCnt &&
+                               sStrArray[i][0] == '0')
                         {
+                            rStr += sStrArray[i];
                             nPos = nPos + sStrArray[i].getLength();
+                            nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
+                            nResultStringsCnt--;
                             nCounter++;
-                            while (i < nStringsCnt &&
-                                   sStrArray[i][0] == '0')
-                            {
-                                rStr += sStrArray[i];
-                                nPos = nPos + sStrArray[i].getLength();
-                                nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
-                                nResultStringsCnt--;
-                                nCounter++;
-                                i++;
-                            }
+                            i++;
                         }
                     }
                     else
@@ -2564,21 +2561,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 < nStringsCnt)
+                            nCounter++;
+                            while (i < nStringsCnt &&
+                                   sStrArray[i][0] == '0')
                             {
+                                rStr += sStrArray[i];
                                 nPos = nPos + sStrArray[i].getLength();
+                                nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
+                                nResultStringsCnt--;
                                 nCounter++;
-                                while (i < nStringsCnt &&
-                                       sStrArray[i][0] == '0')
-                                {
-                                    rStr += sStrArray[i];
-                                    nPos = nPos + sStrArray[i].getLength();
-                                    nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
-                                    nResultStringsCnt--;
-                                    nCounter++;
-                                    i++;
-                                }
+                                i++;
                             }
                         }
                         else


More information about the Libreoffice-commits mailing list