Changed "writeData" to "WriteData" and modified to check for allocated buffer, and to free the buffer when done using it.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@1048 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
@@ -156,7 +156,7 @@ RCODE JNIBackupClient::WriteData(
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
jbyteArray jBuff;
|
||||
jbyteArray jBuff = NULL;
|
||||
void * pvBuff;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
@@ -172,11 +172,15 @@ RCODE JNIBackupClient::WriteData(
|
||||
}
|
||||
|
||||
Cls = pEnv->GetObjectClass( m_jClient);
|
||||
MId = pEnv->GetMethodID( Cls, "writeData", "([B)I");
|
||||
MId = pEnv->GetMethodID( Cls, "WriteData", "([B)I");
|
||||
|
||||
flmAssert( MId);
|
||||
|
||||
jBuff = pEnv->NewByteArray( (jsize)uiBytesToWrite);
|
||||
if ((jBuff = pEnv->NewByteArray( (jsize)uiBytesToWrite)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
goto Exit;
|
||||
}
|
||||
pvBuff = pEnv->GetPrimitiveArrayCritical(jBuff, NULL);
|
||||
f_memcpy(pvBuff, pvBuffer, uiBytesToWrite);
|
||||
pEnv->ReleasePrimitiveArrayCritical( jBuff, pvBuff, 0);
|
||||
@@ -188,6 +192,11 @@ RCODE JNIBackupClient::WriteData(
|
||||
|
||||
Exit:
|
||||
|
||||
if (jBuff)
|
||||
{
|
||||
pEnv->DeleteLocalRef( jBuff);
|
||||
}
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
|
||||
Reference in New Issue
Block a user