summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-28 10:33:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-29 08:51:48 +0200
commit1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 (patch)
tree5da59640441292421f2137bc85ee7291daed137e /sc
parentce9a41dc387966c74c1af92783a97565b5af3668 (diff)
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 <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/op_logical.cxx77
-rw-r--r--sc/source/ui/unoobj/docuno.cxx15
2 files changed, 43 insertions, 49 deletions
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;