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
This commit is contained in:
Xisco Fauli
2024-11-11 15:52:07 +01:00
parent 8030c5cfbb
commit 7743f64869
@@ -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
{