From a7369d98991eb41e0e6bb008ef0305c17859540e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 1 Nov 2016 14:37:24 +0200 Subject: [PATCH] loplugin:oncevar in helpcompiler..reportdesign Change-Id: I2dc57931fb230953c285aeb18f57c0a41fedafcb Reviewed-on: https://gerrit.libreoffice.org/30463 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- helpcompiler/source/HelpSearch.cxx | 4 +--- idlc/source/idlccompile.cxx | 6 ++---- linguistic/source/dicimp.cxx | 4 +--- linguistic/source/dlistimp.cxx | 7 ++----- oox/source/drawingml/texteffectscontext.cxx | 4 +--- oox/source/ole/axcontrol.cxx | 7 ++----- reportdesign/source/core/api/ReportEngineJFree.cxx | 6 ++---- reportdesign/source/filter/xml/xmlExport.cxx | 15 +++++---------- .../source/filter/xml/xmlExportDocumentHandler.cxx | 12 ++++-------- reportdesign/source/filter/xml/xmlFormattedField.cxx | 8 ++------ reportdesign/source/filter/xml/xmlGroup.cxx | 3 +-- 11 files changed, 23 insertions(+), 53 deletions(-) diff --git a/helpcompiler/source/HelpSearch.cxx b/helpcompiler/source/HelpSearch.cxx index 96f121932240..6f0fa2eeaf6a 100644 --- a/helpcompiler/source/HelpSearch.cxx +++ b/helpcompiler/source/HelpSearch.cxx @@ -26,9 +26,7 @@ void HelpSearch::query(OUString const &queryStr, bool captionOnly, lucene::index::IndexReader *reader = lucene::index::IndexReader::open(d_indexDir.getStr()); lucene::search::IndexSearcher searcher(reader); - TCHAR captionField[] = L"caption"; - TCHAR contentField[] = L"content"; - TCHAR *field = captionOnly ? captionField : contentField; + const TCHAR* field = captionOnly ? L"caption" : L"content"; bool isWildcard = queryStr[queryStr.getLength() - 1] == L'*'; std::vector aQueryStr(OUStringToTCHARVec(queryStr)); diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 1cc5fac9005d..1f628718f479 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -51,8 +51,6 @@ extern int yydebug; sal_Int32 lineNumber = 1; -static const char TMP[] = "TMP"; -static const char TEMP[] = "TEMP"; static sal_Char tmpFilePattern[512]; bool isFileUrl(const OString& fileName) @@ -123,9 +121,9 @@ OString makeTempName(const OString& prefix) OUString uTmpPath; OString tmpPath; - if ( osl_getEnvironment(OUString(TMP).pData, &uTmpPath.pData) != osl_Process_E_None ) + if ( osl_getEnvironment(OUString("TMP").pData, &uTmpPath.pData) != osl_Process_E_None ) { - if ( osl_getEnvironment(OUString(TEMP).pData, &uTmpPath.pData) != osl_Process_E_None ) + if ( osl_getEnvironment(OUString("TEMP").pData, &uTmpPath.pData) != osl_Process_E_None ) { #if defined(SAL_W32) tmpPath = OString("c:\\temp"); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 3e7ff05ab18e..5efe94f475de 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -1018,9 +1018,7 @@ void DicEntry::splitDicFileWord(const OUString &rDicFileWord, { MutexGuard aGuard( GetLinguMutex() ); - static const char aDelim[] = "=="; - - sal_Int32 nDelimPos = rDicFileWord.indexOf( aDelim ); + sal_Int32 nDelimPos = rDicFileWord.indexOf( "==" ); if (-1 != nDelimPos) { sal_Int32 nTriplePos = nDelimPos + 2; diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index f4506ee5343f..6b2a43be4068 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -790,16 +790,13 @@ static void AddInternal( if (rDic.is()) { //! TL TODO: word iterator should be used to break up the text - static const char aDefWordDelim[] = - "!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n"; - OUString aDelim(aDefWordDelim); + OUString aDelim("!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n"); OSL_ENSURE(aDelim.indexOf(static_cast('.')) == -1, "ensure no '.'"); OUString aToken; sal_Int32 nPos = 0; - while (-1 != - (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim ))) + while (-1 != (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim ))) { if( !aToken.isEmpty() && !IsNumeric( aToken ) ) { diff --git a/oox/source/drawingml/texteffectscontext.cxx b/oox/source/drawingml/texteffectscontext.cxx index 7b7f32e69976..52abd9500456 100644 --- a/oox/source/drawingml/texteffectscontext.cxx +++ b/oox/source/drawingml/texteffectscontext.cxx @@ -98,8 +98,6 @@ OUString lclGetGrabBagName(sal_uInt32 aId) return aGrabBagNameMap[aId]; } -const char constAttributesSequenceName[] = "attributes"; - } using namespace oox::core; @@ -131,7 +129,7 @@ void TextEffectsContext::pushAttributeToGrabBag (sal_Int32 aAttributeId, const O void TextEffectsContext::processAttributes(const AttributeList& rAttribs) { - mpGrabBagStack->push(constAttributesSequenceName); + mpGrabBagStack->push("attributes"); switch(mnCurrentElement) { case OOX_TOKEN(w14, glow): diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 69ab00395709..b6ea8a2726e6 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -2520,9 +2520,6 @@ HtmlSelectModel::HtmlSelectModel() bool HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) { - static const char sMultiple[] = "