[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Jul 13 09:01:21 UTC 2018


 sc/source/ui/dbgui/scuiasciiopt.cxx |    6 +++---
 sc/source/ui/inc/scuiasciiopt.hxx   |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a5c04cbf2309ddb1d3ee80f2f2674df38b52df80
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jul 12 16:33:23 2018 +0200

    loplugin:useuniqueptr in ScImportAsciiDlg
    
    Change-Id: Ie73f89401a9e99f0cb11949cae3ebdde793b14bb
    Reviewed-on: https://gerrit.libreoffice.org/57359
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index aeb718be4d08..db98865ca7f0 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -531,7 +531,7 @@ ScImportAsciiDlg::~ScImportAsciiDlg()
 
 void ScImportAsciiDlg::dispose()
 {
-    delete[] mpRowPosArray;
+    mpRowPosArray.reset();
     pFtCharSet.clear();
     pLbCharSet.clear();
     pFtCustomLang.clear();
@@ -568,11 +568,11 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText, sal_Unicode& r
     bool bFixed = pRbFixed->IsChecked();
 
     if (!mpRowPosArray)
-        mpRowPosArray = new sal_uLong[ASCIIDLG_MAXROWS + 2];
+        mpRowPosArray.reset( new sal_uLong[ASCIIDLG_MAXROWS + 2] );
 
     if (!mnRowPosCount) // complete re-fresh
     {
-        memset( mpRowPosArray, 0, sizeof(mpRowPosArray[0]) * (ASCIIDLG_MAXROWS+2));
+        memset( mpRowPosArray.get(), 0, sizeof(mpRowPosArray[0]) * (ASCIIDLG_MAXROWS+2));
 
         Seek(0);
         mpDatStream->StartReadingUnicodeText( mpDatStream->GetStreamCharSet() );
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx
index c65fb81c3cec..49fa4b1b69b3 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -41,7 +41,7 @@ class ScImportAsciiDlg : public ModalDialog
 {
     SvStream*                   mpDatStream;
     sal_uLong                       mnStreamPos;
-    sal_uLong*                      mpRowPosArray;
+    std::unique_ptr<sal_uLong[]>    mpRowPosArray;
     sal_uLong                       mnRowPosCount;
 
     OUString               maPreviewLine[ CSV_PREVIEW_LINES ];


More information about the Libreoffice-commits mailing list