toolkit/source/controls/roadmapcontrol.cxx |   24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

New commits:
commit 3c162a7a312022716e0648f95662b33577b5993d
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu Oct 5 12:21:51 2023 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Thu Oct 5 13:57:11 2023 +0200

    Replace 2 other lcl_throw* by throwing the right exception directly 
(toolkit)
    
    Change-Id: Ib0347db6ad5690e0cba9326d7ec3fd85c2f93984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157588
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Tested-by: Jenkins

diff --git a/toolkit/source/controls/roadmapcontrol.cxx 
b/toolkit/source/controls/roadmapcontrol.cxx
index 1fdef79f28b7..6d73514e7bc4 100644
--- a/toolkit/source/controls/roadmapcontrol.cxx
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -39,18 +39,6 @@ namespace toolkit
 
 //  helper
 
-
-static void lcl_throwIllegalArgumentException( )
-{   // throwing is expensive (in terms of code size), thus we hope the 
compiler does not inline this...
-    throw IllegalArgumentException();
-}
-
-static void lcl_throwIndexOutOfBoundsException( )
-{   // throwing is expensive (in terms of code size), thus we hope the 
compiler does not inline this...
-    throw IndexOutOfBoundsException();
-}
-
-
     // = UnoControlRoadmapModel
 
 
@@ -179,7 +167,7 @@ static void lcl_throwIndexOutOfBoundsException( )
     Any SAL_CALL UnoControlRoadmapModel::getByIndex( sal_Int32 Index )
     {
         if ((Index < 0) || ( o3tl::make_unsigned(Index) >= 
maRoadmapItems.size()))
-            lcl_throwIndexOutOfBoundsException( );
+            throw IndexOutOfBoundsException();
         Any aAny( maRoadmapItems.at( Index ) );
         return aAny;
     }
@@ -188,13 +176,13 @@ static void lcl_throwIndexOutOfBoundsException( )
     void UnoControlRoadmapModel::MakeRMItemValidation( sal_Int32 Index, const 
Reference< XInterface >& xRoadmapItem )
     {
         if (( Index < 0 ) || (o3tl::make_unsigned(Index) > 
maRoadmapItems.size()) )
-            lcl_throwIndexOutOfBoundsException( );
+            throw IndexOutOfBoundsException();
         if ( !xRoadmapItem.is() )
-            lcl_throwIllegalArgumentException();
+            throw IllegalArgumentException();
         Reference< XServiceInfo > xServiceInfo( xRoadmapItem, UNO_QUERY );
         bool bIsRoadmapItem = 
xServiceInfo->supportsService("com.sun.star.awt.RoadmapItem");
         if ( !bIsRoadmapItem )
-            lcl_throwIllegalArgumentException();
+            throw IllegalArgumentException();
     }
 
 
@@ -268,7 +256,7 @@ static void lcl_throwIndexOutOfBoundsException( )
     void SAL_CALL UnoControlRoadmapModel::insertByIndex( const sal_Int32 
Index, const Any& Element)
     {
         if ( ( Index >= ( static_cast<sal_Int32>(maRoadmapItems.size()) + 1 ) 
) || (Index < 0))
-            lcl_throwIndexOutOfBoundsException( );
+            throw IndexOutOfBoundsException();
         Reference< XInterface > xRoadmapItem;
         Element >>= xRoadmapItem;
         MakeRMItemValidation( Index, xRoadmapItem);
@@ -289,7 +277,7 @@ static void lcl_throwIndexOutOfBoundsException( )
     void SAL_CALL UnoControlRoadmapModel::removeByIndex( sal_Int32 Index)
     {
         if ((Index < 0) || ( o3tl::make_unsigned(Index) > 
maRoadmapItems.size()))
-            lcl_throwIndexOutOfBoundsException( );
+            throw IndexOutOfBoundsException();
         Reference< XInterface > xRoadmapItem;
         maRoadmapItems.erase( maRoadmapItems.begin() + Index );
         ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);

Reply via email to