summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-05-25 17:35:57 +0200
committerMichael Stahl <mstahl@redhat.com>2016-05-25 23:47:21 +0200
commit6b54253d4ff0c550a116fee87629ab5c32123af5 (patch)
treeef65ba3648f4952c8fa4c18bc9ae9f51495e77b5 /sw
parent386b284241a16d96eaf792e2385c41f57ce3d870 (diff)
sw: boost::numeric_cast not really ideal in core code
... since that can't handle exceptions particularly well anyway. Negative position would be a bug anyway, so assert() is appropriate. Change-Id: Ib246200b3c64ec049fa39835d922092d5a660f55
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/pch/precompiled_sw.hxx1
-rw-r--r--sw/source/core/tox/ToxWhitespaceStripper.cxx8
2 files changed, 4 insertions, 5 deletions
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index e085bbacea95..bcad79a6ee39 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -52,7 +52,6 @@
#include <unordered_map>
#include <utility>
#include <vector>
-#include <boost/numeric/conversion/cast.hpp>
#include <boost/optional.hpp>
#include <boost/optional/optional.hpp>
#include <boost/property_tree/json_parser.hpp>
diff --git a/sw/source/core/tox/ToxWhitespaceStripper.cxx b/sw/source/core/tox/ToxWhitespaceStripper.cxx
index c38079ce1731..9ea87c4e2ede 100644
--- a/sw/source/core/tox/ToxWhitespaceStripper.cxx
+++ b/sw/source/core/tox/ToxWhitespaceStripper.cxx
@@ -12,7 +12,6 @@
#include "rtl/ustrbuf.hxx"
#include "sal/log.hxx"
-#include <boost/numeric/conversion/cast.hpp>
namespace sw {
@@ -51,13 +50,14 @@ ToxWhitespaceStripper::ToxWhitespaceStripper(const OUString& inputString)
sal_Int32
ToxWhitespaceStripper::GetPositionInStrippedString(sal_Int32 pos) const
{
- size_t upos = boost::numeric_cast<size_t>(pos);
- if (upos >= mNewPositions.size()) {
+ assert(0 <= pos);
+ if (static_cast<size_t>(pos) >= mNewPositions.size()) {
+ // TODO probably this should assert, not just warn?
SAL_WARN("sw.core", "Requested position of TOX entry text which does not exist. "
"Maybe the formatting hint is corrupt?");
return mNewPositions.back();
}
- return mNewPositions.at(upos);
+ return mNewPositions.at(pos);
}