summaryrefslogtreecommitdiff
path: root/sal
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
parent0fc8d8f6eba3ff49e7252fce661aa61dccfb3740 (diff)
loplugin:cstylecast: deal with those that are (technically) const_cast
Change-Id: Iad01e628b692a6dcf882696908de0ef1f24c04c4
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/module.cxx4
-rw-r--r--sal/osl/unx/mutex.cxx2
-rw-r--r--sal/osl/unx/process.cxx2
-rw-r--r--sal/osl/unx/socket.cxx4
-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
-rw-r--r--sal/textenc/tencinfo.cxx6
-rw-r--r--sal/textenc/textcvt.cxx4
11 files changed, 36 insertions, 36 deletions
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index ca3318fad449..65e00570f4a1 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -161,7 +161,7 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
"dlopen(" << pModuleName << ", " << rtld_mode << "): "
<< dlerror());
#endif
- return ((oslModule)(pLib));
+ return pLib;
}
return NULL;
}
@@ -206,7 +206,7 @@ sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *, oslModule *pResult)
{
#if !defined(DISABLE_DYNLOADING) || defined(IOS)
- *pResult = (oslModule) RTLD_DEFAULT;
+ *pResult = static_cast<oslModule>(RTLD_DEFAULT);
#else
*pResult = NULL;
#endif
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 515a2edb9102..bc51fbac498f 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -163,7 +163,7 @@ static void globalMutexInitImpl() {
oslMutex * SAL_CALL osl_getGlobalMutex()
{
/* necessary to get a "oslMutex *" */
- static oslMutex globalMutex = (oslMutex) &globalMutexImpl;
+ static oslMutex globalMutex = &globalMutexImpl;
static pthread_once_t once = PTHREAD_ONCE_INIT;
if (pthread_once(&once, &globalMutexInitImpl) != 0) {
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index af4e59e73429..1198e73eebed 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -240,7 +240,7 @@ static void ChildStatusProc(void *pData)
// No need to check the return value of execv. If we return from
// it, an error has occurred.
- execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
+ execv(data.m_pszArgs[0], const_cast<char **>(data.m_pszArgs));
}
OSL_TRACE("Failed to exec, errno=%d (%s)", errno, strerror(errno));
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 6aba809bce4f..2bc7217cd13a 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -460,7 +460,7 @@ oslSocket __osl_createSocketImpl(int Socket)
void __osl_destroySocketImpl(oslSocket Socket)
{
if ( Socket != NULL)
- free((struct oslSocketImpl *) Socket);
+ free(Socket);
#if OSL_DEBUG_LEVEL > 1
g_nSocketImpl --;
#endif
@@ -2353,7 +2353,7 @@ oslSocketSet SAL_CALL osl_createSocketSet()
FD_ZERO(&pSet->m_Set);
}
- return (oslSocketSet)pSet;
+ return pSet;
}
void SAL_CALL osl_destroySocketSet(oslSocketSet Set)
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";
diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx
index 381b2f0a21e7..192619dbab41 100644
--- a/sal/textenc/tencinfo.cxx
+++ b/sal/textenc/tencinfo.cxx
@@ -793,9 +793,9 @@ const char* SAL_CALL rtl_getBestUnixCharsetFromTextEncoding( rtl_TextEncoding eT
{
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
- return (char const *) pData->mpBestUnixCharset;
+ return pData->mpBestUnixCharset;
else if( eTextEncoding == RTL_TEXTENCODING_UNICODE )
- return (char const *) "iso10646-1";
+ return "iso10646-1";
else
return 0;
}
@@ -814,7 +814,7 @@ const char* SAL_CALL rtl_getBestMimeCharsetFromTextEncoding( rtl_TextEncoding eT
{
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
- return (char const *) pData->mpBestMimeCharset;
+ return pData->mpBestMimeCharset;
else
return 0;
}
diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx
index a11483f0a54f..6292e244a151 100644
--- a/sal/textenc/textcvt.cxx
+++ b/sal/textenc/textcvt.cxx
@@ -125,7 +125,7 @@ rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnic
if ( !pConverter )
return 0;
else if ( pConverter->mpCreateTextToUnicodeContext )
- return (rtl_TextToUnicodeContext)pConverter->mpCreateTextToUnicodeContext();
+ return pConverter->mpCreateTextToUnicodeContext();
else
return reinterpret_cast<rtl_TextToUnicodeContext>(1);
}
@@ -203,7 +203,7 @@ rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToT
if ( !pConverter )
return 0;
else if ( pConverter->mpCreateUnicodeToTextContext )
- return (rtl_UnicodeToTextContext)pConverter->mpCreateUnicodeToTextContext();
+ return pConverter->mpCreateUnicodeToTextContext();
else
return reinterpret_cast<rtl_UnicodeToTextContext>(1);
}