diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-11-11 11:46:52 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-11-11 15:52:07 +0100 |
commit | 7743f64869d650d5e6a8fb34bb14b2d1be0b05ce (patch) | |
tree | ebf537003520d0595d8bf97320fd816153ba7fa1 /scripting | |
parent | 8030c5cfbb9e88038d34f0b753c415c207927441 (diff) |
tdf#163486: PVS: simplify while loop
V1044 Loop break conditions do not depend on the number of iterations.
Change-Id: Id43a749c090d26b6db174a1ad44df904d20863d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176397
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/protocolhandler/scripthandler.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index d108cdac7c30..683007e7c825 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -120,7 +120,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( if (officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get()) return; - bool bSuccess = false; + sal_Int16 aState = css::frame::DispatchResultState::FAILURE; Any invokeResult; bool bCaughtException = false; Any aException; @@ -204,14 +204,14 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( if ( bIsDocumentScript ) pUndoGuard.reset( new ::framework::DocumentUndoGuard( m_xScriptInvocation ) ); - bSuccess = false; - while ( !bSuccess ) + while ( true ) { std::exception_ptr aFirstCaughtException; try { invokeResult = xFunc->invoke( inArgs, outIndex, outArgs ); - bSuccess = true; + aState = css::frame::DispatchResultState::SUCCESS; + break; } catch( const provider::ScriptFrameworkErrorException& se ) { @@ -265,14 +265,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( aEvent.Source = getXWeak(); aEvent.Result = invokeResult; - if ( bSuccess ) - { - aEvent.State = css::frame::DispatchResultState::SUCCESS; - } - else - { - aEvent.State = css::frame::DispatchResultState::FAILURE; - } + aEvent.State = aState; try { |