Kaydet (Commit) 46ccb683 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: use int type for size in DirectBufferAllocator allocate

Change-Id: Ied2687d334f7d1ff9ff2f3cb6664848d50814b7c
üst a7e7e7d9
...@@ -190,16 +190,20 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs ...@@ -190,16 +190,20 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs
/* DirectBufferAllocator */ /* DirectBufferAllocator */
extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative
(JNIEnv* pEnv, jclass /*aClass*/, jlong nSize) (JNIEnv* pEnv, jclass /*aClass*/, jint nSize)
{ {
jobject aBuffer = NULL; jobject aBuffer = NULL;
void* pMemory = malloc(nSize);
if (pMemory != NULL) if (nSize > 0)
{ {
aBuffer = pEnv->NewDirectByteBuffer(pMemory, nSize); void* pMemory = malloc(nSize);
if (!aBuffer) if (pMemory != NULL)
{ {
free(pMemory); aBuffer = pEnv->NewDirectByteBuffer(pMemory, nSize);
if (aBuffer == NULL)
{
free(pMemory);
}
} }
} }
return aBuffer; return aBuffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment