summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unocoll.cxx5
-rw-r--r--sw/source/core/unocore/unofield.cxx3
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx5
-rw-r--r--sw/source/core/unocore/unoobj.cxx3
-rw-r--r--sw/source/core/unocore/unoobj2.cxx3
-rw-r--r--sw/source/core/unocore/unoredlines.cxx3
-rw-r--r--sw/source/core/unocore/unostyle.cxx5
-rw-r--r--sw/source/core/unocore/unotbl.cxx7
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx5
9 files changed, 25 insertions, 14 deletions
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index bf8ea87af1e4..a0f972f85628 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -32,6 +32,7 @@
#include <fmtftn.hxx>
#include <txtftn.hxx>
#include <com/sun/star/text/XTextTable.hpp>
+#include <o3tl/safeint.hxx>
#include <svtools/unoimap.hxx>
#include <svtools/unoevent.hxx>
#include <unotbl.hxx>
@@ -1410,7 +1411,7 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
if(static_cast<size_t>(nIndex) == i)
break;
}
- if(!(nIndex >= 0 && static_cast<size_t>(nIndex) < rFormats.size()))
+ if(!(nIndex >= 0 && o3tl::make_unsigned(nIndex) < rFormats.size()))
throw IndexOutOfBoundsException();
SwSectionFormat* pFormat = rFormats[nIndex];
@@ -1699,7 +1700,7 @@ uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
throw uno::RuntimeException();
uno::Reference< XIndexReplace > xRef;
- if ( static_cast<size_t>(nIndex) < GetDoc()->GetNumRuleTable().size() )
+ if ( o3tl::make_unsigned(nIndex) < GetDoc()->GetNumRuleTable().size() )
{
xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTable()[ nIndex ], GetDoc());
aRet <<= xRef;
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 4254b3fa42c6..0067dff27216 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -79,6 +79,7 @@
#include <svl/listener.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <o3tl/any.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <textapi.hxx>
@@ -1029,7 +1030,7 @@ OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rD
if(SwFieldIds::SetExp == rType.Which())
{
const SwFieldTypes* pTypes = rDoc.getIDocumentFieldsAccess().GetFieldTypes();
- for( size_t i = 0; i <= size_t(INIT_FLDTYPES); i++ )
+ for( size_t i = 0; i <= o3tl::make_unsigned(INIT_FLDTYPES); i++ )
{
if((*pTypes)[i].get() == &rType)
{
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index 6a1546372361..15ffb4441aa7 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -21,6 +21,7 @@
#include <unocrsrhelper.hxx>
#include <unoflatpara.hxx>
+#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/text/TextMarkupType.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -250,7 +251,7 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
SwTextNode *const pOldTextNode = GetTextNode();
- if (nPos < 0 || pOldTextNode->Len() < nPos || nLen < 0 || static_cast<sal_uInt32>(pOldTextNode->Len()) < static_cast<sal_uInt32>(nPos) + nLen)
+ if (nPos < 0 || pOldTextNode->Len() < nPos || nLen < 0 || o3tl::make_unsigned(pOldTextNode->Len()) < static_cast<sal_uInt32>(nPos) + nLen)
{
throw lang::IllegalArgumentException();
}
@@ -283,7 +284,7 @@ void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
if (!GetTextNode())
return;
- if (nPos < 0 || GetTextNode()->Len() < nPos || nLen < 0 || static_cast<sal_uInt32>(GetTextNode()->Len()) < static_cast<sal_uInt32>(nPos) + nLen)
+ if (nPos < 0 || GetTextNode()->Len() < nPos || nLen < 0 || o3tl::make_unsigned(GetTextNode()->Len()) < static_cast<sal_uInt32>(nPos) + nLen)
{
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 612adeb01e90..ddd352386d11 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -22,6 +22,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <svl/itemprop.hxx>
#include <o3tl/any.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/endian.h>
#include <unotools/collatorwrapper.hxx>
#include <swtypes.hxx>
@@ -156,7 +157,7 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer,
if( ! aWriter.Write( xWrt ).IsError() )
{
const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode );
- if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1))
+ if (lUniLen < o3tl::make_unsigned(SAL_MAX_INT32-1))
{
aStream.WriteUInt16( '\0' );
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index a4708d249970..417370f05980 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -21,6 +21,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/safeint.hxx>
#include <svl/listener.hxx>
#include <svx/svdobj.hxx>
#include <vcl/svapp.hxx>
@@ -1487,7 +1488,7 @@ sal_Int32 SAL_CALL SwXTextRangesImpl::getCount()
uno::Any SAL_CALL SwXTextRangesImpl::getByIndex(sal_Int32 nIndex)
{
SolarMutexGuard aGuard;
- if ((nIndex < 0) || (static_cast<size_t>(nIndex) >= m_Ranges.size()))
+ if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= m_Ranges.size()))
throw lang::IndexOutOfBoundsException();
uno::Any ret;
ret <<= m_Ranges.at(nIndex);
diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx
index 9e1db2b8e637..bbab06ed6a13 100644
--- a/sw/source/core/unocore/unoredlines.cxx
+++ b/sw/source/core/unocore/unoredlines.cxx
@@ -22,6 +22,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <vcl/svapp.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <unoredlines.hxx>
@@ -59,7 +60,7 @@ uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
if(!IsValid())
throw uno::RuntimeException();
const SwRedlineTable& rRedTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
- if ((rRedTable.size() <= static_cast<size_t>(nIndex)) || (nIndex < 0))
+ if ((nIndex < 0) || (rRedTable.size() <= o3tl::make_unsigned(nIndex)))
throw lang::IndexOutOfBoundsException();
uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTable[nIndex], *GetDoc() );
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 4ca49fee3864..7301c7afb8fa 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/safeint.hxx>
#include <svx/svxids.hrc>
#include <hintids.hxx>
#include <vcl/svapp.hxx>
@@ -4720,7 +4723,7 @@ SwBoxAutoFormat* SwXTextCellStyle::GetBoxAutoFormat(SwDocShell* pDocShell, const
return nullptr;
const auto& rTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
- if (rTableTemplateMap.size() <= static_cast<size_t>(nTemplateIndex))
+ if (rTableTemplateMap.size() <= o3tl::make_unsigned(nTemplateIndex))
return nullptr;
SwTableAutoFormat* pTableAutoFormat = pDocShell->GetDoc()->GetTableStyles().FindAutoFormat(sParentName);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 73b64b806968..779b1078c528 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -24,6 +24,7 @@
#include <algorithm>
#include <o3tl/any.hxx>
+#include <o3tl/safeint.hxx>
#include <svx/svxids.hrc>
#include <editeng/memberids.h>
#include <float.h>
@@ -4037,7 +4038,7 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
if(nIndex < 0)
throw lang::IndexOutOfBoundsException();
SwTable* pTable = SwTable::FindTable( pFrameFormat );
- if(static_cast<size_t>(nIndex) >= pTable->GetTabLines().size())
+ if(o3tl::make_unsigned(nIndex) >= pTable->GetTabLines().size())
throw lang::IndexOutOfBoundsException();
SwTableLine* pLine = pTable->GetTabLines()[nIndex];
FindUnoInstanceHint<SwTableLine,SwXTextTableRow> aHint{pLine};
@@ -4071,7 +4072,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this));
const size_t nRowCount = pTable->GetTabLines().size();
- if (nCount <= 0 || !(0 <= nIndex && static_cast<size_t>(nIndex) <= nRowCount))
+ if (nCount <= 0 || !(0 <= nIndex && o3tl::make_unsigned(nIndex) <= nRowCount))
throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
const OUString sTLName = sw_GetCellName(0, nIndex);
const SwTableBox* pTLBox = pTable->GetTableBox(sTLName);
@@ -4230,7 +4231,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SwTableLines& rLines = pTable->GetTabLines();
SwTableLine* pLine = rLines.front();
const size_t nColCount = pLine->GetTabBoxes().size();
- if (nCount <= 0 || !(0 <= nIndex && static_cast<size_t>(nIndex) <= nColCount))
+ if (nCount <= 0 || !(0 <= nIndex && o3tl::make_unsigned(nIndex) <= nColCount))
throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
const OUString sTLName = sw_GetCellName(nIndex, 0);
const SwTableBox* pTLBox = pTable->GetTableBox( sTLName );
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 1d4074d4462a..f20b47e15651 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -19,6 +19,7 @@
#include <unotextmarkup.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <svl/listener.hxx>
#include <vcl/svapp.hxx>
@@ -513,7 +514,7 @@ void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any
OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
{
- if ( static_cast<sal_uInt32>(nIndex) >= maMap.size() )
+ if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
throw lang::IndexOutOfBoundsException();
return OUString();
@@ -521,7 +522,7 @@ OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
{
- if ( static_cast<sal_uInt32>(nIndex) >= maMap.size() )
+ if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
throw lang::IndexOutOfBoundsException();
return uno::Any();