summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-23 16:04:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-25 17:19:36 +0200
commita006f60b6ae22db6acb57d06167a3c6fd8bc6f1b (patch)
tree707809080a1fbb95c101de7afe3233f85f0f7bcb
parentd116894b26f538793a0d5dc5847efd2fb53e7acb (diff)
loplugin:oncevar in helpcompiler..jvmfwk
Change-Id: Ia9b20a8ca95684cbeb21e3425972c43ba50df3cd Reviewed-on: https://gerrit.libreoffice.org/39187 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--helpcompiler/source/HelpCompiler.cxx3
-rw-r--r--helpcompiler/source/HelpLinker.cxx2
-rw-r--r--hwpfilter/source/hwpreader.cxx8
-rw-r--r--i18nlangtag/qa/cppunit/test_languagetag.cxx19
-rw-r--r--i18npool/qa/cppunit/test_breakiterator.cxx2
-rw-r--r--i18npool/qa/cppunit/test_textsearch.cxx6
-rw-r--r--i18npool/source/calendar/calendar_hijri.cxx8
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx8
-rw-r--r--i18nutil/source/utility/paper.cxx2
-rw-r--r--i18nutil/source/utility/widthfolding.cxx6
-rw-r--r--idlc/source/astoperation.cxx3
-rw-r--r--idlc/source/idlccompile.cxx4
-rw-r--r--io/source/TextInputStream/TextInputStream.cxx6
-rw-r--r--io/source/TextOutputStream/TextOutputStream.cxx3
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx10
15 files changed, 41 insertions, 49 deletions
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index eb1c54830ffe..92856d04cf93 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -490,8 +490,7 @@ bool HelpCompiler::compile()
{
if (fileName.compare(0, 6, "/text/") == 0)
{
- int len = strlen("/text/");
- actMod = fileName.substr(len);
+ actMod = fileName.substr(strlen("/text/"));
actMod = actMod.substr(0, actMod.find('/'));
}
}
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index d2e3080ca102..1f71635e174e 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -151,7 +151,7 @@ void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::s
{
if( pFile == nullptr )
return;
- char cLF = 10;
+ char const cLF = 10;
unsigned int nKeyLen = aKeyStr.length();
unsigned int nValueLen = aValueStr.length();
fprintf( pFile, "%x ", nKeyLen );
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 8a6b6d7e794a..675f2222fcc4 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -122,11 +122,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(SvStream &rStream)
{
std::unique_ptr<HStream> stream(new HStream);
byte aData[32768];
- std::size_t nRead, nBlock = 32768;
+ std::size_t nRead;
while (true)
{
- nRead = rStream.ReadBytes(aData, nBlock);
+ nRead = rStream.ReadBytes(aData, 32768);
if (nRead == 0)
break;
stream->addData(aData, (int)nRead);
@@ -153,10 +153,10 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor)
std::unique_ptr<HStream> stream(new HStream);
Sequence < sal_Int8 > aBuffer;
- sal_Int32 nRead, nBlock = 32768, nTotal = 0;
+ sal_Int32 nRead, nTotal = 0;
while( true )
{
- nRead = xInputStream->readBytes(aBuffer, nBlock);
+ nRead = xInputStream->readBytes(aBuffer, 32768);
if( nRead == 0 )
break;
stream->addData( reinterpret_cast<const byte *>(aBuffer.getConstArray()), nRead );
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index e2a1cf72a955..cef9011a95fd 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -45,7 +45,7 @@ public:
void TestLanguageTag::testAllTags()
{
{
- OUString s_de_Latn_DE( "de-Latn-DE" );
+ OUString const s_de_Latn_DE( "de-Latn-DE" );
LanguageTag de_DE( s_de_Latn_DE, true );
OUString aBcp47 = de_DE.getBcp47();
lang::Locale aLocale = de_DE.getLocale();
@@ -63,7 +63,7 @@ void TestLanguageTag::testAllTags()
}
{
- OUString s_klingon( "i-klingon" );
+ OUString const s_klingon( "i-klingon" );
LanguageTag klingon( s_klingon, true );
lang::Locale aLocale = klingon.getLocale();
CPPUNIT_ASSERT_EQUAL( OUString("tlh"), klingon.getBcp47() );
@@ -143,7 +143,7 @@ void TestLanguageTag::testAllTags()
// 'sh-RS' has an internal override to 'sr-Latn-RS'
{
- OUString s_sh_RS( "sh-RS" );
+ OUString const s_sh_RS( "sh-RS" );
LanguageTag sh_RS( s_sh_RS, true );
lang::Locale aLocale = sh_RS.getLocale();
CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.getBcp47() );
@@ -175,7 +175,7 @@ void TestLanguageTag::testAllTags()
// known LangID with an override and canonicalization should work the same
// without liblangtag.
{
- OUString s_bs_Latn_BA( "bs-Latn-BA" );
+ OUString const s_bs_Latn_BA( "bs-Latn-BA" );
LanguageTag bs_Latn_BA( s_bs_Latn_BA, true );
lang::Locale aLocale = bs_Latn_BA.getLocale();
CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.getBcp47() );
@@ -250,7 +250,7 @@ void TestLanguageTag::testAllTags()
// 'ca-XV' has an internal override to 'ca-ES-valencia'
{
- OUString s_ca_XV( "ca-XV" );
+ OUString const s_ca_XV( "ca-XV" );
OUString s_ca_ES_valencia( "ca-ES-valencia" );
LanguageTag ca_XV( s_ca_XV, true );
lang::Locale aLocale = ca_XV.getLocale();
@@ -300,7 +300,7 @@ void TestLanguageTag::testAllTags()
}
{
- OUString s_de_DE( "de-DE" );
+ OUString const s_de_DE( "de-DE" );
LanguageTag de_DE( lang::Locale( "de", "DE", "" ) );
lang::Locale aLocale = de_DE.getLocale();
CPPUNIT_ASSERT_EQUAL( s_de_DE, de_DE.getBcp47() );
@@ -311,7 +311,7 @@ void TestLanguageTag::testAllTags()
}
{
- OUString s_de_DE( "de-DE" );
+ OUString const s_de_DE( "de-DE" );
LanguageTag de_DE( LANGUAGE_GERMAN );
lang::Locale aLocale = de_DE.getLocale();
CPPUNIT_ASSERT_EQUAL( s_de_DE, de_DE.getBcp47() );
@@ -389,9 +389,8 @@ void TestLanguageTag::testAllTags()
// Deprecated as of 2015-04-17, prefer en-GB-oxendict instead.
// As of 2017-03-14 we also alias to en-GB-oxendict.
{
- OUString s_en_GB_oed( "en-GB-oed" );
OUString s_en_GB_oxendict( "en-GB-oxendict" );
- LanguageTag en_GB_oed( s_en_GB_oed );
+ LanguageTag en_GB_oed( "en-GB-oed" );
lang::Locale aLocale = en_GB_oed.getLocale();
CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, en_GB_oed.getBcp47() );
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
@@ -493,7 +492,7 @@ void TestLanguageTag::testAllTags()
// 'qtx' is an unknown new mslangid
{
- OUString s_qtx( "qtx" );
+ OUString const s_qtx( "qtx" );
LanguageTag qtx( s_qtx );
qtx.setScriptType( LanguageTag::ScriptType::RTL );
LanguageType n_qtx = qtx.getLanguageType();
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index e18efe843029..8c5b377b3bd9 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -115,7 +115,7 @@ void TestBreakIterator::testLineBreaking()
//See https://bz.apache.org/ooo/show_bug.cgi?id=17155
{
- OUString aTest("foo /bar/baz");
+ OUString const aTest("foo /bar/baz");
aLocale.Language = "en";
aLocale.Country = "US";
diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx
index 303af41db72e..be366aa71fdc 100644
--- a/i18npool/qa/cppunit/test_textsearch.cxx
+++ b/i18npool/qa/cppunit/test_textsearch.cxx
@@ -103,9 +103,9 @@ void TestTextSearch::testSearches()
{
OUString str( "acababaabcababadcdaa" );
sal_Int32 startPos = 2, endPos = 20 ;
- OUString searchStr( "(ab)*a(c|d)+" );
- sal_Int32 fStartRes = 10, fEndRes = 18 ;
- sal_Int32 bStartRes = 18, bEndRes = 10 ;
+ OUString const searchStr( "(ab)*a(c|d)+" );
+ sal_Int32 const fStartRes = 10, fEndRes = 18 ;
+ sal_Int32 const bStartRes = 18, bEndRes = 10 ;
// set options
util::SearchOptions aOptions;
diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx
index 11046f8e9cbf..eeabf6d47472 100644
--- a/i18npool/source/calendar/calendar_hijri.cxx
+++ b/i18npool/source/calendar/calendar_hijri.cxx
@@ -316,12 +316,12 @@ Calendar_hijri::getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year)
sal_Int32 intgr = (sal_Int32)((sal_Int32)(365.25 * jy) + (sal_Int32)(30.6001 * jm) + day + 1720995 );
//check for switch to Gregorian calendar
- double gregcal = 15 + 31 * ( 10 + 12 * 1582 );
+ double const gregcal = 15 + 31 * ( 10 + 12 * 1582 );
if( day + 31 * (month + 12 * year) >= gregcal ) {
- double ja;
- ja = (sal_Int32)(0.01 * jy);
- intgr += (sal_Int32)(2 - ja + (sal_Int32)(0.25 * ja));
+ double ja;
+ ja = (sal_Int32)(0.01 * jy);
+ intgr += (sal_Int32)(2 - ja + (sal_Int32)(0.25 * ja));
}
return (double) intgr;
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 0fba9c6f5d99..c1c5aaa81e32 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -798,10 +798,10 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
if (strcmp( of.getLocale(), "en_US") != 0)
{
OUString aCode( n->getValue());
- OUString aPar1( "0)");
- OUString aPar2( "-)" );
- OUString aPar3( " )" );
- OUString aPar4( "])" );
+ OUString const aPar1( "0)");
+ OUString const aPar2( "-)" );
+ OUString const aPar3( " )" );
+ OUString const aPar4( "])" );
if (aCode.indexOf( aPar1 ) > 0 || aCode.indexOf( aPar2 ) > 0 ||
aCode.indexOf( aPar3 ) > 0 || aCode.indexOf( aPar4 ) > 0)
fprintf( stderr, "Warning: FormatCode formatindex=\"%d\" for currency uses parentheses for negative amounts, which probably is not correct for locales not based on en_US.\n", formatindex);
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 9d18618fd3a3..7ab91d089b3c 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -259,7 +259,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
bool bHalve = false;
- size_t nExtraTabSize = SAL_N_ELEMENTS(aCustoms);
+ size_t const nExtraTabSize = SAL_N_ELEMENTS(aCustoms);
for (size_t i = 0; i < nExtraTabSize; ++i)
{
if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx
index 3b948025e318..84963f54c922 100644
--- a/i18nutil/source/utility/widthfolding.cxx
+++ b/i18nutil/source/utility/widthfolding.cxx
@@ -252,9 +252,7 @@ oneToOneMapping& widthfolding::gethalf2fullTableForJIS()
//
// See the following page for detail:
// http://wiki.openoffice.org/wiki/Calc/Features/JIS_and_ASC_functions
- int i, j;
- int n = SAL_N_ELEMENTS(half2fullJISException);
- for( i = 0; i < n; i++ )
+ for( int i = 0; i < int(SAL_N_ELEMENTS(half2fullJISException)); i++ )
{
const int high = (half2fullJISException[i].first >> 8) & 0xFF;
const int low = (half2fullJISException[i].first) & 0xFF;
@@ -263,7 +261,7 @@ oneToOneMapping& widthfolding::gethalf2fullTableForJIS()
{
table.mpIndex[high] = new UnicodePairWithFlag*[256];
- for( j = 0; j < 256; j++ )
+ for( int j = 0; j < 256; j++ )
table.mpIndex[high][j] = nullptr;
}
table.mpIndex[high][low] = &half2fullJISException[i];
diff --git a/idlc/source/astoperation.cxx b/idlc/source/astoperation.cxx
index e88656f25db5..3a9a39adb5e5 100644
--- a/idlc/source/astoperation.cxx
+++ b/idlc/source/astoperation.cxx
@@ -42,7 +42,6 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
{
sal_uInt16 nParam = getNodeCount(NT_parameter);
sal_uInt16 nExcep = (sal_uInt16)m_exceptions.size();
- RTMethodMode methodMode = RTMethodMode::TWOWAY;
OUString returnTypeName;
if (m_pReturnType == nullptr) {
@@ -52,7 +51,7 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
m_pReturnType->getRelativName(), RTL_TEXTENCODING_UTF8);
}
rBlob.setMethodData(
- index, getDocumentation(), methodMode,
+ index, getDocumentation(), RTMethodMode::TWOWAY,
OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8),
returnTypeName, nParam, nExcep);
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 5066752b3599..03b9a517f9e3 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -180,8 +180,8 @@ bool copyFile(const OString* source, const OString& target)
return false;
}
- size_t totalSize = 512;
- char pBuffer[513];
+ size_t const totalSize = 512;
+ char pBuffer[totalSize + 1];
while ( !feof(pSource) )
{
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index c068f86fffc7..b49c5ec2e1c1 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -170,8 +170,7 @@ OUString OTextInputStream::implReadString( const Sequence< sal_Unicode >& Delimi
OUString aRetStr;
if( !mbEncodingInitialized )
{
- OUString aUtf8Str("utf8");
- setEncoding( aUtf8Str );
+ setEncoding( "utf8" );
}
if( !mbEncodingInitialized )
return aRetStr;
@@ -278,8 +277,7 @@ sal_Int32 OTextInputStream::implReadNext()
try
{
- sal_Int32 nBytesToRead = READ_BYTE_COUNT;
- sal_Int32 nRead = mxStream->readSomeBytes( mSeqSource, nBytesToRead );
+ sal_Int32 nRead = mxStream->readSomeBytes( mSeqSource, READ_BYTE_COUNT );
sal_Int32 nTotalRead = nRead;
if( nRead == 0 )
mbReachedEOF = true;
diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx
index a0555e53cc7c..c888adbf9cd4 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -159,8 +159,7 @@ void OTextOutputStream::writeString( const OUString& aString )
checkOutputStream();
if( !mbEncodingInitialized )
{
- OUString aUtf8Str("utf8");
- setEncoding( aUtf8Str );
+ setEncoding( "utf8" );
}
if( !mbEncodingInitialized )
return;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx
index d7bf982e4fc1..32203618b8cd 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx
@@ -98,11 +98,11 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
OUString sJavaLibraryPath;
typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
- OUString sVendorProperty("java.vendor");
- OUString sVersionProperty("java.version");
- OUString sJavaHomeProperty("java.home");
- OUString sJavaLibraryPathProperty("java.library.path");
- OUString sGNUHomeProperty("gnu.classpath.home.url");
+ OUString const sVendorProperty("java.vendor");
+ OUString const sVersionProperty("java.version");
+ OUString const sJavaHomeProperty("java.home");
+ OUString const sJavaLibraryPathProperty("java.library.path");
+ OUString const sGNUHomeProperty("gnu.classpath.home.url");
OUString sAccessProperty("javax.accessibility.assistive_technologies");
bool bVersion = false;