summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-17 21:16:11 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-18 06:39:15 +0000
commita23f6eb3ae49dfc326c6e57a8ab95a840c0661d2 (patch)
treee4bfa45604b2a62a6683573305763dd13f195e33 /lingucomponent
parent36936c2580bf15117dd3bf775dd91340d16d3239 (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: Ib16e4ecc0e0c43b2c1fb527eb0668a960ae9756e Reviewed-on: https://gerrit.libreoffice.org/13513 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index b8b997931a26..d561fd00412e 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -255,10 +255,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
const ::com::sun::star::beans::PropertyValues& aProperties )
throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException, std::exception)
{
- int nHyphenationPos = -1;
- int nHyphenationPosAlt = -1;
- int nHyphenationPosAltHyph = -1;
- int wordlen;
int k = 0;
PropertyHelper_Hyphenation& rHelper = GetPropHelper();
@@ -269,7 +265,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
HyphenDict *dict = NULL;
rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
- CharClass * pCC = NULL;
Reference< XHyphenatedWord > xRes;
@@ -283,6 +278,10 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
// if we have a hyphenation dictionary matching this locale
if (k != -1)
{
+ int nHyphenationPos = -1;
+ int nHyphenationPosAlt = -1;
+ int nHyphenationPosAltHyph = -1;
+
// if this dictinary has not been loaded yet do that
if (!aDicts[k].aPtr)
{
@@ -310,7 +309,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
// other wise hyphenate the word with that dictionary
dict = aDicts[k].aPtr;
eEnc = aDicts[k].eEnc;
- pCC = aDicts[k].apCC;
+ CharClass * pCC = aDicts[k].apCC;
// we don't want to work with a default text encoding since following incorrect
// results may occur only for specific text and thus may be hard to notice.
@@ -342,7 +341,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
// now convert word to needed encoding
OString encWord(OU2ENC(nTerm,eEnc));
- wordlen = encWord.getLength();
+ int wordlen = encWord.getLength();
boost::scoped_array<char> lcword(new char[wordlen + 1]);
boost::scoped_array<char> hyphens(new char[wordlen + 5]);