[Libreoffice-commits] .: sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Jul 19 06:30:06 PDT 2011


 sw/source/filter/ww8/ww8scan.cxx |   13 +++++++++----
 sw/source/filter/ww8/ww8scan.hxx |    2 --
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 3479fad9ad14ebf2b797bc9e0e0c12ba257a082b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 19 14:24:52 2011 +0100

    I knew there was something screwy about that use of getVersion

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f2e1911..485083d 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 b2d7747..1811cb3 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


More information about the Libreoffice-commits mailing list