svx/source/dialog/swframeposstrings.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 68e1eb77c9ea2887ba4c113f307c764bc7a3eeef
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Mon Sep 11 14:35:36 2017 +0200

    Clean up SvxSwFramePosString::GetString
    
    ...after 2687a5aca143c53c364cb44993ca601b8dd1c65e
    "-Werror,-Wtautological-compare with latest clang".  Even with a compiler 
that
    chose int as the underlying type of StringId, eId could only be negative 
after
    UB has happened elsewhere, but nevertheless keep checking for it in the 
assert
    (which is a macro in which -Wtautological-compare is apparently disabled 
with
    recent Clang trunk at least).
    
    Change-Id: I448c6d48e9f84ef84089f4735776b6a66599dc67

diff --git a/svx/source/dialog/swframeposstrings.cxx 
b/svx/source/dialog/swframeposstrings.cxx
index d2e9c8e05ab0..3c667bc1f71a 100644
--- a/svx/source/dialog/swframeposstrings.cxx
+++ b/svx/source/dialog/swframeposstrings.cxx
@@ -17,19 +17,23 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <cassert>
+
 #include <svx/swframeposstrings.hxx>
 #include <tools/resary.hxx>
-#include <tools/debug.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/strings.hrc>
 #include "swframeposstrings.hrc"
 
 OUString SvxSwFramePosString::GetString(StringId eId)
 {
-    assert(SAL_N_ELEMENTS(RID_SVXSW_FRAMEPOSITIONS) == 
SvxSwFramePosString::STR_MAX);
-    DBG_ASSERT(eId >= 0 && eId < STR_MAX, "invalid StringId");
-    if(!(eId < STR_MAX))
-        eId = LEFT;
+    static_assert(
+        (SAL_N_ELEMENTS(RID_SVXSW_FRAMEPOSITIONS)
+         == SvxSwFramePosString::STR_MAX),
+        "RID_SVXSW_FRAMEPOSITIONS too small");
+    assert(eId >= 0 && eId < STR_MAX);
     return SvxResId(RID_SVXSW_FRAMEPOSITIONS[eId]);
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to