From 1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Sep 2017 10:33:09 +0200 Subject: loplugin:flatten check for throw in then clause also make the plugin ignore the case where we have var decl's in the clause we want to flatten, which could lead to problematic extension of variable lifetime Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59 Reviewed-on: https://gerrit.libreoffice.org/42889 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/opencl/op_logical.cxx | 77 +++++++++++++++++------------------- sc/source/ui/unoobj/docuno.cxx | 15 +++---- 2 files changed, 43 insertions(+), 49 deletions(-) (limited to 'sc') diff --git a/sc/source/core/opencl/op_logical.cxx b/sc/source/core/opencl/op_logical.cxx index 7f63af628cab..acb836a02c20 100644 --- a/sc/source/core/opencl/op_logical.cxx +++ b/sc/source/core/opencl/op_logical.cxx @@ -320,47 +320,44 @@ void OpIf::GenSlidingWindowFunction(std::stringstream &ss, { throw UnhandledToken("unknown operand for ocPush", __FILE__, __LINE__); } - else + if(vSubArguments.size()==3) { - if(vSubArguments.size()==3) - { - ss << " if(isnan("; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << ")|| "; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << " == 0)\n"; - ss << " return "; - ss << vSubArguments[2]->GenSlidingWindowDeclRef(); - ss << ";\n"; - ss << " else"; - ss <<" return "; - ss << vSubArguments[1]->GenSlidingWindowDeclRef(); - ss <<";\n"; - } - if(vSubArguments.size()==2) - { - ss << " if(isnan("; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << ")|| "; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << " == 0)\n"; - ss << " return 0;\n"; - ss << " else"; - ss <<" return "; - ss << vSubArguments[1]->GenSlidingWindowDeclRef(); - ss <<";\n"; - } - if(vSubArguments.size()==1) - { - ss << " if(isnan("; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << ")|| "; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << " == 0)\n"; - ss << " return 0;\n"; - ss << " else"; - ss <<" return 1;\n"; - } + ss << " if(isnan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return "; + ss << vSubArguments[2]->GenSlidingWindowDeclRef(); + ss << ";\n"; + ss << " else"; + ss <<" return "; + ss << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss <<";\n"; + } + if(vSubArguments.size()==2) + { + ss << " if(isnan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return 0;\n"; + ss << " else"; + ss <<" return "; + ss << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss <<";\n"; + } + if(vSubArguments.size()==1) + { + ss << " if(isnan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return 0;\n"; + ss << " else"; + ss <<" return 1;\n"; } ss << "}\n"; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 629b2c6816e3..265334a5eef8 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3418,15 +3418,12 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno:: // name already exists throw container::ElementExistException(); } - else - { - SCTAB nPosition = rDoc.GetTableCount(); - bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, - true, true ); - if (bDone) - pSheetObj->InitInsertSheet( pDocShell, nPosition ); - // set document and new range in the object - } + SCTAB nPosition = rDoc.GetTableCount(); + bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, + true, true ); + if (bDone) + pSheetObj->InitInsertSheet( pDocShell, nPosition ); + // set document and new range in the object } else bIllArg = true; -- cgit