summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-30 09:23:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-30 12:18:04 +0100
commit14b366e57a904c2c0d04804f15d8daf755f14541 (patch)
tree5997a5f1f60a5e0d418708948b408221ef50586c /vcl
parentcabf739612a0e979ebcf76f40a24e66a354b10a5 (diff)
loplugin:singlevalfields
Change-Id: I70dc861573fd1b3d799c88aa2a6d9a3eda0e2a43 Reviewed-on: https://gerrit.libreoffice.org/64327 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/edit/xtextedt.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx
index 20cbddaf8556..ea7fc536a041 100644
--- a/vcl/source/edit/xtextedt.cxx
+++ b/vcl/source/edit/xtextedt.cxx
@@ -27,7 +27,9 @@
using namespace ::com::sun::star;
-ExtTextEngine::ExtTextEngine() : maGroupChars(OUString("(){}[]"))
+static const std::wstring gaGroupChars = L"(){}[]";
+
+ExtTextEngine::ExtTextEngine()
{
}
@@ -43,14 +45,14 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
const sal_uInt32 nParas = GetParagraphCount();
if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) )
{
- sal_Int32 nMatchIndex = maGroupChars.indexOf( GetText( rCursor.GetPara() )[ nPos ] );
- if ( nMatchIndex != -1 )
+ size_t nMatchIndex = gaGroupChars.find( GetText( rCursor.GetPara() )[ nPos ] );
+ if ( nMatchIndex != std::wstring::npos )
{
if ( ( nMatchIndex % 2 ) == 0 )
{
// search forwards
- sal_Unicode nSC = maGroupChars[ nMatchIndex ];
- sal_Unicode nEC = maGroupChars[ nMatchIndex+1 ];
+ sal_Unicode nSC = gaGroupChars[ nMatchIndex ];
+ sal_Unicode nEC = gaGroupChars[ nMatchIndex+1 ];
sal_Int32 nCur = nPos+1;
sal_uInt16 nLevel = 1;
@@ -85,8 +87,8 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
else
{
// search backwards
- sal_Unicode nEC = maGroupChars[ nMatchIndex ];
- sal_Unicode nSC = maGroupChars[ nMatchIndex-1 ];
+ sal_Unicode nEC = gaGroupChars[ nMatchIndex ];
+ sal_Unicode nSC = gaGroupChars[ nMatchIndex-1 ];
sal_Int32 nCur = rCursor.GetIndex()-1;
sal_uInt16 nLevel = 1;