[Libreoffice-commits] .: sal/cppunittester
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Dec 10 02:00:44 PST 2012
sal/cppunittester/cppunittester.cxx | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
New commits:
commit 72c2f30cbfde203a926b4acee5ed3d7ea9b9867e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Dec 10 11:00:10 2012 +0100
-Werror,-Wtautological-constant-out-of-range-compare
Change-Id: I99ae1590067d66f0af968833bc75d773ad3cb15c
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index e8584c1..83623b5 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
More information about the Libreoffice-commits
mailing list