Kaydet (Commit) aaeba64f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

-Werror,-Wtautological-constant-out-of-range-compare

Change-Id: I4356413b23fdbaaa1bf2e94ad7aed3ceed1f9261
üst 72c2f30c
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment