summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-12-10 11:07:42 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-12-10 11:07:42 +0100
commitaaeba64fa50d92a219106dab10ad17d8c34fbfa3 (patch)
tree94ece10dfc52bd44a545ea19d749dffd36cfb2cc /unotest
parent72c2f30cbfde203a926b4acee5ed3d7ea9b9867e (diff)
-Werror,-Wtautological-constant-out-of-range-compare
Change-Id: I4356413b23fdbaaa1bf2e94ad7aed3ceed1f9261
Diffstat (limited to 'unotest')
-rw-r--r--unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
index b28e075f4ff3..3cd43f480cbd 100644
--- a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
+++ b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <limits>
#include <string>
#include <iostream>
#include "boost/noncopyable.hpp"
+#include "boost/static_assert.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "cppuhelper/exc_hlp.hxx"
@@ -39,12 +39,10 @@ namespace {
// Best effort conversion:
std::string convert(rtl::OUString const & s16) {
rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding()));
+ BOOST_STATIC_ASSERT(sizeof (sal_Int32) <= sizeof (std::string::size_type));
+ // ensure following cast is legitimate
return std::string(
- s8.getStr(),
- ((static_cast< sal_uInt32 >(s8.getLength())
- > std::numeric_limits< std::string::size_type >::max())
- ? std::numeric_limits< std::string::size_type >::max()
- : static_cast< std::string::size_type >(s8.getLength())));
+ s8.getStr(), static_cast< std::string::size_type >(s8.getLength()));
}
class Prot : public CppUnit::Protector, private boost::noncopyable