diff options
author | Gökhan Gurbetoğlu <gokhan.gurbetoglu@pardus.org.tr> | 2018-04-16 15:33:03 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-17 08:14:56 +0200 |
commit | 0f166ef5240ee155bf2544e6bc3c985b1e3bf646 (patch) | |
tree | ece7b6b86e2426f3ec794130b1dfe2f4b29bf97d | |
parent | b9f9f8253f89151beed27499e6db5c11a7d81eba (diff) |
cppcheck - fix variableScope in some files
Reduced the scope of some variables in source.
Change-Id: Ib3b521ca5df8b9b254b51eab5f1d7040d6cfd846
Reviewed-on: https://gerrit.libreoffice.org/52974
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 4 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 3 | ||||
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 3 | ||||
-rw-r--r-- | libreofficekit/qa/tilebench/tilebench.cxx | 12 |
4 files changed, 9 insertions, 13 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index e3ca3e8af707..077376b66ceb 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -640,13 +640,11 @@ namespace { // we have to look if we have alias.* here but before we have to check if the column doesn't already exist OTableFieldDescRef aInfo = new OTableFieldDesc(); - bool bFound = false; for (auto const& table : rTabList) { OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get()); - bFound = pTabWin->ExistsField( rFieldName, aInfo ); - if ( bFound ) + if ( pTabWin->ExistsField( rFieldName, aInfo ) ) { rFieldName = aInfo->GetField(); break; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 9ba2b3152618..8d4d9d7cc0b0 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2569,14 +2569,13 @@ void SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, MakeUserStorage_Impl(); - bool bRet = false; OUString sLong; try { uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE ); - bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong ); xStg = nullptr; + bool bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong ); // Update the word list if( bRet ) { diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index d20c1b8ea783..2b5e5145ae5b 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -122,11 +122,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream) { std::unique_ptr<HStream> stream(new HStream); byte aData[32768]; - std::size_t nRead; while (true) { - nRead = rStream.ReadBytes(aData, 32768); + std::size_t nRead = rStream.ReadBytes(aData, 32768); if (nRead == 0) break; stream->addData(aData, static_cast<int>(nRead)); diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx index ed3d57d05b3f..3c62e2e36838 100644 --- a/libreofficekit/qa/tilebench/tilebench.cxx +++ b/libreofficekit/qa/tilebench/tilebench.cxx @@ -104,12 +104,6 @@ int main( int argc, char* argv[] ) return 1; } - // Use realistic dimensions, similar to the Online client. - long nTilePixelWidth = 512; - long nTilePixelHeight = 512; - long nTileTwipWidth = 3840; - long nTileTwipHeight = 3840; - aTimes.emplace_back("initialization"); // coverity[tainted_string] - build time test tool Office *pOffice = lok_cpp_init(argv[1]); @@ -153,6 +147,12 @@ int main( int argc, char* argv[] ) } aTimes.emplace_back(); + // Use realistic dimensions, similar to the Online client. + long nTilePixelWidth = 512; + long nTilePixelHeight = 512; + long nTileTwipWidth = 3840; + long nTileTwipHeight = 3840; + // Estimate the maximum tiles based on the number of parts requested, if Writer. if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT) max_tiles = static_cast<int>(ceil(max_parts * 16128. / nTilePixelHeight)) * ceil(static_cast<double>(nWidth) / nTilePixelWidth); |