[Libreoffice-commits] core.git: connectivity/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 22 02:05:22 PDT 2015


 connectivity/source/drivers/jdbc/Blob.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 9908b6447ebbeec16544bd61eca6f22f1ecefbaa
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