diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-07-19 14:24:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-07-19 14:29:56 +0100 |
commit | 3479fad9ad14ebf2b797bc9e0e0c12ba257a082b (patch) | |
tree | 21f0bb2485c07b59ac4c45de2184e676812a9f09 | |
parent | b375e1bb75730d06f3a9dcc2b6b1c5886749ecfd (diff) |
I knew there was something screwy about that use of getVersion
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index f2e19113b9..485083d133 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -909,13 +909,18 @@ void WW8SprmIter::advance() void WW8SprmIter::UpdateMyMembers() { - if (pSprms && nRemLen > (mrSprmParser.getVersion()?1:0)) + bool bValid = (pSprms && nRemLen >= mrSprmParser.MinSprmLen()); + + if (bValid) { nAktId = mrSprmParser.GetSprmId(pSprms); - pAktParams = pSprms + mrSprmParser.DistanceToData(nAktId); nAktSize = mrSprmParser.GetSprmSize(nAktId, pSprms); + pAktParams = pSprms + mrSprmParser.DistanceToData(nAktId); + bValid = nAktSize <= nRemLen; + OSL_ENSURE(bValid, "sprm longer than remaining bytes"); } - else + + if (!bValid) { nAktId = 0; pAktParams = 0; @@ -7445,7 +7450,7 @@ sal_uInt16 wwSprmParser::DistanceToData(sal_uInt16 nId) const sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen) const { - while (nLen > (getVersion()?1:0)) + while (nLen >= MinSprmLen()) { sal_uInt16 nAktId = GetSprmId(pSprms); // gib Zeiger auf Daten diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index b2d7747d2b..1811cb38c3 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -149,8 +149,6 @@ public: // if not found. nLen must be the <= length of pSprms sal_uInt8* findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen) const; - - inline int getVersion() const { return meVersion; } //cmc, I'm dubious about the usage of this, how can it be 0 }; //--Line abovewhich the code has meaningful comments |