Kaydet (Commit) a006f60b authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:oncevar in helpcompiler..jvmfwk

Change-Id: Ia9b20a8ca95684cbeb21e3425972c43ba50df3cd
Reviewed-on: https://gerrit.libreoffice.org/39187Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst d116894b
......@@ -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('/'));
}
}
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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";
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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];
......
......@@ -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);
......
......@@ -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) )
{
......
......@@ -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;
......
......@@ -159,8 +159,7 @@ void OTextOutputStream::writeString( const OUString& aString )
checkOutputStream();
if( !mbEncodingInitialized )
{
OUString aUtf8Str("utf8");
setEncoding( aUtf8Str );
setEncoding( "utf8" );
}
if( !mbEncodingInitialized )
return;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment