filter/source/graphicfilter/ipcx/ipcx.cxx | 14 +++---- filter/source/graphicfilter/iras/iras.cxx | 31 +++++++---------- sc/source/core/data/column3.cxx | 54 ------------------------------ sc/source/ui/dialogs/searchresults.cxx | 4 +- sc/source/ui/inc/searchresults.hxx | 2 - sw/qa/core/macros-test.cxx | 1 6 files changed, 21 insertions(+), 85 deletions(-)
New commits: commit f9231916051b1760d0051c319945896c84257562 Author: Stephan Bergmann <[email protected]> Date: Tue May 27 11:12:37 2014 +0200 Fix memory leak (as observed with CppunitTest_filter_pcx_test) Change-Id: Ic00653cad7f15f60a8f2613938def25820d7e9ae (cherry picked from commit c77c39056847d23a109172ff53bfac0ba4c21b39) diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 2d941b8..32dc0d9 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -32,7 +32,6 @@ private: SvStream& m_rPCX; // the PCX file to read Bitmap aBmp; - BitmapWriteAccess* pAcc; sal_uInt8 nVersion; // PCX-Version sal_uInt8 nEncoding; // compression type sal_uLong nBitsPerPlanePix; // bits per plane per pixel @@ -48,7 +47,7 @@ private: bool Callback( sal_uInt16 nPercent ); - void ImplReadBody(); + void ImplReadBody(BitmapWriteAccess * pAcc); void ImplReadPalette( sal_uLong nCol ); void ImplReadHeader(); @@ -63,7 +62,6 @@ public: PCXReader::PCXReader(SvStream &rStream) : m_rPCX(rStream) - , pAcc(NULL) , nVersion(0) , nEncoding(0) , nBitsPerPlanePix(0) @@ -112,7 +110,8 @@ bool PCXReader::ReadPCX(Graphic & rGraphic) if ( nStatus ) { aBmp = Bitmap( Size( nWidth, nHeight ), nDestBitsPerPixel ); - if ( ( pAcc = aBmp.AcquireWriteAccess() ) == 0 ) + Bitmap::ScopedWriteAccess pAcc(aBmp); + if ( pAcc == 0 ) return false; if ( nDestBitsPerPixel <= 8 ) @@ -126,7 +125,7 @@ bool PCXReader::ReadPCX(Graphic & rGraphic) } } // read bitmap data - ImplReadBody(); + ImplReadBody(pAcc.get()); // If an extended color palette exists at the end of the file, then read it and // and write again in palette: @@ -148,9 +147,8 @@ bool PCXReader::ReadPCX(Graphic & rGraphic) rBitmap.SetPrefMapMode(aMapMode); rBitmap.SetPrefSize(Size(nWidth,nHeight)); } - */ if ( nStatus && pAcc ) + */ if ( nStatus ) { - aBmp.ReleaseAccess( pAcc ), pAcc = NULL; rGraphic = aBmp; return true; } @@ -217,7 +215,7 @@ void PCXReader::ImplReadHeader() } } -void PCXReader::ImplReadBody() +void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) { sal_uInt8 *pPlane[ 4 ], * pDest, * pSource1, * pSource2, * pSource3, *pSource4; sal_uLong i, nx, ny, np, nCount, nPercent; commit c63dbc56f01cd0fc4e0fa3d6daf536e0dfb3c70b Author: Stephan Bergmann <[email protected]> Date: Tue May 27 10:30:05 2014 +0200 Fix memory leak (as observed with CppunitTest_filter_ras_test) (cherry picked from commit ba00f596cfbb78046e705f1d45264951bf03a9a1) Change-Id: Id3fa526f01ab7dae72beb311fe0774ba1f77d8a0 diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx index 9f71ab7..c58bd46 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -44,7 +44,6 @@ private: bool mbStatus; Bitmap maBmp; - BitmapWriteAccess* mpAcc; sal_uInt32 mnWidth, mnHeight; // Bildausmass in Pixeln sal_uInt16 mnDstBitsPerPix; sal_uInt16 mnDstColors; @@ -53,7 +52,7 @@ private: sal_uInt8 mnRepCount, mnRepVal; // RLE Decoding bool mbPalette; - bool ImplReadBody(); + bool ImplReadBody(BitmapWriteAccess * pAcc); bool ImplReadHeader(); sal_uInt8 ImplGetByte(); @@ -68,7 +67,6 @@ public: RASReader::RASReader(SvStream &rRAS) : m_rRAS(rRAS) , mbStatus(true) - , mpAcc(NULL) , mnWidth(0) , mnHeight(0) , mnDstBitsPerPix(0) @@ -108,7 +106,8 @@ bool RASReader::ReadRAS(Graphic & rGraphic) return false; maBmp = Bitmap( Size( mnWidth, mnHeight ), mnDstBitsPerPix ); - if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 ) + Bitmap::ScopedWriteAccess pAcc(maBmp); + if ( pAcc == 0 ) return false; if ( mnDstBitsPerPix <= 8 ) // paletten bildchen @@ -127,7 +126,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) if ( ( mnDstColors >= 2 ) && ( ( mnColorMapSize % 3 ) == 0 ) ) { - mpAcc->SetPaletteEntryCount( mnDstColors ); + pAcc->SetPaletteEntryCount( mnDstColors ); sal_uInt16 i; sal_uInt8 nRed[256], nGreen[256], nBlue[256]; for ( i = 0; i < mnDstColors; i++ ) m_rRAS.ReadUChar( nRed[ i ] ); @@ -135,7 +134,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) for ( i = 0; i < mnDstColors; i++ ) m_rRAS.ReadUChar( nBlue[ i ] ); for ( i = 0; i < mnDstColors; i++ ) { - mpAcc->SetPaletteColor( i, BitmapColor( nRed[ i ], nGreen[ i ], nBlue[ i ] ) ); + pAcc->SetPaletteColor( i, BitmapColor( nRed[ i ], nGreen[ i ], nBlue[ i ] ) ); } mbPalette = true; } @@ -149,11 +148,11 @@ bool RASReader::ReadRAS(Graphic & rGraphic) if ( !mbPalette ) { mnDstColors = 1 << mnDstBitsPerPix; - mpAcc->SetPaletteEntryCount( mnDstColors ); + pAcc->SetPaletteEntryCount( mnDstColors ); for ( sal_uInt16 i = 0; i < mnDstColors; i++ ) { sal_uLong nCount = 255 - ( 255 * i / ( mnDstColors - 1 ) ); - mpAcc->SetPaletteColor( i, BitmapColor( (sal_uInt8)nCount, (sal_uInt8)nCount, (sal_uInt8)nCount ) ); + pAcc->SetPaletteColor( i, BitmapColor( (sal_uInt8)nCount, (sal_uInt8)nCount, (sal_uInt8)nCount ) ); } } } @@ -167,12 +166,8 @@ bool RASReader::ReadRAS(Graphic & rGraphic) } // Bitmap-Daten einlesen - mbStatus = ImplReadBody(); + mbStatus = ImplReadBody(pAcc.get()); - if ( mpAcc ) - { - maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL; - } if ( mbStatus ) rGraphic = maBmp; @@ -219,7 +214,7 @@ bool RASReader::ImplReadHeader() -bool RASReader::ImplReadBody() +bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc) { sal_uLong x, y; sal_uInt8 nDat = 0; @@ -233,7 +228,7 @@ bool RASReader::ImplReadBody() { if (!(x & 7)) nDat = ImplGetByte(); - mpAcc->SetPixelIndex( y, x, + pAcc->SetPixelIndex( y, x, sal::static_int_cast< sal_uInt8 >( nDat >> ( ( x & 7 ) ^ 7 )) ); } @@ -247,7 +242,7 @@ bool RASReader::ImplReadBody() for ( x = 0; x < mnWidth; x++ ) { nDat = ImplGetByte(); - mpAcc->SetPixelIndex( y, x, nDat ); + pAcc->SetPixelIndex( y, x, nDat ); } if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ??? } @@ -274,7 +269,7 @@ bool RASReader::ImplReadBody() nGreen = ImplGetByte(); nRed = ImplGetByte(); } - mpAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); + pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); } if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ??? } @@ -298,7 +293,7 @@ bool RASReader::ImplReadBody() nGreen = ImplGetByte(); nRed = ImplGetByte(); } - mpAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); + pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); } } break; commit e665a1b5212b529673d6e9dec3e29e6dae0f0fe8 Author: Tor Lillqvist <[email protected]> Date: Thu May 22 16:12:09 2014 +0300 WaE: unused variable 'aFileNameBase' Change-Id: I26cf27c7edc51d0a28e228c56465c3ec2ad7d35e (cherry picked from commit 73f65ac3ef713cc53c53da301785e35b36528504) diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index faa97c5..7a7d804 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -195,7 +195,6 @@ void SwMacrosTest::testFdo55289() void SwMacrosTest::testFdo68983() { - const OUString aFileNameBase("StarBasic."); OUString aFileName; createFileURL("fdo68983.", "odt", aFileName); Reference< com::sun::star::lang::XComponent > xComponent = commit bef07997d040e3fbc08482b368c6d8257ad4b6b7 Author: Tor Lillqvist <[email protected]> Date: Fri May 23 18:32:33 2014 +0300 WaE: private field 'mnId' is not used Change-Id: I406ebb303b1f36f827c3cbf33f8f4cf3dcaed2f1 (cherry picked from commit 8640859d6898943506f28be46c7778a677893ca8) diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index 73955c8..26471ba 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -21,9 +21,9 @@ namespace sc { -SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, Window* pParent, sal_uInt16 nId ) : +SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, Window* pParent, sal_uInt16 /* nId */ ) : ModelessDialog(pParent, "SearchResultsDialog", "modules/scalc/ui/searchresults.ui"), - mpBindings(_pBindings), mnId(nId), mpDoc(NULL) + mpBindings(_pBindings), mpDoc(NULL) { SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("results"); Size aControlSize(150, 120); diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx index efb35f8..0d6d435 100644 --- a/sc/source/ui/inc/searchresults.hxx +++ b/sc/source/ui/inc/searchresults.hxx @@ -23,8 +23,6 @@ class SearchResultsDlg : public ModelessDialog { SvSimpleTable *mpList; SfxBindings* mpBindings; - sal_uInt16 mnId; - ScDocument* mpDoc; DECL_LINK( ListSelectHdl, void * ); commit ad400f094e3ca18390dc6b3d5f0e1235b66a8c70 Author: Stephan Bergmann <[email protected]> Date: Fri May 23 09:23:21 2014 +0200 Remove dead code Change-Id: I198fb0193fed891c4dd8a8a92c29e36f6c4d48b9 (cherry picked from commit a8df8e319fa6b328534855a17e6fcac8aeb4dc25) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 2d54fd5..d023b16 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -140,41 +140,6 @@ void ScColumn::FreeAll() namespace { -/** - * Collect all formula cells for later mass-unregistration. Also tag row - * positions of all non-empty cells in the range. - */ -class DeleteRowsHandler -{ - ScDocument& mrDoc; - std::vector<SCROW> maRows; - std::vector<ScFormulaCell*> maFormulaCells; -public: - DeleteRowsHandler(ScDocument& rDoc) : mrDoc(rDoc) {} - - void operator() (size_t nRow, ScFormulaCell* pCell) - { - maFormulaCells.push_back(pCell); - maRows.push_back(nRow); - } - - void operator() (mdds::mtv::element_t nType, size_t nTopRow, size_t nDataSize) - { - if (nType == sc::element_type_empty) - // Ignore empty cells. - return; - - for (size_t i = 0; i < nDataSize; ++i) - // Tag all non-empty cells. - maRows.push_back(i + nTopRow); - } - - const std::vector<SCROW>& getNonEmptyRows() const - { - return maRows; - } -}; - class ShiftFormulaPosHandler { public: @@ -185,25 +150,6 @@ public: } }; -class RangeBroadcaster -{ - ScDocument& mrDoc; - ScHint maHint; -public: - RangeBroadcaster(ScDocument& rDoc, SCTAB nTab, SCCOL nCol) : - mrDoc(rDoc), - maHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab)) {} - - void operator() (const sc::RowSpan& rSpan) - { - SCROW nRow1 = rSpan.mnRow1, nRow2 = rSpan.mnRow2; - maHint.GetAddress().SetRow(nRow1); - ScRange aRange(maHint.GetAddress()); - aRange.aEnd.SetRow(nRow2); - mrDoc.AreaBroadcastInRange(aRange, maHint); - } -}; - } void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize ) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
