summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-11-08 15:19:46 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-11-08 15:19:46 +0100
commitc22093c4ead0b89e13e38108c7da8d3b4a55c28c (patch)
tree687493987674dd2fbfab74b259ae5290e974324d
parent7a68c61f0f798dafa92c03a0ab053f695eb9ff3d (diff)
android: use int type for size in DirectBufferAllocator allocate
Change-Id: Ied2687d334f7d1ff9ff2f3cb6664848d50814b7c
-rw-r--r--desktop/source/lib/lokandroid.cxx16
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;