[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 23 09:18:58 UTC 2018


 sc/source/core/tool/interpr4.cxx |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

New commits:
commit ea20bc176cbf575e39c602a91dd3e6919b3fc31e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 22 18:49:40 2018 +0100

    USHRT_MAX -> SAL_MAX_UINT16
    
    ...that had presumably been forgotten when the surrounding code had been changed
    from USHORT to sal_uInt16 in cd42389ad67b403a07a0dda8e2a6e213def49251
    "removetooltypes01: #i112600# remove tooltypes from sc".  Plus, turning the
    preprocessor checks into static_asserts.
    
    Change-Id: I78271f7027af701699865913813d6dea8b0c570b
    Reviewed-on: https://gerrit.libreoffice.org/48358
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index bedeaa75c7c9..f08c09ce69eb 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -284,10 +284,8 @@ bool ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
 {
 
     // Old Add-Ins are hard limited to sal_uInt16 values.
-#if MAXCOLCOUNT_DEFINE > USHRT_MAX
-#error Add check for columns > USHRT_MAX!
-#endif
-    if (nRow1 > USHRT_MAX || nRow2 > USHRT_MAX)
+    static_assert(MAXCOLCOUNT <= SAL_MAX_UINT16, "Add check for columns > SAL_MAX_UINT16!");
+    if (nRow1 > SAL_MAX_UINT16 || nRow2 > SAL_MAX_UINT16)
         return false;
 
     sal_uInt16 nCount = 0;
@@ -369,10 +367,8 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
 {
 
     // Old Add-Ins are hard limited to sal_uInt16 values.
-#if MAXCOLCOUNT_DEFINE > USHRT_MAX
-#error Add check for columns > USHRT_MAX!
-#endif
-    if (nRow1 > USHRT_MAX || nRow2 > USHRT_MAX)
+    static_assert(MAXCOLCOUNT <= SAL_MAX_UINT16, "Add check for columns > SAL_MAX_UINT16!");
+    if (nRow1 > SAL_MAX_UINT16 || nRow2 > SAL_MAX_UINT16)
         return false;
 
     sal_uInt16 nCount = 0;
@@ -468,10 +464,8 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
 {
 
     // Old Add-Ins are hard limited to sal_uInt16 values.
-#if MAXCOLCOUNT_DEFINE > USHRT_MAX
-#error Add check for columns > USHRT_MAX!
-#endif
-    if (nRow1 > USHRT_MAX || nRow2 > USHRT_MAX)
+    static_assert(MAXCOLCOUNT <= SAL_MAX_UINT16, "Add check for columns > SAL_MAX_UINT16!");
+    if (nRow1 > SAL_MAX_UINT16 || nRow2 > SAL_MAX_UINT16)
         return false;
 
     sal_uInt16 nCount = 0;


More information about the Libreoffice-commits mailing list