summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:28:06 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:29 +0100
commitd3d34a289b78a54ee4047e7a042bb9b13a5a4c9a (patch)
tree84842f60c55f823bbf3dacbc19d7e820300e4484
parent69ebf1c01df31769ba806bb30947e127ec100772 (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: If7e4e3cae1021529819e0b43ef334020ff8b7a43
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/Blob.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx6
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx2
-rw-r--r--connectivity/source/drivers/kab/KDEInit.cxx2
-rw-r--r--connectivity/source/drivers/kab/KPreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx2
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
9 files changed, 11 insertions, 11 deletions
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index 90dac61982d4..5ce6c5c603d3 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -214,7 +214,7 @@ namespace connectivity
if( pSpec )
{
- aName = OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ),
+ aName = OStringToOUString( g_param_spec_get_name( const_cast<GParamSpec *>(pSpec) ),
RTL_TEXTENCODING_UTF8 );
aName = aName.replace( '-', '_' );
}
diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx
index c6a29bad8c80..c8bc79163141 100644
--- a/connectivity/source/drivers/jdbc/Blob.cxx
+++ b/connectivity/source/drivers/jdbc/Blob.cxx
@@ -114,7 +114,7 @@ sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequenc
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
// convert Parameter
jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength());
- t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray());
+ t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),pattern.getConstArray());
out = t.pEnv->CallLongMethod( object, mID, pByteArray,start );
t.pEnv->DeleteLocalRef(pByteArray);
ThrowSQLException(t.pEnv,*this);
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 5b14f1d52c2d..a132f1a96335 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -434,7 +434,7 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co
static jmethodID mID(NULL);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength());
- t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray());
+ t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),x.getConstArray());
t.pEnv->CallVoidMethod( object, mID, parameterIndex,pByteArray);
t.pEnv->DeleteLocalRef(pByteArray);
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
@@ -466,7 +466,7 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength );
- t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = actualLength;
@@ -516,7 +516,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray(actualLength);
- t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = (sal_Int32)actualLength;
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 7122937d5ca0..af3da44eafba 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -665,7 +665,7 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co
{
jbyteArray aArray = t.pEnv->NewByteArray(x.getLength());
- t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray());
+ t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),x.getConstArray());
// convert parameter
t.pEnv->CallVoidMethod( object, mID,columnIndex,aArray);
t.pEnv->DeleteLocalRef(aArray);
diff --git a/connectivity/source/drivers/kab/KDEInit.cxx b/connectivity/source/drivers/kab/KDEInit.cxx
index da6122dcf28e..3f86512f22e7 100644
--- a/connectivity/source/drivers/kab/KDEInit.cxx
+++ b/connectivity/source/drivers/kab/KDEInit.cxx
@@ -56,7 +56,7 @@ namespace connectivity
{
OSL_ENSURE(s_pKApplication == NULL, "KDEInit::Init: inconsistency in the application pointers!");
- char *kabargs[1] = {(char*)"libkab1"};
+ char *kabargs[1] = {const_cast<char*>("libkab1")};
KCmdLineArgs::init(1, kabargs, "KAddressBook", *kabargs, "Address Book driver", KAB_DRIVER_VERSION);
s_pKApplication = new KApplication(false, false);
diff --git a/connectivity/source/drivers/kab/KPreparedStatement.cxx b/connectivity/source/drivers/kab/KPreparedStatement.cxx
index b085b0543c3a..7157ad2439c6 100644
--- a/connectivity/source/drivers/kab/KPreparedStatement.cxx
+++ b/connectivity/source/drivers/kab/KPreparedStatement.cxx
@@ -74,7 +74,7 @@ void KabPreparedStatement::getNextParameter(OUString &rParameter) const throw(SQ
const OUString sError( aResources.getResourceString(
STR_INVALID_PARA_COUNT
) );
- ::dbtools::throwGenericSQLException(sError,*(KabPreparedStatement *) this);
+ ::dbtools::throwGenericSQLException(sError,*const_cast<KabPreparedStatement *>(this));
} // if (m_nParameterIndex >= (sal_Int32) (*m_aParameterRow).size())
rParameter = (m_aParameterRow->get())[m_nParameterIndex];
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 217b96687d7c..709378992749 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -559,7 +559,7 @@ void PreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
buf.append( "'" );
OString y = OUStringToOString( x, m_pSettings->encoding );
buf.ensureCapacity( y.getLength() * 2 + 2 );
- int len = PQescapeString( ((char*)buf.getStr())+1, y.getStr() , y.getLength() );
+ int len = PQescapeString( const_cast<char*>(buf.getStr())+1, y.getStr() , y.getLength() );
buf.setLength( 1 + len );
buf.append( "'" );
m_vars[parameterIndex-1] = buf.makeStringAndClear();
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 7971d883795f..5f08e9d0afd8 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -107,7 +107,7 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect
OString y = iOUStringToOString( value, settings );
OStringBuffer strbuf( y.getLength() * 2 + 2 );
int error;
- int len = PQescapeStringConn(settings->pConnection, ((char*)strbuf.getStr()), y.getStr() , y.getLength(), &error );
+ int len = PQescapeStringConn(settings->pConnection, const_cast<char*>(strbuf.getStr()), y.getStr() , y.getLength(), &error );
if ( error )
{
char *errstr = PQerrorMessage(settings->pConnection);
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 2c005160fae4..a2eab485d658 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1782,7 +1782,7 @@ OSQLParseNode* OSQLParseNode::getByRule(OSQLParseNode::Rule eRule) const
{
OSQLParseNode* pRetNode = 0;
if (isRule() && OSQLParser::RuleID(eRule) == getRuleID())
- pRetNode = (OSQLParseNode*)this;
+ pRetNode = const_cast<OSQLParseNode*>(this);
else
{
for (OSQLParseNodes::const_iterator i = m_aChildren.begin();