summaryrefslogtreecommitdiffstats
path: root/sal/cppunittester
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-12-10 11:00:10 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-12-10 11:00:10 +0100
commit72c2f30cbfde203a926b4acee5ed3d7ea9b9867e (patch)
treeaf132e6799f043d5515fcfa36f497d45a20506b9 /sal/cppunittester
parent-Wc++11-narrowing (diff)
downloadcore-72c2f30cbfde203a926b4acee5ed3d7ea9b9867e.tar.gz
core-72c2f30cbfde203a926b4acee5ed3d7ea9b9867e.zip
-Werror,-Wtautological-constant-out-of-range-compare
Change-Id: I99ae1590067d66f0af968833bc75d773ad3cb15c
Diffstat (limited to 'sal/cppunittester')
-rw-r--r--sal/cppunittester/cppunittester.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index e8584c1edcab..83623b529fd3 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -23,7 +23,6 @@
#include <cstdlib>
#include <iostream>
-#include <limits>
#include <string>
#include <sal/types.h>
#include "cppunittester/protectorfactory.hxx"
@@ -49,6 +48,7 @@
#include "boost/noncopyable.hpp"
#include "boost/ptr_container/ptr_vector.hpp"
+#include "boost/static_assert.hpp"
namespace {
@@ -68,12 +68,10 @@ rtl::OUString getArgument(sal_Int32 index) {
std::string convertLazy(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()));
}
//Output how long each test took