summaryrefslogtreecommitdiff
path: root/sal/qa
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-06-02 11:27:42 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-06-02 11:27:42 +0200
commite60cea3c8d14c1146ed2855024872fecb0959f66 (patch)
tree213022ad44fe31ea4f55fcc874d7135d024207f1 /sal/qa
parent0fc8d8f6eba3ff49e7252fce661aa61dccfb3740 (diff)
loplugin:cstylecast: deal with those that are (technically) const_cast
Change-Id: Iad01e628b692a6dcf882696908de0ef1f24c04c4
Diffstat (limited to 'sal/qa')
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx8
-rw-r--r--sal/qa/rtl/strings/test_ostring_concat.cxx4
-rw-r--r--sal/qa/rtl/strings/test_ostring_stringliterals.cxx32
-rw-r--r--sal/qa/rtl/strings/test_oustring_concat.cxx4
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx2
5 files changed, 25 insertions, 25 deletions
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
index 5e6f099e21b5..2a18e35ec32c 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
@@ -91,13 +91,13 @@ void test::oustringbuffer::Utf32::appendUtf32() {
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ message.getStr(), res1 == rtl::OUString(str2, str2Len));
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.appendUtf32(0x10000);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *)message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ message.getStr(), res2 == rtl::OUString(str3, str3Len));
}
void test::oustringbuffer::Utf32::insertUtf32() {
@@ -113,13 +113,13 @@ void test::oustringbuffer::Utf32::insertUtf32() {
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ message.getStr(), res1 == rtl::OUString(str2, str2Len));
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.insertUtf32(2, 0x10FFFF);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ message.getStr(), res2 == rtl::OUString(str3, str3Len));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 4eb64d3e2278..0a54c96ae4e0 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -64,8 +64,8 @@ void test::ostring::StringConcat::checkConcat()
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringConcat< OString, const char[ 4 ] >, const char[ 4 ] > )), typeid( OString( "foo" ) + "bar" + "baz" ));
CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + "bar" ));
CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char[ 4 ] > )), typeid( OStringLiteral( "foo" ) + "bar" ));
- CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + (const char*)"bar" ));
- CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char* > )), typeid( OStringLiteral( "foo" ) + (const char*)"bar" ));
+ CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringLiteral( "foo" ) + static_cast<const char*>("bar") ));
+ CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringLiteral, const char* > )), typeid( OStringLiteral( "foo" ) + static_cast<const char*>("bar") ));
const char d1[] = "xyz";
char d2[] = "abc";
const char* d3 = d1;
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index af547ed8e9eb..d8acf446d804 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -62,7 +62,7 @@ void test::ostring::StringLiterals::checkCtors()
const char good1[] = "test";
CPPUNIT_ASSERT( CONST_CTOR_USED( good1 ));
- CPPUNIT_ASSERT( !CONST_CTOR_USED( (const char*) "test" ));
+ CPPUNIT_ASSERT( !CONST_CTOR_USED( static_cast<const char*>("test") ));
const char* bad1 = good1;
CPPUNIT_ASSERT( !CONST_CTOR_USED( bad1 ));
char bad2[] = "test";
@@ -88,8 +88,8 @@ void test::ostring::StringLiterals::checkCtors()
CPPUNIT_ASSERT( CONST_CTOR_USED( bad7[ 1 ] ));
// Check that contents are correct and equal to the case when const char* ctor is used.
- CPPUNIT_ASSERT( rtl::OString( (const char*)"" ) == rtl::OString( "" ));
- CPPUNIT_ASSERT( rtl::OString( (const char*)"ab" ) == rtl::OString( "ab" ));
+ CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("") ) == rtl::OString( "" ));
+ CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("ab") ) == rtl::OString( "ab" ));
// Check that contents are correct and equal to the case when RTL_CONSTASCII_STRINGPARAM is used.
CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "" )) == rtl::OString( "" ));
@@ -192,33 +192,33 @@ void test::ostring::StringLiterals::checkNonConstUsage()
rtl_string_unittest_const_literal = false; // start checking for OString conversions
rtl_string_unittest_const_literal_function = false; // and check for const variants
- CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = (const char*)foo_c );
+ CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = static_cast<const char*>(foo_c) );
CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = foo_c );
- CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( (const char*)fOo_c ));
+ CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( static_cast<const char*>(fOo_c) ));
CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( fOo_c ));
- CPPUNIT_ASSERT( foobarfoo.match( (const char*)bar_c, 3 ));
+ CPPUNIT_ASSERT( foobarfoo.match( static_cast<const char*>(bar_c), 3 ));
CPPUNIT_ASSERT( foobarfoo.match( bar_c, 3 ));
- CPPUNIT_ASSERT( foobar.match( (const char*)foo_c ));
+ CPPUNIT_ASSERT( foobar.match( static_cast<const char*>(foo_c) ));
CPPUNIT_ASSERT( foobar.match( foo_c ));
- CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( (const char*)bAr_c, 3 ));
+ CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( static_cast<const char*>(bAr_c), 3 ));
CPPUNIT_ASSERT( FooBaRfoo.matchIgnoreAsciiCase( bAr_c, 3 ));
- CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( (const char*)fOo_c ));
+ CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( static_cast<const char*>(fOo_c) ));
CPPUNIT_ASSERT( FooBaR.matchIgnoreAsciiCase( fOo_c ));
- CPPUNIT_ASSERT( foobar.startsWith( (const char*)foo_c ));
+ CPPUNIT_ASSERT( foobar.startsWith( static_cast<const char*>(foo_c) ));
CPPUNIT_ASSERT( foobar.startsWith( foo_c ));
- CPPUNIT_ASSERT( foobar.endsWith( (const char*)bar_c ));
+ CPPUNIT_ASSERT( foobar.endsWith( static_cast<const char*>(bar_c) ));
CPPUNIT_ASSERT( foobar.endsWith( bar_c ));
// CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( (const char*)bar_c ));
// CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( bar_c ));
- CPPUNIT_ASSERT( foo == (const char*)foo_c );
+ CPPUNIT_ASSERT( foo == static_cast<const char*>(foo_c) );
CPPUNIT_ASSERT( foo == foo_c );
- CPPUNIT_ASSERT( (const char*)foo_c == foo );
+ CPPUNIT_ASSERT( static_cast<const char*>(foo_c) == foo );
CPPUNIT_ASSERT( foo_c == foo );
- CPPUNIT_ASSERT( foo != (const char*)bar_c );
+ CPPUNIT_ASSERT( foo != static_cast<const char*>(bar_c) );
CPPUNIT_ASSERT( foo != bar_c );
- CPPUNIT_ASSERT( (const char*)foo_c != bar );
+ CPPUNIT_ASSERT( static_cast<const char*>(foo_c) != bar );
CPPUNIT_ASSERT( foo_c != bar );
- CPPUNIT_ASSERT( foobarfoo.indexOf( (const char*)foo_c, 1 ) == 6 );
+ CPPUNIT_ASSERT( foobarfoo.indexOf( static_cast<const char*>(foo_c), 1 ) == 6 );
CPPUNIT_ASSERT( foobarfoo.indexOf( foo_c, 1 ) == 6 );
// CPPUNIT_ASSERT( foobarfoo.lastIndexOf( (const char*)foo_c ) == 6 );
// CPPUNIT_ASSERT( foobarfoo.lastIndexOf( foo_c ) == 6 );
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index ab0e4e650543..f02bde560451 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -134,10 +134,10 @@ void test::oustring::StringConcat::checkInvalid()
CPPUNIT_ASSERT( !INVALID_CONCAT( OUString() + OUString()));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OString( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringBuffer( "b" )));
- CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + (const char*) "b" ));
+ CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<const char*>("b") ));
char d[] = "b";
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + d ));
- CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + (char*)d ));
+ CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast<char*>(d) ));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringLiteral( "b" )));
CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + 1 ));
rtl_String* rs = NULL;
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index a1261043ba10..9b85b314c85f 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -62,7 +62,7 @@ void test::oustring::StringLiterals::checkCtors()
const char good1[] = "test";
CPPUNIT_ASSERT( VALID_CONVERSION( good1 ));
- CPPUNIT_ASSERT( !VALID_CONVERSION( (const char*) "test" ));
+ CPPUNIT_ASSERT( !VALID_CONVERSION( static_cast<const char*>("test") ));
const char* bad1 = good1;
CPPUNIT_ASSERT( !VALID_CONVERSION( bad1 ));
char bad2[] = "test";