diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
commit | 5595ee701eab0fef0683c93e3c99788ab1b08520 (patch) | |
tree | f65921d6b5b0c8c988fa37eb4dc57e2879d25bf2 /avmedia | |
parent | 19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d (diff) |
loplugin:useuniqueptr
Change-Id: I3a246a22baaac8195dc1b94c42994de7d80e8336
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/win/framegrabber.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx index 3d1f5906e2fc..ce24b96f7ad2 100644 --- a/avmedia/source/win/framegrabber.cxx +++ b/avmedia/source/win/framegrabber.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <memory> + #if defined _MSC_VER #pragma warning(push, 1) #pragma warning(disable: 4917) @@ -170,13 +174,13 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, nullptr, nWidth, nHeight ) ) && ( nSize > 0 ) ) { - char* pBuffer = new char[ nSize ]; + auto pBuffer = std::unique_ptr<char[]>(new char[ nSize ]); try { - if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, nullptr, pBuffer, nWidth, nHeight ) ) ) + if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, nullptr, pBuffer.get(), nWidth, nHeight ) ) ) { - SvMemoryStream aMemStm( pBuffer, nSize, StreamMode::READ | StreamMode::WRITE ); + SvMemoryStream aMemStm( pBuffer.get(), nSize, StreamMode::READ | StreamMode::WRITE ); Bitmap aBmp; if( ReadDIB(aBmp, aMemStm, false ) && !aBmp.IsEmpty() ) @@ -189,8 +193,6 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe catch( ... ) { } - - delete [] pBuffer; } } |