diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-03-04 09:16:30 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-03-04 11:28:37 +0000 |
commit | d8c7521f5ad9c952b3d6e154f158061073261750 (patch) | |
tree | a3570277790932ea6af9765fca669d2cd834ede4 | |
parent | b0d4b593d7fbfeaefa956e4ade22279f8c28a4e5 (diff) |
safer and better sprm iterator
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index b85ebe6a199a..e5cfefd4c3ce 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -471,17 +471,17 @@ sal_uInt8* WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms, sal_uInt8 nLen) { sal_uInt8* pSprms = &rSprms; - USHORT i=0; - while (i < nLen) + USHORT nRemLen=nLen; + while (nRemLen > (maSprmParser.getVersion()?1:0)) { sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms); if( nAktId == nId ) // Sprm found return pSprms + maSprmParser.DistanceToData(nId); // gib Zeiger auf Daten - USHORT x = maSprmParser.GetSprmSize(nAktId, pSprms); - i = i + x; - pSprms += x; + USHORT nSize = maSprmParser.GetSprmSize(nAktId, pSprms); + pSprms += nSize; + nRemLen -= nSize; } return 0; // Sprm not found } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 1d8f467829a4..a294259bf626 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2028,7 +2028,7 @@ String WW8ReadPString(SvStream& rStrm, rtl_TextEncoding eEnc, String WW8Read_xstz(SvStream& rStrm, USHORT nChars, bool bAtEndSeekRel1) { - UINT16 b; + UINT16 b(0); if( nChars ) b = nChars; |