const_cast: convert some C-style casts and remove some redundant ones
Change-Id: If7e4e3cae1021529819e0b43ef334020ff8b7a43
This commit is contained in:
parent
69ebf1c01d
commit
d3d34a289b
@ -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( '-', '_' );
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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];
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user