diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-11-08 15:19:46 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-04 23:04:26 +0100 |
commit | 46ccb683a3b7c23d09e2e813b9d5c92b98b831c4 (patch) | |
tree | 333a921aa1d12f2fedfe625ccf095ba12bf67d35 | |
parent | a7e7e7d99c5f0ab7dae711cf54d5359e0e567605 (diff) |
android: use int type for size in DirectBufferAllocator allocate
Change-Id: Ied2687d334f7d1ff9ff2f3cb6664848d50814b7c
-rw-r--r-- | desktop/source/lib/lokandroid.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 15c41c444cb1..a6f02d6f74f3 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -190,16 +190,20 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs /* DirectBufferAllocator */ 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; - void* pMemory = malloc(nSize); - if (pMemory != NULL) + + if (nSize > 0) { - aBuffer = pEnv->NewDirectByteBuffer(pMemory, nSize); - if (!aBuffer) + void* pMemory = malloc(nSize); + if (pMemory != NULL) { - free(pMemory); + aBuffer = pEnv->NewDirectByteBuffer(pMemory, nSize); + if (aBuffer == NULL) + { + free(pMemory); + } } } return aBuffer; |