[Libreoffice-commits] core.git: 4 commits - filter/source sot/source sw/source

Caolán McNamara caolanm at redhat.com
Sun Apr 20 12:41:04 PDT 2014


 filter/source/graphicfilter/eos2met/eos2met.cxx |   52 ++++++++++++------------
 sot/source/sdstor/stgcache.cxx                  |    8 +--
 sw/source/core/access/acctextframe.cxx          |    4 -
 sw/source/filter/ww8/ww8scan.cxx                |   16 +++----
 sw/source/filter/ww8/ww8scan.hxx                |   16 +++----
 5 files changed, 48 insertions(+), 48 deletions(-)

New commits:
commit 4530406b7ffcb231f2585a4d5d535629558d9837
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 18 13:57:48 2014 +0100

    coverity#705533 Unintentional integer overflow
    
    Change-Id: I24a9310471bdcfc91080382b3c637982788e68d7

diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index a481117..0f47228 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -124,14 +124,14 @@ class METWriter
 {
 private:
 
-    sal_Bool                bStatus;
-    sal_uLong               nLastPercent; // with which number pCallback has been called the last time
+    sal_Bool            bStatus;
+    sal_uInt32          nLastPercent; // with which number pCallback has been called the last time
     SvStream*           pMET;
     Rectangle           aPictureRect;
     MapMode             aPictureMapMode;
     MapMode             aTargetMapMode;
-    sal_uLong               nActualFieldStartPos;     // start position of the current 'Field'
-    sal_uLong               nNumberOfDataFields;  // number of commenced 'Graphcis Data Fields'
+    sal_uInt32          nActualFieldStartPos;     // start position of the current 'Field'
+    sal_uInt32          nNumberOfDataFields;  // number of commenced 'Graphcis Data Fields'
     Color               aGDILineColor;
     Color               aGDIFillColor;
     RasterOp            eGDIRasterOp;
@@ -146,15 +146,15 @@ private:
     long                nMETStrokeLineWidth;
     Size                aMETChrCellSize;
     short               nMETChrAngle;
-    sal_uInt8               nMETChrSet;
+    sal_uInt8           nMETChrSet;
     METChrSet*          pChrSetList; // list of Character-Sets
-    sal_uInt8               nNextChrSetId; // the first unused ChrSet-Id
-    sal_uLong               nActBitmapId; // Field-Id of the next Bitmap
-    sal_uLong               nNumberOfActions; // number of Actions in the GDIMetafile
-    sal_uLong               nNumberOfBitmaps; // number of Bitmaps
-    sal_uLong               nWrittenActions;  // number of already processed actions during the writing of the orders
-    sal_uLong               nWrittenBitmaps;  // number of already written Bitmaps
-    sal_uLong               nActBitmapPercent; // percentage of the next bitmap that's already written
+    sal_uInt8           nNextChrSetId; // the first unused ChrSet-Id
+    sal_uInt32          nActBitmapId; // Field-Id of the next Bitmap
+    sal_uInt32          nNumberOfActions; // number of Actions in the GDIMetafile
+    sal_uInt32               nNumberOfBitmaps; // number of Bitmaps
+    sal_uInt32               nWrittenActions;  // number of already processed actions during the writing of the orders
+    sal_uInt32               nWrittenBitmaps;  // number of already written Bitmaps
+    sal_uInt32               nActBitmapPercent; // percentage of the next bitmap that's already written
 
     ::std::auto_ptr< VirtualDevice >    apDummyVDev;
     OutputDevice*                       pCompDev;
@@ -170,7 +170,7 @@ private:
         // be set to 0 at the beginning, since this method is recursive)
 
     void WriteBigEndianShort(sal_uInt16 nWord);
-    void WriteBigEndianLong(sal_uLong nLong);
+    void WriteBigEndianLong(sal_uInt32 nLong);
 
     void WritePoint(Point aPt);
     void WriteClipRect( const Rectangle& rRect );
@@ -178,14 +178,14 @@ private:
                               sal_uInt8 nFlags, sal_uInt16 nSegSeqNum);
     void UpdateFieldSize();
 
-    void WriteFieldId(sal_uLong nId);
+    void WriteFieldId(sal_uInt32 nId);
 
     void CreateChrSets(const GDIMetaFile * pMTF);
     void CreateChrSet(const Font & rFont);
     void WriteChrSets();
     sal_uInt8 FindChrSet(const Font & rFont);
 
-    void WriteColorAttributeTable(sal_uLong nFieldId=4, BitmapPalette* pPalette=NULL,
+    void WriteColorAttributeTable(sal_uInt32 nFieldId=4, BitmapPalette* pPalette=NULL,
                                   sal_uInt8 nBasePartFlags=0x40, sal_uInt8 nBasePartLCTID=0);
 
     void WriteImageObject(const Bitmap & rBitmap);
@@ -193,7 +193,7 @@ private:
 
     void WriteDataDescriptor(const GDIMetaFile * pMTF);
 
-    void WillWriteOrder(sal_uLong nNextOrderMaximumLength);
+    void WillWriteOrder(sal_uInt32 nNextOrderMaximumLength);
 
     void METSetAndPushLineInfo( const LineInfo& rLineInfo );
     void METPopLineInfo( const LineInfo& rLineInfo );
@@ -277,7 +277,7 @@ void METWriter::MayCallback()
 {
     if ( xStatusIndicator.is() )
     {
-        sal_uLong nPercent;
+        sal_uInt32 nPercent;
         nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions)
                 *100/((nNumberOfBitmaps<<14)+nNumberOfActions);
 
@@ -347,7 +347,7 @@ void METWriter::WriteBigEndianShort(sal_uInt16 nWord)
 }
 
 
-void METWriter::WriteBigEndianLong(sal_uLong nLong)
+void METWriter::WriteBigEndianLong(sal_uInt32 nLong)
 {
     WriteBigEndianShort((sal_uInt16)(nLong>>16));
     WriteBigEndianShort((sal_uInt16)(nLong&0x0000ffff));
@@ -374,7 +374,7 @@ void METWriter::WriteFieldIntroducer(sal_uInt16 nFieldSize, sal_uInt16 nFieldTyp
 
 void METWriter::UpdateFieldSize()
 {
-    sal_uLong nPos;
+    sal_uInt32 nPos;
 
     nPos=pMET->Tell();
     pMET->Seek(nActualFieldStartPos);
@@ -383,7 +383,7 @@ void METWriter::UpdateFieldSize()
 }
 
 
-void METWriter::WriteFieldId(sal_uLong nId)
+void METWriter::WriteFieldId(sal_uInt32 nId)
 {
     sal_uInt8 nbyte;
     short i;
@@ -508,7 +508,7 @@ void METWriter::WriteChrSets()
 }
 
 
-void METWriter::WriteColorAttributeTable(sal_uLong nFieldId, BitmapPalette* pPalette, sal_uInt8 nBasePartFlags, sal_uInt8 nBasePartLCTID)
+void METWriter::WriteColorAttributeTable(sal_uInt32 nFieldId, BitmapPalette* pPalette, sal_uInt8 nBasePartFlags, sal_uInt8 nBasePartLCTID)
 {
     sal_uInt16 nIndex,nNumI,i;
 
@@ -565,8 +565,8 @@ void METWriter::WriteImageObject(const Bitmap & rBitmap)
 {
     SvMemoryStream aTemp(0x00010000,0x00010000);
     sal_uInt32 nWidth,nHeight,nResX,nResY;
-    sal_uLong nBytesPerLine,i,j,nNumColors,ny,nLines;
-    sal_uLong nActColMapId;
+    sal_uInt32 nBytesPerLine,i,j,nNumColors,ny,nLines;
+    sal_uInt32 nActColMapId;
     sal_uInt16 nBitsPerPixel;
     sal_uInt8 nbyte;
 
@@ -1132,7 +1132,7 @@ void METWriter::WriteDataDescriptor(const GDIMetaFile *)
 }
 
 
-void METWriter::WillWriteOrder(sal_uLong nNextOrderMaximumLength)
+void METWriter::WillWriteOrder(sal_uInt32 nNextOrderMaximumLength)
 {
     // The parameters of a 'Graphics Data Fields' can be (according to OS2
     // documentation) at most 32759 bytes long. Meant by this is the size
@@ -2339,7 +2339,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
 
 void METWriter::WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF)
 {
-    sal_uLong i, nId;
+    sal_uInt32 i, nId;
 
     //--- The Field 'Begin Object Environment Group':
     WriteFieldIntroducer(16,BegObjEnvMagic,0,0);
@@ -2386,7 +2386,7 @@ void METWriter::WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF)
 
 void METWriter::WriteGraphicsObject(const GDIMetaFile * pMTF)
 {
-    sal_uLong nSegmentSize,nPos,nDataFieldsStartPos;
+    sal_uInt32 nSegmentSize,nPos,nDataFieldsStartPos;
 
     if( bStatus==sal_False )
         return;
commit dfeadd06cead27f5f5af857f8c89c1d953fc0c39
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 18 13:50:00 2014 +0100

    coverity#705538 Unintentional integer overflow
    
    Change-Id: I50f0701bea8f2f2e00a6b1396ba7cfbf5e0bd00c

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 8754a53..e82adf3 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -331,9 +331,9 @@ bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
             SetError( SVSTREAM_READ_ERROR );
         else if ( nPage < nPages )
         {
-            sal_uLong nPos = Page2Pos( nPage );
+            sal_uInt32 nPos = Page2Pos( nPage );
             sal_Int32 nPg2 = ( ( nPage + nPg ) > nPages ) ? nPages - nPage : nPg;
-            sal_uLong nBytes = nPg2 * nPageSize;
+            sal_uInt32 nBytes = nPg2 * nPageSize;
             // fixed address and size for the header
             if( nPage == -1 )
             {
@@ -362,8 +362,8 @@ bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
 {
     if( Good() )
     {
-        sal_uLong nPos = Page2Pos( nPage );
-        sal_uLong nBytes = 0;
+        sal_uInt32 nPos = Page2Pos( nPage );
+        sal_uInt32 nBytes = 0;
         if ( SAL_MAX_INT32 / nPg > nPageSize )
             nBytes = nPg * nPageSize;
 
commit 49b981c6b248e00ae3a6e28dd568920a6149cf75
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 18 13:18:32 2014 +0100

    coverity#705541 Unintentional integer overflow
    
    Change-Id: I6fbafabe98de3b168a8f79c4c2fde4a4537f6eb1

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f6929a3..488d94f 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -943,7 +943,7 @@ WW8PLCFx_PCDAttrs::WW8PLCFx_PCDAttrs(ww::WordVersion eVersion,
 {
 }
 
-sal_uLong WW8PLCFx_PCDAttrs::GetIdx() const
+sal_uInt32 WW8PLCFx_PCDAttrs::GetIdx() const
 {
     return 0;
 }
@@ -1141,7 +1141,7 @@ sal_uLong WW8PLCFx_PCD::GetIMax() const
     return pPcdI ? pPcdI->GetIMax() : 0;
 }
 
-sal_uLong WW8PLCFx_PCD::GetIdx() const
+sal_uInt32 WW8PLCFx_PCD::GetIdx() const
 {
     return pPcdI ? pPcdI->GetIdx() : 0;
 }
@@ -2913,9 +2913,9 @@ WW8PLCFx_Fc_FKP::~WW8PLCFx_Fc_FKP()
     delete pPCDAttrs;
 }
 
-sal_uLong WW8PLCFx_Fc_FKP::GetIdx() const
+sal_uInt32 WW8PLCFx_Fc_FKP::GetIdx() const
 {
-    sal_uLong u = pPLCF->GetIdx() << 8;
+    sal_uInt32 u = pPLCF->GetIdx() << 8;
     if (pFkp)
         u |= pFkp->GetIdx();
     return u;
@@ -3398,7 +3398,7 @@ WW8PLCFx_SEPX::~WW8PLCFx_SEPX()
     delete[] pSprms;
 }
 
-sal_uLong WW8PLCFx_SEPX::GetIdx() const
+sal_uInt32 WW8PLCFx_SEPX::GetIdx() const
 {
     return pPLCF ? pPLCF->GetIdx() : 0;
 }
@@ -3574,7 +3574,7 @@ WW8PLCFx_SubDoc::~WW8PLCFx_SubDoc()
     delete pTxt;
 }
 
-sal_uLong WW8PLCFx_SubDoc::GetIdx() const
+sal_uInt32 WW8PLCFx_SubDoc::GetIdx() const
 {
     // Probably pTxt ... no need for it
     if( pRef )
@@ -3695,7 +3695,7 @@ WW8PLCFx_FLD::~WW8PLCFx_FLD()
     delete pPLCF;
 }
 
-sal_uLong WW8PLCFx_FLD::GetIdx() const
+sal_uInt32 WW8PLCFx_FLD::GetIdx() const
 {
     return pPLCF ? pPLCF->GetIdx() : 0;
 }
@@ -3972,7 +3972,7 @@ WW8PLCFx_Book::~WW8PLCFx_Book()
     delete pBook[0];
 }
 
-sal_uLong WW8PLCFx_Book::GetIdx() const
+sal_uInt32 WW8PLCFx_Book::GetIdx() const
 {
     return nIMax ? pBook[0]->GetIdx() : 0;
 }
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 30e1f24..57dcf19 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -391,7 +391,7 @@ public:
     }
     virtual ~WW8PLCFx() {}
     bool IsSprm() const { return bIsSprm; }
-    virtual sal_uLong GetIdx() const = 0;
+    virtual sal_uInt32 GetIdx() const = 0;
     virtual void SetIdx( sal_uLong nIdx ) = 0;
     virtual sal_uLong GetIdx2() const;
     virtual void SetIdx2( sal_uLong nIdx );
@@ -427,7 +427,7 @@ private:
 public:
     WW8PLCFx_PCDAttrs(ww::WordVersion eVersion, WW8PLCFx_PCD* pPLCFx_PCD,
         const WW8ScannerBase* pBase );
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nI ) SAL_OVERRIDE;
     virtual bool SeekPos(WW8_CP nCpPos) SAL_OVERRIDE;
     virtual WW8_FC Where() SAL_OVERRIDE;
@@ -453,7 +453,7 @@ public:
         WW8_CP nStartCp, bool bVer67P);
     virtual ~WW8PLCFx_PCD();
     virtual sal_uLong GetIMax() const;
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nI ) SAL_OVERRIDE;
     virtual bool SeekPos(WW8_CP nCpPos) SAL_OVERRIDE;
     virtual WW8_FC Where() SAL_OVERRIDE;
@@ -590,7 +590,7 @@ public:
     WW8PLCFx_Fc_FKP( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
         const WW8Fib& rFib, ePLCFT ePl, WW8_FC nStartFcL );
     virtual ~WW8PLCFx_Fc_FKP();
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nIdx ) SAL_OVERRIDE;
     virtual bool SeekPos(WW8_FC nFcPos) SAL_OVERRIDE;
     virtual WW8_FC Where() SAL_OVERRIDE;
@@ -655,7 +655,7 @@ public:
     WW8PLCFx_SEPX( SvStream* pSt, SvStream* pTblxySt, const WW8Fib& rFib,
         WW8_CP nStartCp );
     virtual ~WW8PLCFx_SEPX();
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nIdx ) SAL_OVERRIDE;
     long GetIMax() const { return ( pPLCF ) ? pPLCF->GetIMax() : 0; }
     virtual bool SeekPos(WW8_CP nCpPos) SAL_OVERRIDE;
@@ -685,7 +685,7 @@ public:
     WW8PLCFx_SubDoc(SvStream* pSt, ww::WordVersion eVersion, WW8_CP nStartCp,
     long nFcRef, long nLenRef, long nFcTxt, long nLenTxt, long nStruc = 0);
     virtual ~WW8PLCFx_SubDoc();
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nIdx ) SAL_OVERRIDE;
     virtual bool SeekPos(WW8_CP nCpPos) SAL_OVERRIDE;
     virtual WW8_FC Where() SAL_OVERRIDE;
@@ -716,7 +716,7 @@ private:
 public:
     WW8PLCFx_FLD(SvStream* pSt, const WW8Fib& rMyFib, short nType);
     virtual ~WW8PLCFx_FLD();
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nIdx ) SAL_OVERRIDE;
     virtual bool SeekPos(WW8_CP nCpPos) SAL_OVERRIDE;
     virtual WW8_FC Where() SAL_OVERRIDE;
@@ -748,7 +748,7 @@ public:
     WW8PLCFx_Book(SvStream* pTblSt,const WW8Fib& rFib);
     virtual ~WW8PLCFx_Book();
     long GetIMax() const { return nIMax; }
-    virtual sal_uLong GetIdx() const SAL_OVERRIDE;
+    virtual sal_uInt32 GetIdx() const SAL_OVERRIDE;
     virtual void SetIdx( sal_uLong nI ) SAL_OVERRIDE;
     virtual sal_uLong GetIdx2() const SAL_OVERRIDE;
     virtual void SetIdx2( sal_uLong nIdx ) SAL_OVERRIDE;
commit b1c167b4f5606a46c1bf484628332e8c6eb021fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 18 12:24:31 2014 +0100

    coverity#1078601 Unchecked dynamic_cast
    
    Change-Id: If8e69fa6ec433be7bc8c8f67a6de55537f7201bf

diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index e4c9aed..5699092 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -84,9 +84,9 @@ void SwAccessibleTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *
         case RES_TITLE_CHANGED:
         {
             const OUString& sOldTitle(
-                        dynamic_cast<const SwStringMsgPoolItem*>(pOld)->GetString() );
+                        dynamic_cast<const SwStringMsgPoolItem&>(*pOld).GetString() );
             const OUString& sNewTitle(
-                        dynamic_cast<const SwStringMsgPoolItem*>(pNew)->GetString() );
+                        dynamic_cast<const SwStringMsgPoolItem&>(*pNew).GetString() );
             if ( sOldTitle == sNewTitle )
             {
                 break;


More information about the Libreoffice-commits mailing list