Tag: cws_dev300_dba31c User: fs Date: 2008-09-10 12:14:18+0000 Modified: dba/connectivity/source/drivers/jdbc/PreparedStatement.cxx
Log: #i92638# setBinaryStream: properly initialize the byte array with the *real* length of the sequence, not with the maximal length File Changes: Directory: /dba/connectivity/source/drivers/jdbc/ ================================================= File [changed]: PreparedStatement.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/PreparedStatement.cxx?r1=1.24&r2=1.24.64.1 Delta lines: +9 -8 ------------------- --- PreparedStatement.cxx 2008-04-10 09:27:11+0000 1.24 +++ PreparedStatement.cxx 2008-09-10 12:14:15+0000 1.24.64.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PreparedStatement.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.64.1 $ * * This file is part of OpenOffice.org. * @@ -695,14 +695,15 @@ mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!"); if( mID ) { - jvalue args2[3]; - jbyteArray pByteArray = t.pEnv->NewByteArray(length); Sequence< sal_Int8> aSeq; - x->readBytes(aSeq,length); - t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray()); + sal_Int32 actualLength = x->readBytes(aSeq,length); + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray(actualLength); + t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray()); args2[0].l = pByteArray; args2[1].i = 0; - args2[2].i = (sal_Int32)length; + args2[2].i = (sal_Int32)actualLength; // temporaere Variable initialisieren const char * cSignatureStream = "([BII)V"; @@ -714,7 +715,7 @@ jobject tempObj = NULL; if(mID2) tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); - t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)length); + t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength); // und aufraeumen t.pEnv->DeleteLocalRef(pByteArray); t.pEnv->DeleteLocalRef(tempObj); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]