summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-28 10:31:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-28 13:52:34 +0100
commitf7c4c6313dbe305d9dd2f7a0c49f436033bbf62e (patch)
treec65d1ea0a55eec6ed8af5910f17046e51fe2ce39
parenttdf#115208 Apparmor profile update (allow JVM execution) (diff)
downloadcore-f7c4c6313dbe305d9dd2f7a0c49f436033bbf62e.tar.gz
core-f7c4c6313dbe305d9dd2f7a0c49f436033bbf62e.zip
SvxAccessibleTextIndex::mnEEIndex need not be bounded sal_uInt16
It was originally introduced with type USHORT (a909acb7009acadffa53e74ea05ddb88803490f1 "#98735# Refactored unoedit/unoedacc.cxx"), then shortly after changed to sal_Int32 (a0089a21f047ce8b5378b45f1535269e3600d681 "#98735# Fixed various off-by-one mistakes"), presumably because it needed to hold values slightly larger than USHRT_MAX. But at least since the surrounding code has been changed to use sal_Int32 throughout (e.g., structs like EPosition and ESeleciton in include/editeng/editdata.hxx with 3cbfcee36dd16e451d76c561eaaaee0ff29b01a5 "xub_StrLen and tools/string.hxx final straw"), there appears to be no more reason to effectively restrict mnEEIndex to sal_uInt16 values. Change-Id: I78f02be1f2736a626a836ac992230a74cc669fd3 Reviewed-on: https://gerrit.libreoffice.org/48766 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--editeng/source/uno/unoedprx.cxx16
-rw-r--r--include/editeng/unoedprx.hxx2
2 files changed, 9 insertions, 9 deletions
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index d49032f00423..24f95f6c03f8 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -89,9 +89,9 @@ public:
@param rTF
The text forwarder to use in the calculations
*/
- void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF );
- void SetEEIndex( sal_Int32 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
- sal_uInt16 GetEEIndex() const;
+ void SetEEIndex( sal_Int32 nEEIndex, const SvxTextForwarder& rTF );
+ void SetEEIndex( sal_Int32 nPara, sal_Int32 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
+ sal_Int32 GetEEIndex() const;
void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
@@ -158,15 +158,15 @@ ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
}
-sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const
+sal_Int32 SvxAccessibleTextIndex::GetEEIndex() const
{
- DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
+ DBG_ASSERT(mnEEIndex >= 0,
"SvxAccessibleTextIndex::GetEEIndex: index value overflow");
- return static_cast< sal_uInt16 > (mnEEIndex);
+ return mnEEIndex;
}
-void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF )
+void SvxAccessibleTextIndex::SetEEIndex( sal_Int32 nEEIndex, const SvxTextForwarder& rTF )
{
// reset
mnFieldOffset = 0;
@@ -632,7 +632,7 @@ void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_Int
mpTextForwarder->FieldClicked( rField, nPara, nPos );
}
-sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex )
+sal_Int32 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx
index 39bc5f163b6d..559c0390294e 100644
--- a/include/editeng/unoedprx.hxx
+++ b/include/editeng/unoedprx.hxx
@@ -42,7 +42,7 @@ public:
virtual void RemoveAttribs( const ESelection& rSelection ) override;
virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override;
- sal_uInt16 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex );
+ sal_Int32 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex );
virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override;
virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override;