Kaydet (Commit) 0f166ef5 authored tarafından Gökhan Gurbetoğlu's avatar Gökhan Gurbetoğlu Kaydeden (comit) Noel Grandin

cppcheck - fix variableScope in some files

Reduced the scope of some variables in source.

Change-Id: Ib3b521ca5df8b9b254b51eab5f1d7040d6cfd846
Reviewed-on: https://gerrit.libreoffice.org/52974Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b9f9f825
...@@ -640,13 +640,11 @@ namespace ...@@ -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 // 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(); OTableFieldDescRef aInfo = new OTableFieldDesc();
bool bFound = false;
for (auto const& table : rTabList) for (auto const& table : rTabList)
{ {
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get()); OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(table.second.get());
bFound = pTabWin->ExistsField( rFieldName, aInfo ); if ( pTabWin->ExistsField( rFieldName, aInfo ) )
if ( bFound )
{ {
rFieldName = aInfo->GetField(); rFieldName = aInfo->GetField();
break; break;
......
...@@ -2569,14 +2569,13 @@ void SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, ...@@ -2569,14 +2569,13 @@ void SvxAutoCorrectLanguageLists::PutText( const OUString& rShort,
MakeUserStorage_Impl(); MakeUserStorage_Impl();
bool bRet = false;
OUString sLong; OUString sLong;
try try
{ {
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE ); uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong );
xStg = nullptr; xStg = nullptr;
bool bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong );
// Update the word list // Update the word list
if( bRet ) if( bRet )
{ {
......
...@@ -122,11 +122,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream) ...@@ -122,11 +122,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream)
{ {
std::unique_ptr<HStream> stream(new HStream); std::unique_ptr<HStream> stream(new HStream);
byte aData[32768]; byte aData[32768];
std::size_t nRead;
while (true) while (true)
{ {
nRead = rStream.ReadBytes(aData, 32768); std::size_t nRead = rStream.ReadBytes(aData, 32768);
if (nRead == 0) if (nRead == 0)
break; break;
stream->addData(aData, static_cast<int>(nRead)); stream->addData(aData, static_cast<int>(nRead));
......
...@@ -104,12 +104,6 @@ int main( int argc, char* argv[] ) ...@@ -104,12 +104,6 @@ int main( int argc, char* argv[] )
return 1; 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"); aTimes.emplace_back("initialization");
// coverity[tainted_string] - build time test tool // coverity[tainted_string] - build time test tool
Office *pOffice = lok_cpp_init(argv[1]); Office *pOffice = lok_cpp_init(argv[1]);
...@@ -153,6 +147,12 @@ int main( int argc, char* argv[] ) ...@@ -153,6 +147,12 @@ int main( int argc, char* argv[] )
} }
aTimes.emplace_back(); 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. // Estimate the maximum tiles based on the number of parts requested, if Writer.
if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT) if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT)
max_tiles = static_cast<int>(ceil(max_parts * 16128. / nTilePixelHeight)) * ceil(static_cast<double>(nWidth) / nTilePixelWidth); max_tiles = static_cast<int>(ceil(max_parts * 16128. / nTilePixelHeight)) * ceil(static_cast<double>(nWidth) / nTilePixelWidth);
......
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