diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-11 14:35:36 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-11 14:35:36 +0200 |
commit | 68e1eb77c9ea2887ba4c113f307c764bc7a3eeef (patch) | |
tree | f768a63746ebe98de632b03a79a9f4c0524fed1b /svx | |
parent | 033bb0382354cdebec8262b54b0539a4b69d56f6 (diff) |
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
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/swframeposstrings.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
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]); } |