summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-10-16 22:08:27 +0200
committerEike Rathke <erack@redhat.com>2017-10-16 22:12:34 +0200
commit4f72d2ec6c210232e0abd4965e215611e807c125 (patch)
tree1976ad54d79c2c0c48e7e49dba76590501f1036d /svl
parentd4269c5373cf8ccc0a5631b9d0900227e11e13f1 (diff)
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
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforscan.cxx38
1 files changed, 16 insertions, 22 deletions
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