summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-21 15:42:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 08:30:10 +0200
commitb63609ba5478ed9b020c113f5704f7ea8447dec8 (patch)
treee40896646675d8b462cec7a90ca1e94e902b3746 /lingucomponent
parent4af6c0948be47d7816eb1b6f2137b70aba639f0d (diff)
loplugin:flatten in framework..package
Change-Id: Ide8a97eae6e2fdc7d2dcccba1480ac55a9b555bc Reviewed-on: https://gerrit.libreoffice.org/42593 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/languageguessing/guesslang.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx
index 85e041813205..a6469ec4063a 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -173,17 +173,14 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage(
EnsureInitialized();
- lang::Locale aRes;
- if (nStartPos >=0 && nLen >= 0 && nStartPos + nLen <= rText.getLength())
- {
- OString o( OUStringToOString( rText.copy(nStartPos, nLen), RTL_TEXTENCODING_UTF8 ) );
- Guess g = m_aGuesser.GuessPrimaryLanguage(o.getStr());
- aRes.Language = OUString::createFromAscii( g.GetLanguage().c_str() );
- aRes.Country = OUString::createFromAscii( g.GetCountry().c_str() );
- }
- else
+ if (nStartPos < 0 || nLen < 0 || nStartPos + nLen > rText.getLength())
throw lang::IllegalArgumentException();
+ OString o( OUStringToOString( rText.copy(nStartPos, nLen), RTL_TEXTENCODING_UTF8 ) );
+ Guess g = m_aGuesser.GuessPrimaryLanguage(o.getStr());
+ lang::Locale aRes;
+ aRes.Language = OUString::createFromAscii( g.GetLanguage().c_str() );
+ aRes.Country = OUString::createFromAscii( g.GetCountry().c_str() );
return aRes;
}