tdf#75280 Convert inappropriate use of sal_uIntPtr to better integer types

Change-Id: Idf73b768671c0daa0d815b75ce71740fc0e5f5c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86310
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
index cf9e7ed..2661931d 100644
--- a/filter/source/graphicfilter/icgm/class1.cxx
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -169,7 +169,7 @@
            {
                sal_uInt32 nSize = ImplGetUI(1);

                if (static_cast<sal_uIntPtr>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                if (static_cast<sal_uInt32>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                    throw css::uno::Exception("attempt to read past end of input", nullptr);

                pElement->aFontList.InsertName( mpSource + mnParaSize, nSize );
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 0213e89..4760215 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -186,7 +186,7 @@
                sal_uInt32 nType = ImplGetUI16();
                sal_uInt32 nSize = ImplGetUI( 1 );

                if (static_cast<sal_uIntPtr>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                if (static_cast<sal_uInt32>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                    throw css::uno::Exception("attempt to read past end of input", nullptr);

                OUString aStr(reinterpret_cast<char*>(mpSource) + mnParaSize, nSize, RTL_TEXTENCODING_ASCII_US);
@@ -223,7 +223,7 @@
                sal_uInt32 nType = ImplGetUI16();
                sal_uInt32 nSize = ImplGetUI(1);

                if (static_cast<sal_uIntPtr>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                if (static_cast<sal_uInt32>(mpEndValidSource - (mpSource + mnParaSize)) < nSize)
                    throw css::uno::Exception("attempt to read past end of input", nullptr);

                OUString aStr(reinterpret_cast<char*>(mpSource) + mnParaSize, nSize, RTL_TEXTENCODING_ASCII_US);
@@ -240,7 +240,7 @@
                (void)ImplGetUI16(); // nType
                sal_uInt32 nSize = ImplGetUI( 1 );

                if (static_cast<sal_uIntPtr>(mpEndValidSource - (mpSource + mnParaSize)) <= nSize)
                if (static_cast<sal_uInt32>(mpEndValidSource - (mpSource + mnParaSize)) <= nSize)
                    throw css::uno::Exception("attempt to read past end of input", nullptr);

                mpSource[ mnParaSize + nSize ] = 0;
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 6ff7821..e194db7 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -538,10 +538,10 @@
                static_cast< sal_uInt16 >( maDateTime.Month ),
                static_cast< sal_uInt16 >( maDateTime.Year ) ),
            tools::Time(
                static_cast< sal_uIntPtr >( maDateTime.Hours ),
                static_cast< sal_uIntPtr >( maDateTime.Minutes ),
                static_cast< sal_uIntPtr >( maDateTime.Seconds ),
                static_cast< sal_uIntPtr >( maDateTime.NanoSeconds ) ) );
                static_cast< sal_uInt16 >( maDateTime.Hours ),
                static_cast< sal_uInt16 >( maDateTime.Minutes ),
                static_cast< sal_uInt16 >( maDateTime.Seconds ),
                static_cast< sal_uInt32 >( maDateTime.NanoSeconds ) ) );
    // invalid time stamp is not converted to UTC
    // heuristic to detect editing durations (which we assume to be < 1 year):
    // check only the year, not the entire date
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index e7f0bbd..94964af 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2694,8 +2694,8 @@
                    aOUSource = pModule->GetSource32();
                    sal_uInt16 nStart, nEnd;
                    pMethod->GetLineRange( nStart, nEnd );
                    sal_uIntPtr nlStart = nStart;
                    sal_uIntPtr nlEnd = nEnd;
                    sal_uInt16 nlStart = nStart;
                    sal_uInt16 nlEnd = nEnd;
                    CutLines( aOUSource, nlStart-1, nlEnd-nlStart+1 );
                }
            }
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index b978311..eb1a276 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -580,21 +580,21 @@
    {
        pSrcCols[nCount] = m_pQSet1->GetItemColor( 1 );
        pDstCols[nCount] = m_pLbColor1->GetSelectEntryColor();
        pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp1->GetValue());
        pTols[nCount++] = static_cast<sal_uInt8>(m_pSp1->GetValue());
    }

    if ( m_pCbx2->IsChecked() )
    {
        pSrcCols[nCount] = m_pQSet2->GetItemColor( 1 );
        pDstCols[nCount] = m_pLbColor2->GetSelectEntryColor();
        pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp2->GetValue());
        pTols[nCount++] = static_cast<sal_uInt8>(m_pSp2->GetValue());
    }

    if ( m_pCbx3->IsChecked() )
    {
        pSrcCols[nCount] = m_pQSet3->GetItemColor( 1 );
        pDstCols[nCount] = m_pLbColor3->GetSelectEntryColor();
        pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp3->GetValue());
        pTols[nCount++] = static_cast<sal_uInt8>(m_pSp3->GetValue());
    }

    if ( m_pCbx4->IsChecked() )