tdf#75280 Convert some sal_uIntPtr in ucb to more appropriate types

Change-Id: Icb4ae99fd49a4b080ad8f3df6f15dddcdcb09e42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110491
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index a75da8a..437919e 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -281,7 +281,7 @@
    catch (const UnknownPropertyException&) {}
    catch (const WrappedTargetException&) {}

    sal_IntPtr nOldCount = pCurSet->GetCount();
    sal_Int32 nOldCount = pCurSet->GetCount();
    bool bWasFinal = false;

    aRet >>= bWasFinal;
@@ -459,7 +459,7 @@
    maData.clear();
}

void EventList::AddEvent( sal_IntPtr nType, sal_IntPtr nPos )
void EventList::AddEvent( sal_IntPtr nType, sal_Int32 nPos )
{
    std::unique_ptr<ListAction> pAction(new ListAction);
    pAction->Position = nPos;
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 5f9504f..4a4e595 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -862,9 +862,9 @@

// private methods

sal_IntPtr SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
sal_Int32 SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
                                   const Reference < XResultSet >& xResultTwo,
                                   sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo,
                                   sal_Int32 nIndexOne, sal_Int32 nIndexTwo,
                                   SortInfo const * pSortInfo )
{
    Reference < XRow > xRowOne( xResultOne, UNO_QUERY );
@@ -1073,9 +1073,9 @@
}


sal_IntPtr SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
sal_Int32 SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
                                   const Reference < XResultSet >& xResultTwo,
                                   sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo )
                                   sal_Int32 nIndexOne, sal_Int32 nIndexTwo )
{
    sal_IntPtr  nCompare = 0;
    SortInfo*   pInfo = mpSortInfo;
@@ -1114,7 +1114,7 @@
}


sal_IntPtr SortedResultSet::Compare( SortListData const *pOne,
sal_Int32 SortedResultSet::Compare( SortListData const *pOne,
                               SortListData const *pTwo )
{
    sal_IntPtr nIndexOne;
@@ -1152,7 +1152,7 @@
}


sal_IntPtr SortedResultSet::FindPos( SortListData const *pEntry,
sal_Int32 SortedResultSet::FindPos( SortListData const *pEntry,
                               sal_IntPtr _nStart, sal_IntPtr _nEnd )
{
    if ( _nStart > _nEnd )
@@ -1305,7 +1305,7 @@
}


void SortedResultSet::CheckProperties( sal_IntPtr nOldCount, bool bWasFinal )
void SortedResultSet::CheckProperties( sal_Int32 nOldCount, bool bWasFinal )
{
    osl::Guard< osl::Mutex > aGuard( maMutex );

@@ -1345,7 +1345,7 @@
}


void SortedResultSet::InsertNew( sal_IntPtr nPos, sal_IntPtr nCount )
void SortedResultSet::InsertNew( sal_Int32 nPos, sal_Int32 nCount )
{
    // for all entries in the msS20-list, which are >= nPos, increase by nCount
    sal_IntPtr      i, nEnd;
@@ -1375,7 +1375,7 @@
}


void SortedResultSet::Remove( sal_IntPtr nPos, sal_IntPtr nCount, EventList *pEvents )
void SortedResultSet::Remove( sal_Int32 nPos, sal_Int32 nCount, EventList *pEvents )
{
    sal_IntPtr        nOldLastSort;

@@ -1427,7 +1427,7 @@
}


void SortedResultSet::Move( sal_IntPtr nPos, sal_IntPtr nCount, sal_IntPtr nOffset )
void SortedResultSet::Move( sal_Int32 nPos, sal_Int32 nCount, sal_Int32 nOffset )
{
    if ( !nOffset )
        return;
@@ -1554,7 +1554,7 @@
}


void SortedResultSet::SetChanged( sal_IntPtr nPos, sal_IntPtr nCount )
void SortedResultSet::SetChanged( sal_Int32 nPos, sal_Int32 nCount )
{
    for ( sal_IntPtr i=0; i<nCount; i++ )
    {
@@ -1694,7 +1694,7 @@
}


void SortedEntryList::Insert( std::unique_ptr<SortListData> pEntry, sal_IntPtr nPos )
void SortedEntryList::Insert( std::unique_ptr<SortListData> pEntry, sal_Int32 nPos )
{
    if ( nPos < static_cast<sal_IntPtr>(maData.size()) )
        maData.insert( maData.begin() + nPos, std::move(pEntry) );
@@ -1702,14 +1702,14 @@
        maData.push_back( std::move(pEntry) );
}

void SortedEntryList::Move( sal_IntPtr nOldPos, sal_IntPtr nNewPos )
void SortedEntryList::Move( sal_Int32 nOldPos, sal_Int32 nNewPos )
{
    auto p = std::move(maData[nOldPos]);
    maData.erase( maData.begin() + nOldPos );
    maData.insert(maData.begin() + nNewPos, std::move(p));
}

std::unique_ptr<SortListData> SortedEntryList::Remove( sal_IntPtr nPos )
std::unique_ptr<SortListData> SortedEntryList::Remove( sal_Int32 nPos )
{
    std::unique_ptr<SortListData> pData;

@@ -1723,7 +1723,7 @@
}


SortListData* SortedEntryList::GetData( sal_IntPtr nPos )
SortListData* SortedEntryList::GetData( sal_Int32 nPos )
{
    SortListData *pData;

@@ -1736,7 +1736,7 @@
}


sal_IntPtr SortedEntryList::operator [] ( sal_IntPtr nPos ) const
sal_Int32 SortedEntryList::operator [] ( sal_Int32 nPos ) const
{
    SortListData *pData;

diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index fb852f6..1f3d01f 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -59,12 +59,12 @@
    sal_uInt32          Count() const { return static_cast<sal_uInt32>(maData.size()); }

    void                Clear();
    void                Insert( std::unique_ptr<SortListData> pEntry, sal_IntPtr nPos );
    std::unique_ptr<SortListData> Remove( sal_IntPtr nPos );
    SortListData*       GetData( sal_IntPtr nPos );
    void                Move( sal_IntPtr nOldPos, sal_IntPtr nNewPos );
    void                Insert( std::unique_ptr<SortListData> pEntry, sal_Int32 nPos );
    std::unique_ptr<SortListData> Remove( sal_Int32 nPos );
    SortListData*       GetData( sal_Int32 nPos );
    void                Move( sal_Int32 nOldPos, sal_Int32 nNewPos );

    sal_IntPtr          operator [] ( sal_IntPtr nPos ) const;
    sal_Int32          operator [] ( sal_Int32 nPos ) const;
};


@@ -77,10 +77,10 @@

    sal_uInt32      Count() { return static_cast<sal_uInt32>(maData.size()); }

    void            AddEvent( sal_IntPtr nType, sal_IntPtr nPos );
    void            AddEvent( sal_IntPtr nType, sal_Int32 nPos );
    void            Insert( std::unique_ptr<css::ucb::ListAction> pAction ) { maData.push_back( std::move(pAction) ); }
    void            Clear();
    css::ucb::ListAction*     GetAction( sal_IntPtr nIndex ) { return maData[ nIndex ].get(); }
    css::ucb::ListAction*     GetAction( sal_Int32 nIndex ) { return maData[ nIndex ].get(); }
};


@@ -110,51 +110,51 @@
    SortedEntryList     maS2O;          // maps the sorted entries to the original ones
    std::deque<sal_IntPtr> m_O2S;       /// maps the original Entries to the sorted ones
    std::deque<SortListData*> m_ModList; /// keeps track of modified entries
    sal_IntPtr          mnLastSort;     // index of the last sorted entry;
    sal_IntPtr          mnCurEntry;     // index of the current entry
    sal_IntPtr          mnCount;        // total count of the elements
    sal_Int32          mnLastSort;     // index of the last sorted entry;
    sal_Int32          mnCurEntry;     // index of the current entry
    sal_Int32          mnCount;        // total count of the elements
    bool                mbIsCopy;


private:
    /// @throws css::sdbc::SQLException
    /// @throws css::uno::RuntimeException
    sal_IntPtr          FindPos( SortListData const *pEntry, sal_IntPtr nStart, sal_IntPtr nEnd );
    sal_Int32          FindPos( SortListData const *pEntry, sal_IntPtr nStart, sal_IntPtr nEnd );
    /// @throws css::sdbc::SQLException
    /// @throws css::uno::RuntimeException
    sal_IntPtr          Compare( SortListData const *pOne,
    sal_Int32          Compare( SortListData const *pOne,
                                 SortListData const *pTwo );
    void                BuildSortInfo( const css::uno::Reference< css::sdbc::XResultSet >& aResult,
                                       const css::uno::Sequence < css::ucb::NumberedSortingInfo > &xSortInfo,
                                       const css::uno::Reference< css::ucb::XAnyCompareFactory > &xCompFac );
    /// @throws css::sdbc::SQLException
    /// @throws css::uno::RuntimeException
    static sal_IntPtr   CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
    static sal_Int32   CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
                                     const css::uno::Reference < css::sdbc::XResultSet >& xResultTwo,
                                     sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo,
                                     sal_Int32 nIndexOne, sal_Int32 nIndexTwo,
                                     SortInfo const * pSortInfo );
    /// @throws css::sdbc::SQLException
    /// @throws css::uno::RuntimeException
    sal_IntPtr          CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
    sal_Int32          CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
                                     const css::uno::Reference < css::sdbc::XResultSet >& xResultTwo,
                                     sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo );
                                     sal_Int32 nIndexOne, sal_Int32 nIndexTwo );
    void                PropertyChanged( const css::beans::PropertyChangeEvent& rEvt );

public:
                        SortedResultSet( css::uno::Reference< css::sdbc::XResultSet > const & aResult );
                        virtual ~SortedResultSet() override;

    sal_IntPtr          GetCount() const { return mnCount; }
    sal_Int32          GetCount() const { return mnCount; }

    void                CopyData( SortedResultSet* pSource );
    void                Initialize( const css::uno::Sequence < css::ucb::NumberedSortingInfo > &xSortInfo,
                                    const css::uno::Reference< css::ucb::XAnyCompareFactory > &xCompFac );
    void                CheckProperties( sal_IntPtr nOldCount, bool bWasFinal );
    void                CheckProperties( sal_Int32 nOldCount, bool bWasFinal );

    void                InsertNew( sal_IntPtr nPos, sal_IntPtr nCount );
    void                SetChanged( sal_IntPtr nPos, sal_IntPtr nCount );
    void                Remove( sal_IntPtr nPos, sal_IntPtr nCount, EventList *pList );
    void                Move( sal_IntPtr nPos, sal_IntPtr nCount, sal_IntPtr nOffset );
    void                InsertNew( sal_Int32 nPos, sal_Int32 nCount );
    void                SetChanged( sal_Int32 nPos, sal_Int32 nCount );
    void                Remove( sal_Int32 nPos, sal_Int32 nCount, EventList *pList );
    void                Move( sal_Int32 nPos, sal_Int32 nCount, sal_Int32 nOffset );

    void                ResortModified( EventList* pList );
    void                ResortNew( EventList* pList );