[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - connectivity/source
Rene Engelhard
rene at debian.org
Mon Jun 29 20:48:21 PDT 2015
connectivity/source/drivers/jdbc/Blob.cxx | 10 +++++
connectivity/source/drivers/jdbc/DatabaseMetaData.cxx | 10 +++++
connectivity/source/drivers/jdbc/PreparedStatement.cxx | 30 +++++++++++++++--
connectivity/source/drivers/jdbc/ResultSet.cxx | 10 +++++
4 files changed, 54 insertions(+), 6 deletions(-)
New commits:
commit 259159074f8cf010567efad26dd03dc52e909b31
Author: Rene Engelhard <rene at debian.org>
Date: Mon Jun 29 23:02:11 2015 +0200
more change in JNI func sigs between Java 6 and 7 workarounds
Change-Id: Ie9cbf1b6dfc79df3a74efd3b9bb31ce33e7be3a0
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index feadbce..8ad8635 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -1431,7 +1431,15 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern);
jintArray pArray = t.pEnv->NewIntArray(types.getLength());
- t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),reinterpret_cast<jint const *>(types.getConstArray()));
+ jint * typesData = reinterpret_cast<jint *>(
+ const_cast<sal_Int32 *>(types.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),typesData);
args[3].l = pArray;
out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index a132f1a..dd8f7d2 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -434,7 +434,15 @@ 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(),x.getConstArray());
+ jbyte * xData = reinterpret_cast<jbyte *>(
+ const_cast<sal_Int8 *>(x.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),xData);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,pByteArray);
t.pEnv->DeleteLocalRef(pByteArray);
ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
@@ -466,7 +474,15 @@ 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,aSeq.getConstArray());
+ jbyte * aSeqData = reinterpret_cast<jbyte *>(
+ const_cast<sal_Int8 *>(aSeq.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,aSeqData);
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = actualLength;
@@ -516,7 +532,15 @@ 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,aSeq.getConstArray());
+ jbyte * aSeqData = reinterpret_cast<jbyte *>(
+ const_cast<sal_Int8 *>(aSeq.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,aSeqData);
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 0ad6bb2..f854bab 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -665,7 +665,15 @@ 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(),x.getConstArray());
+ jbyte * xData = reinterpret_cast<jbyte *>(
+ const_cast<sal_Int8 *>(x.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),xData);
// convert parameter
t.pEnv->CallVoidMethod( object, mID,columnIndex,aArray);
t.pEnv->DeleteLocalRef(aArray);
commit b437336113ec123f6757e37a46d8dda2c3b4aaa1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jun 22 11:03:45 2015 +0200
Work around change in JNI func sigs between Java 6 and 7
(same as dfba745437324b8e1a352ab5280c665c543fc37f)
Change-Id: I3c79b406c2bf661717880def94989614860f9cb6
diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx
index c8bc791..43db9c1 100644
--- a/connectivity/source/drivers/jdbc/Blob.cxx
+++ b/connectivity/source/drivers/jdbc/Blob.cxx
@@ -114,7 +114,15 @@ 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(),pattern.getConstArray());
+ jbyte * patternData = reinterpret_cast<jbyte *>(
+ const_cast<sal_Int8 *>(pattern.getConstArray()));
+ // 4th param of Set*ArrayRegion changed from pointer to non-const to
+ // pointer to const between <http://docs.oracle.com/javase/6/docs/
+ // technotes/guides/jni/spec/functions.html#wp22933> and
+ // <http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/
+ // functions.html#wp22933>; work around that difference in a way
+ // that doesn't trigger loplugin:redundantcast
+ t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),patternData);
out = t.pEnv->CallLongMethod( object, mID, pByteArray,start );
t.pEnv->DeleteLocalRef(pByteArray);
ThrowSQLException(t.pEnv,*this);
More information about the Libreoffice-commits
mailing list