connectivity/source/parse/sqlnode.cxx |   63 ++++++++++---------
 editeng/source/misc/svxacorr.cxx      |  109 +++++++++++++---------------------
 include/connectivity/sqlnode.hxx      |   21 ++----
 include/editeng/svxacorr.hxx          |   11 +--
 4 files changed, 90 insertions(+), 114 deletions(-)

New commits:
commit 90db24c33060bcb6db6ef900981c4379cd3074af
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Tue Jan 30 09:43:15 2018 +0200

    loplugin:useuniqueptr in SvxAutoCorrectLanguageLists
    
    and cleanup horrendous weirdity in the interaction between LoadXXX and
    SetXXX methods
    
    Change-Id: I1253579a27e835f6f79c39acf72eac85278275d6
    Reviewed-on: https://gerrit.libreoffice.org/49184
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 38906abae6d7..46c22fc84c49 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1920,9 +1920,6 @@ SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists(
 
 SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists()
 {
-    delete pCplStt_ExcptLst;
-    delete pWrdStt_ExcptLst;
-    delete pAutocorr_List;
 }
 
 bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
@@ -1944,18 +1941,15 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
             // then remove all the lists fast!
             if( CplSttLstLoad & nFlags && pCplStt_ExcptLst )
             {
-                delete pCplStt_ExcptLst;
-                pCplStt_ExcptLst = nullptr;
+                pCplStt_ExcptLst.reset();
             }
             if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst )
             {
-                delete pWrdStt_ExcptLst;
-                pWrdStt_ExcptLst = nullptr;
+                pWrdStt_ExcptLst.reset();
             }
             if( ChgWordLstLoad & nFlags && pAutocorr_List )
             {
-                delete pAutocorr_List;
-                pAutocorr_List = nullptr;
+                pAutocorr_List.reset();
             }
             nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
         }
@@ -1965,14 +1959,14 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
 }
 
 void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
-                                        SvStringsISortDtor*& rpLst,
+                                        std::unique_ptr<SvStringsISortDtor>& 
rpLst,
                                         const sal_Char* pStrmName,
                                         tools::SvRef<SotStorage>& rStg)
 {
     if( rpLst )
         rpLst->clear();
     else
-        rpLst = new SvStringsISortDtor;
+        rpLst.reset( new SvStringsISortDtor );
 
     {
         const OUString sStrmName( pStrmName, strlen(pStrmName), 
RTL_TEXTENCODING_MS_1252 );
@@ -2098,7 +2092,7 @@ SvxAutocorrWordList* 
SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
     if( pAutocorr_List )
         pAutocorr_List->DeleteAndDestroyAll();
     else
-        pAutocorr_List = new SvxAutocorrWordList();
+        pAutocorr_List.reset( new SvxAutocorrWordList() );
 
     try
     {
@@ -2113,7 +2107,7 @@ SvxAutocorrWordList* 
SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
         // get parser
         uno::Reference< xml::sax::XFastParser > xParser = 
xml::sax::FastParser::create(xContext);
         SAL_INFO("editeng", "AutoCorrect Import" );
-        uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new 
SvXMLAutoCorrectImport( xContext, pAutocorr_List, rAutoCorrect, xStg );
+        uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new 
SvXMLAutoCorrectImport( xContext, pAutocorr_List.get(), rAutoCorrect, xStg );
         uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = 
static_cast< xml::sax::XFastTokenHandler* >( new SvXMLAutoCorrectTokenHandler );
 
         // connect parser and filter
@@ -2133,34 +2127,37 @@ SvxAutocorrWordList* 
SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
                                     &aModifiedDate, &aModifiedTime );
     aLastCheckTime = tools::Time( tools::Time::SYSTEM );
 
-    return pAutocorr_List;
-}
-
-void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* 
pList )
-{
-    if( pAutocorr_List && pList != pAutocorr_List )
-        delete pAutocorr_List;
-    pAutocorr_List = pList;
-    if( !pAutocorr_List )
-    {
-        OSL_ENSURE( false, "No valid list" );
-        pAutocorr_List = new SvxAutocorrWordList();
-    }
-    nFlags |= ChgWordLstLoad;
+    return pAutocorr_List.get();
 }
 
 const SvxAutocorrWordList* SvxAutoCorrectLanguageLists::GetAutocorrWordList()
 {
     if( !( ChgWordLstLoad & nFlags ) || IsFileChanged_Imp() )
-        SetAutocorrWordList( LoadAutocorrWordList() );
-    return pAutocorr_List;
+    {
+        LoadAutocorrWordList();
+        if( !pAutocorr_List )
+        {
+            OSL_ENSURE( false, "No valid list" );
+            pAutocorr_List.reset( new SvxAutocorrWordList() );
+        }
+        nFlags |= ChgWordLstLoad;
+    }
+    return pAutocorr_List.get();
 }
 
 SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetCplSttExceptList()
 {
     if( !( CplSttLstLoad & nFlags ) || IsFileChanged_Imp() )
-        SetCplSttExceptList( LoadCplSttExceptList() );
-    return pCplStt_ExcptLst;
+    {
+        LoadCplSttExceptList();
+        if( !pCplStt_ExcptLst )
+        {
+            OSL_ENSURE( false, "No valid list" );
+            pCplStt_ExcptLst.reset( new SvStringsISortDtor );
+        }
+        nFlags |= CplSttLstLoad;
+    }
+    return pCplStt_ExcptLst.get();
 }
 
 bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const OUString& rNew)
@@ -2216,7 +2213,7 @@ SvStringsISortDtor* 
SvxAutoCorrectLanguageLists::LoadCplSttExceptList()
     catch (const css::ucb::ContentCreationException&)
     {
     }
-    return pCplStt_ExcptLst;
+    return pCplStt_ExcptLst.get();
 }
 
 void SvxAutoCorrectLanguageLists::SaveCplSttExceptList()
@@ -2234,20 +2231,6 @@ void SvxAutoCorrectLanguageLists::SaveCplSttExceptList()
     aLastCheckTime = tools::Time( tools::Time::SYSTEM );
 }
 
-void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* 
pList )
-{
-    if( pCplStt_ExcptLst && pList != pCplStt_ExcptLst )
-        delete pCplStt_ExcptLst;
-
-    pCplStt_ExcptLst = pList;
-    if( !pCplStt_ExcptLst )
-    {
-        OSL_ENSURE( false, "No valid list" );
-        pCplStt_ExcptLst = new SvStringsISortDtor;
-    }
-    nFlags |= CplSttLstLoad;
-}
-
 SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
 {
     try
@@ -2261,7 +2244,7 @@ SvStringsISortDtor* 
SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
     {
         SAL_WARN("editeng", 
"SvxAutoCorrectLanguageLists::LoadWrdSttExceptList: Caught " << e);
     }
-    return pWrdStt_ExcptLst;
+    return pWrdStt_ExcptLst.get();
 }
 
 void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList()
@@ -2278,24 +2261,19 @@ void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList()
     aLastCheckTime = tools::Time( tools::Time::SYSTEM );
 }
 
-void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* 
pList )
-{
-    if( pWrdStt_ExcptLst && pList != pWrdStt_ExcptLst )
-        delete pWrdStt_ExcptLst;
-    pWrdStt_ExcptLst = pList;
-    if( !pWrdStt_ExcptLst )
-    {
-        OSL_ENSURE( false, "No valid list" );
-        pWrdStt_ExcptLst = new SvStringsISortDtor;
-    }
-    nFlags |= WrdSttLstLoad;
-}
-
 SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetWrdSttExceptList()
 {
     if( !( WrdSttLstLoad & nFlags ) || IsFileChanged_Imp() )
-        SetWrdSttExceptList( LoadWrdSttExceptList() );
-    return pWrdStt_ExcptLst;
+    {
+        LoadWrdSttExceptList();
+        if( !pWrdStt_ExcptLst )
+        {
+            OSL_ENSURE( false, "No valid list" );
+            pWrdStt_ExcptLst.reset( new SvStringsISortDtor );
+        }
+        nFlags |= WrdSttLstLoad;
+    }
+    return pWrdStt_ExcptLst.get();
 }
 
 void SvxAutoCorrectLanguageLists::RemoveStream_Imp( const OUString& rName )
@@ -2371,7 +2349,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
         {
             OUString sXMLWord     ( pXMLImplWrdStt_ExcptLstStr );
             OUString sXMLSentence ( pXMLImplCplStt_ExcptLstStr );
-            SvStringsISortDtor  *pTmpWordList = nullptr;
+            std::unique_ptr<SvStringsISortDtor> pTmpWordList;
 
             if (xSrcStg->IsContained( sXMLWord ) )
                 LoadXMLExceptList_Imp( pTmpWordList, 
pXMLImplWrdStt_ExcptLstStr, xSrcStg );
@@ -2379,8 +2357,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
             if (pTmpWordList)
             {
                 SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, 
xDstStg, true );
-                pTmpWordList->clear();
-                pTmpWordList = nullptr;
+                pTmpWordList.reset();
             }
 
 
@@ -2432,7 +2409,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( 
SotStorage& rStg )
             xWriter->setOutputStream(xOut);
 
             uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, 
uno::UNO_QUERY);
-            rtl::Reference< SvXMLAutoCorrectExport > xExp( new 
SvXMLAutoCorrectExport( xContext, pAutocorr_List, pXMLImplAutocorr_ListStr, 
xHandler ) );
+            rtl::Reference< SvXMLAutoCorrectExport > xExp( new 
SvXMLAutoCorrectExport( xContext, pAutocorr_List.get(), 
pXMLImplAutocorr_ListStr, xHandler ) );
 
             xExp->exportDoc( XML_BLOCK_LIST );
 
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 86d3ea3d9154..d54b6670762f 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -165,15 +165,15 @@ class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
     Date aModifiedDate;
     tools::Time aModifiedTime, aLastCheckTime;
 
-    SvStringsISortDtor*     pCplStt_ExcptLst;
-    SvStringsISortDtor*     pWrdStt_ExcptLst;
-    SvxAutocorrWordList*    pAutocorr_List;
+    std::unique_ptr<SvStringsISortDtor> pCplStt_ExcptLst;
+    std::unique_ptr<SvStringsISortDtor> pWrdStt_ExcptLst;
+    std::unique_ptr<SvxAutocorrWordList> pAutocorr_List;
     SvxAutoCorrect&         rAutoCorrect;
 
     long nFlags;
 
     bool IsFileChanged_Imp();
-    void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst,
+    void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst,
                                 const sal_Char* pStrmName,
                                 tools::SvRef<SotStorage>& rStg);
     static void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
@@ -193,14 +193,12 @@ public:
 
     // Load, Set, Get - the replacement list
     SvxAutocorrWordList* LoadAutocorrWordList();
-    void SetAutocorrWordList( SvxAutocorrWordList* pList );
     const SvxAutocorrWordList* GetAutocorrWordList();
 
     // Load, Set, Get - the exception list for Capital letter at the
     // beginning of a sentence
     SvStringsISortDtor* LoadCplSttExceptList();
     void SaveCplSttExceptList();
-    void SetCplSttExceptList( SvStringsISortDtor* pList );
     SvStringsISortDtor* GetCplSttExceptList();
     bool AddToCplSttExceptList(const OUString& rNew);
 
@@ -208,7 +206,6 @@ public:
     // beginning of a word.
     SvStringsISortDtor* LoadWrdSttExceptList();
     void SaveWrdSttExceptList();
-    void SetWrdSttExceptList( SvStringsISortDtor* pList );
     SvStringsISortDtor* GetWrdSttExceptList();
     bool AddToWrdSttExceptList(const OUString& rNew);
 
commit 7dcf9db73b48c396332ea0d17572c5103018b8e0
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Tue Jan 30 08:28:47 2018 +0200

    loplugin:useuniqueptr in OSQLParseNode
    
    Change-Id: Ibad6e4b32b19a925de621b9dea7070d3930f05ef
    Reviewed-on: https://gerrit.libreoffice.org/49182
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/source/parse/sqlnode.cxx 
b/connectivity/source/parse/sqlnode.cxx
index 1a0d3e70a6b0..3ca3c90131ad 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -477,7 +477,7 @@ void 
OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
             OUStringBuffer aStringPara;
             for (sal_uInt32 i=1; i<nCount; i++)
             {
-                const OSQLParseNode * pSubTree = m_aChildren[i];
+                const OSQLParseNode * pSubTree = m_aChildren[i].get();
                 if (pSubTree)
                 {
                     pSubTree->impl_parseNodeToString_throw( aStringPara, 
aNewParam, false );
@@ -508,10 +508,9 @@ void 
OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
 
     if ( !bHandled )
     {
-        for (OSQLParseNodes::const_iterator i = m_aChildren.begin();
-            i != m_aChildren.end();)
+        for (auto i = m_aChildren.begin(); i != m_aChildren.end();)
         {
-            const OSQLParseNode* pSubTree = *i;
+            const OSQLParseNode* pSubTree = i->get();
             if ( !pSubTree )
             {
                 ++i;
@@ -547,7 +546,7 @@ void 
OSQLParseNode::impl_parseNodeToString_throw(OUStringBuffer& rString, const
                     {
                         if(i != m_aChildren.end())
                         {
-                            pSubTree = *i;
+                            pSubTree = i->get();
                             if (pSubTree && pSubTree->getNodeType() == 
SQLNodeType::Equal)
                                 ++i;
                         }
@@ -714,7 +713,7 @@ void 
OSQLParseNode::impl_parseTableRangeNodeToString_throw(OUStringBuffer& rStri
 
     // rString += " ";
     std::for_each(m_aChildren.begin(),m_aChildren.end(),
-        [&] (OSQLParseNode *const pNode) { 
pNode->impl_parseNodeToString_throw(rString, rParam, false); });
+        [&] (std::unique_ptr<OSQLParseNode> const & pNode) { 
pNode->impl_parseNodeToString_throw(rString, rParam, false); });
 }
 
 
@@ -729,10 +728,10 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( 
OUStringBuffer& rString, c
     SQLParseNodeParameter aNewParam(rParam);
     //aNewParam.bQuote = sal_True; // why setting this to true? @see 
http://www.openoffice.org/issues/show_bug.cgi?id=75557
 
-    if ( !(bSimple && rParam.bPredicate && rParam.xField.is() && 
SQL_ISRULE(m_aChildren[0],column_ref) && columnMatchP(m_aChildren[0], rParam)) )
+    if ( !(bSimple && rParam.bPredicate && rParam.xField.is() && 
SQL_ISRULE(m_aChildren[0],column_ref) && columnMatchP(m_aChildren[0].get(), 
rParam)) )
         m_aChildren[0]->impl_parseNodeToString_throw( rString, aNewParam, 
bSimple );
 
-    const OSQLParseNode* pPart2 = m_aChildren[1];
+    const OSQLParseNode* pPart2 = m_aChildren[1].get();
     pPart2->getChild(0)->impl_parseNodeToString_throw( rString, aNewParam, 
false );
     pPart2->getChild(1)->impl_parseNodeToString_throw( rString, aNewParam, 
false );
     pParaNode = pPart2->getChild(2);
@@ -1639,9 +1638,6 @@ OSQLParseNode& OSQLParseNode::operator=(const 
OSQLParseNode& rParseNode)
         m_eNodeType  = rParseNode.m_eNodeType;
         m_nNodeID    = rParseNode.m_nNodeID;
 
-        for (auto const& child : m_aChildren)
-            delete child;
-
         m_aChildren.clear();
 
         for (auto const& child : rParseNode.m_aChildren)
@@ -1672,9 +1668,6 @@ bool OSQLParseNode::operator==(OSQLParseNode const & 
rParseNode) const
 
 OSQLParseNode::~OSQLParseNode()
 {
-    for (auto const& child : m_aChildren)
-        delete child;
-    m_aChildren.clear();
 }
 
 
@@ -1682,13 +1675,15 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode)
 {
     OSL_ENSURE(pNewNode != nullptr, "OSQLParseNode: invalid NewSubTree");
     OSL_ENSURE(pNewNode->getParent() == nullptr, "OSQLParseNode: Node is not 
an orphan");
-    OSL_ENSURE(std::find(m_aChildren.begin(), m_aChildren.end(), pNewNode) == 
m_aChildren.end(),
-            "OSQLParseNode::append() Node already element of parent");
+    OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(),
+                   [&] (std::unique_ptr<OSQLParseNode> const & r) { return 
r.get() == pNewNode; })
+               == m_aChildren.end(),
+               "OSQLParseNode::append() Node already element of parent");
 
     // Create connection to getParent
     pNewNode->setParent( this );
     // and attach the SubTree at the end
-    m_aChildren.push_back(pNewNode);
+    m_aChildren.emplace_back(pNewNode);
 }
 
 bool OSQLParseNode::addDateValue(OUStringBuffer& rString, const 
SQLParseNodeParameter& rParam) const
@@ -1696,8 +1691,8 @@ bool OSQLParseNode::addDateValue(OUStringBuffer& rString, 
const SQLParseNodePara
     // special display for date/time values
     if (SQL_ISRULE(this,set_fct_spec) && SQL_ISPUNCTUATION(m_aChildren[0],"{"))
     {
-        const OSQLParseNode* pODBCNode = m_aChildren[1];
-        const OSQLParseNode* pODBCNodeChild = pODBCNode->m_aChildren[0];
+        const OSQLParseNode* pODBCNode = m_aChildren[1].get();
+        const OSQLParseNode* pODBCNodeChild = pODBCNode->m_aChildren[0].get();
 
         if (pODBCNodeChild->getNodeType() == SQLNodeType::Keyword && (
             SQL_ISTOKEN(pODBCNodeChild, D) ||
@@ -2360,7 +2355,7 @@ void OSQLParseNode::insert(sal_uInt32 nPos, 
OSQLParseNode* pNewSubTree)
 
     // Create connection to getParent
     pNewSubTree->setParent( this );
-    m_aChildren.insert(m_aChildren.begin() + nPos, pNewSubTree);
+    m_aChildren.emplace(m_aChildren.begin() + nPos, pNewSubTree);
 }
 
 // removeAt methods
@@ -2368,30 +2363,40 @@ void OSQLParseNode::insert(sal_uInt32 nPos, 
OSQLParseNode* pNewSubTree)
 OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos)
 {
     OSL_ENSURE(nPos < m_aChildren.size(),"Illegal position for removeAt");
-    OSQLParseNodes::iterator aPos(m_aChildren.begin() + nPos);
-    OSQLParseNode* pNode = *aPos;
+    auto aPos(m_aChildren.begin() + nPos);
+    auto pNode = std::move(*aPos);
 
     // Set the getParent of the removed node to NULL
     pNode->setParent( nullptr );
 
     m_aChildren.erase(aPos);
-    return pNode;
+    return pNode.release();
 }
 
 // Replace methods
 
-OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, 
OSQLParseNode* pNewSubNode )
+OSQLParseNode* OSQLParseNode::replace(OSQLParseNode* pOldSubNode, 
OSQLParseNode* pNewSubNode )
 {
     OSL_ENSURE(pOldSubNode != nullptr && pNewSubNode != nullptr, 
"OSQLParseNode: invalid nodes");
     OSL_ENSURE(pNewSubNode->getParent() == nullptr, "OSQLParseNode: node 
already has getParent");
-    OSL_ENSURE(std::find(m_aChildren.begin(), m_aChildren.end(), pOldSubNode) 
!= m_aChildren.end(),
-            "OSQLParseNode::Replace() Node not element of parent");
-    OSL_ENSURE(std::find(m_aChildren.begin(), m_aChildren.end(), pNewSubNode) 
== m_aChildren.end(),
-            "OSQLParseNode::Replace() Node already element of parent");
+    OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(),
+                   [&] (std::unique_ptr<OSQLParseNode> const & r) { return 
r.get() == pOldSubNode; })
+                != m_aChildren.end(),
+               "OSQLParseNode::Replace() Node not element of parent");
+    OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(),
+                   [&] (std::unique_ptr<OSQLParseNode> const & r) { return 
r.get() == pNewSubNode; })
+                == m_aChildren.end(),
+               "OSQLParseNode::Replace() Node already element of parent");
 
     pOldSubNode->setParent( nullptr );
     pNewSubNode->setParent( this );
-    std::replace(m_aChildren.begin(), m_aChildren.end(), pOldSubNode, 
pNewSubNode);
+    for (auto it = m_aChildren.begin(); it != m_aChildren.end(); ++it)
+        if (it->get() == pOldSubNode)
+        {
+            it->release();
+            it->reset(pNewSubNode);
+            break;
+        }
     return pOldSubNode;
 }
 
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
index 20c821957eab..e2198499baed 100644
--- a/include/connectivity/sqlnode.hxx
+++ b/include/connectivity/sqlnode.hxx
@@ -63,8 +63,6 @@ namespace connectivity
     class OSQLParseNode;
     class IParseContext;
 
-    typedef ::std::vector< OSQLParseNode* >                  OSQLParseNodes;
-
     enum class SQLNodeType { Rule, ListRule, CommaListRule,
                          Keyword, Name,
                          String, IntNum, ApproxNum,
@@ -114,14 +112,15 @@ namespace connectivity
     {
         friend class OSQLParser;
 
-        OSQLParseNodes                  m_aChildren;
-        OSQLParseNode*                  m_pParent;      // pParent for reverse 
linkage in the tree
+        std::vector< std::unique_ptr<OSQLParseNode> >
+                                 m_aChildren;
+        OSQLParseNode*           m_pParent;      // pParent for reverse 
linkage in the tree
         OUString                 m_aNodeValue;   // token name, or empty in 
case of rules,
-                                                        // or OUString in case 
of
-                                                        // OUString, INT, etc.
-        SQLNodeType                     m_eNodeType;    // see above
-        sal_uInt32                      m_nNodeID;      // Rule ID (if 
IsRule())
-                                                        // or Token ID (if 
!IsRule())
+                                                 // or OUString in case of
+                                                 // OUString, INT, etc.
+        SQLNodeType              m_eNodeType;    // see above
+        sal_uInt32               m_nNodeID;      // Rule ID (if IsRule())
+                                                 // or Token ID (if !IsRule())
                                             // Rule IDs and Token IDs can't
                                             // be distinguished by their 
values,
                                             // IsRule has to be used for that!
@@ -441,9 +440,7 @@ namespace connectivity
 
     inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const
     {
-        assert(nPos < m_aChildren.size());
-
-        return m_aChildren[nPos];
+        return m_aChildren[nPos].get();
     }
 
     // utilities to query for a specific rule, token or punctuation
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to