shell/source/win32/SysShExec.cxx |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit abd7996a8be2659243327b74fc35023446ddb513
Author:     Simon Chenery <[email protected]>
AuthorDate: Sat Aug 9 10:18:02 2025 +0200
Commit:     David Gilbert <[email protected]>
CommitDate: Sat Aug 9 15:01:12 2025 +0200

    tdf#147021 avoid use of SAL_N_ELEMENTS macro in SysShExec.cxx
    
    Also replace for loop with counter with a range-based for loop.
    
    Change-Id: Ief6b76f1980e0afe72cdebb0b2370b34c0a138b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189235
    Reviewed-by: David Gilbert <[email protected]>
    Tested-by: Jenkins

diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 5e56b39692ce..5d039bf16b81 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -107,9 +107,6 @@ namespace
         {  ERROR_NOT_ENOUGH_QUOTA,       osl_File_E_NOMEM    }    /* 1816 */
     };
 
-    /* size of the table */
-    #define ERRTABLESIZE (SAL_N_ELEMENTS(errtable))
-
     /* The following two constants must be the minimum and maximum
     values in the (contiguous) range of osl_File_E_xec Failure errors. */
     #define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG
@@ -125,13 +122,11 @@ namespace
 
     oslFileError _mapError( DWORD dwError )
     {
-        unsigned i;
-
         /* check the table for the OS error code */
-        for ( i = 0; i < ERRTABLESIZE; ++i )
+        for ( const auto& entry : errtable )
         {
-            if ( dwError == errtable[i].oscode )
-                return static_cast<oslFileError>(errtable[i].errnocode);
+            if ( dwError == entry.oscode )
+                return static_cast<oslFileError>(entry.errnocode);
         }
 
         /* The error code wasn't in the table.  We check for a range of */

Reply via email to