From 0e6a2601b39cbadaff7f7506ba9e804f108060db Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 23 Oct 2013 13:29:32 +0200 Subject: Convert code that calls OUString::getStr()[] to use the [] operator This also means that this code now gets bounds checked in debug builds. Change-Id: Id777f85eaee6a737bbcb84625e6e110abe0e0f27 --- linguistic/source/hhconvdic.cxx | 2 +- linguistic/source/misc.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'linguistic/source') diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx index 7616f64d6e23..c26353fb2f55 100644 --- a/linguistic/source/hhconvdic.cxx +++ b/linguistic/source/hhconvdic.cxx @@ -76,7 +76,7 @@ sal_Bool TextIsAllScriptType( const OUString &rTxt, sal_Int16 nScriptType ) sal_Bool bIsAll = sal_True; for (sal_Int32 i = 0; i < rTxt.getLength() && bIsAll; ++i) { - if (checkScriptType( rTxt.getStr()[i]) != nScriptType) + if (checkScriptType( rTxt[i]) != nScriptType) bIsAll = sal_False; } return bIsAll; diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 1a7f61763db9..d979d531969e 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -178,8 +178,8 @@ sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 ) { for (k = 1; k <= nLen2; ++k) { - sal_Unicode c1i = rTxt1.getStr()[i - 1]; - sal_Unicode c2k = rTxt2.getStr()[k - 1]; + sal_Unicode c1i = rTxt1[i - 1]; + sal_Unicode c2k = rTxt2[k - 1]; sal_Int32 nCost = c1i == c2k ? 0 : 1; sal_Int32 nNew = Minimum( aData.Value(i-1, k ) + 1, aData.Value(i , k-1) + 1, @@ -188,9 +188,9 @@ sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 ) if (2 < i && 2 < k) { int nT = aData.Value(i-2, k-2) + 1; - if (rTxt1.getStr()[i - 2] != c1i) + if (rTxt1[i - 2] != c1i) ++nT; - if (rTxt2.getStr()[k - 2] != c2k) + if (rTxt2[k - 2] != c2k) ++nT; if (nT < nNew) nNew = nT; -- cgit v1.2.3