aboutsummaryrefslogtreecommitdiff
path: root/java/android/OlmLibSdk
diff options
context:
space:
mode:
Diffstat (limited to 'java/android/OlmLibSdk')
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp29
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp28
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni.h10
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni_helper.cpp9
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp34
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp46
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp10
7 files changed, 86 insertions, 80 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp
index baa7939..c68e390 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp
@@ -37,7 +37,7 @@ OlmAccount* initializeAccountMemory()
if(NULL != (accountPtr=(OlmAccount*)malloc(accountSize)))
{ // init account object
accountPtr = olm_account(accountPtr);
- LOGD("## initializeAccountMemory(): success - OLM account size=%lu",accountSize);
+ LOGD("## initializeAccountMemory(): success - OLM account size=%lu",static_cast<long unsigned int>(accountSize));
}
else
{
@@ -107,7 +107,7 @@ JNIEXPORT jlong OLM_ACCOUNT_FUNC_DEF(initNewAccountJni)(JNIEnv *env, jobject thi
{
// get random buffer size
randomSize = olm_create_account_random_length(accountPtr);
- LOGD("## initNewAccount(): randomSize=%lu", randomSize);
+ LOGD("## initNewAccount(): randomSize=%lu", static_cast<long unsigned int>(randomSize));
// allocate random buffer
if((0!=randomSize) && !setRandomInBuffer(&randomBuffPtr, randomSize))
@@ -181,7 +181,7 @@ JNIEXPORT jbyteArray OLM_ACCOUNT_FUNC_DEF(identityKeysJni)(JNIEnv *env, jobject
else
{
env->SetByteArrayRegion(byteArrayRetValue, 0/*offset*/, identityKeysLength, (const jbyte*)identityKeysBytesPtr);
- LOGD("## identityKeys(): success - result=%ld", keysResult);
+ LOGD("## identityKeys(): success - result=%lu", static_cast<long unsigned int>(keysResult));
}
}
@@ -212,7 +212,7 @@ JNIEXPORT jlong OLM_ACCOUNT_FUNC_DEF(maxOneTimeKeys)(JNIEnv *env, jobject thiz)
{
maxKeys = olm_account_max_number_of_one_time_keys(accountPtr);
}
- LOGD("## maxOneTimeKey(): Max keys=%ld", maxKeys);
+ LOGD("## maxOneTimeKey(): Max keys=%lu", static_cast<long unsigned int>(maxKeys));
return (jlong)maxKeys;
}
@@ -238,7 +238,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(generateOneTimeKeys)(JNIEnv *env, jobject th
else
{ // keys memory allocation
randomLength = olm_account_generate_one_time_keys_random_length(accountPtr, (size_t)aNumberOfKeys);
- LOGD("## generateOneTimeKeys(): randomLength=%ld", randomLength);
+ LOGD("## generateOneTimeKeys(): randomLength=%lu", static_cast<long unsigned int>(randomLength));
if((0!=randomLength) && !setRandomInBuffer(&randomBufferPtr, randomLength))
{
@@ -256,7 +256,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(generateOneTimeKeys)(JNIEnv *env, jobject th
else
{
retCode = ERROR_CODE_OK;
- LOGD("## generateOneTimeKeys(): success - result=%ld", result);
+ LOGD("## generateOneTimeKeys(): success - result=%lu", static_cast<long unsigned int>(result));
}
}
}
@@ -386,7 +386,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(markOneTimeKeysAsPublishedJni)(JNIEnv *env,
}
else
{
- LOGD("## markOneTimeKeysAsPublishedJni(): success - retCode=%ld",result);
+ LOGD("## markOneTimeKeysAsPublishedJni(): success - retCode=%lu",static_cast<long unsigned int>(result));
}
}
@@ -429,7 +429,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(signMessageJni)(JNIEnv *env, jobject thiz
// signature memory allocation
signatureLength = olm_account_signature_length(accountPtr);
- if(NULL == (signedMsgPtr = (void*)malloc(signatureLength*sizeof(uint8_t))))
+ if(NULL == (signedMsgPtr = (void*)malloc((signatureLength+1)*sizeof(uint8_t))))
{
LOGE("## signMessageJni(): failure - signature allocation OOM");
}
@@ -446,10 +446,11 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(signMessageJni)(JNIEnv *env, jobject thiz
}
else
{
- // TODO check if signedMsgPtr needs to be null ended: signedMsgPtr[resultSign]='\0'
+ // info: signatureLength is always equal to resultSign
+ (static_cast<char*>(signedMsgPtr))[signatureLength] = static_cast<char>('\0');
// convert to jstring
signedMsgRetValue = env->NewStringUTF((const char*)signedMsgPtr); // UTF8
- LOGD("## signMessageJni(): success - retCode=%ld",resultSign);
+ LOGD("## signMessageJni(): success - retCode=%lu signatureLength=%lu", static_cast<long unsigned int>(resultSign), static_cast<long unsigned int>(signatureLength));
}
free(signedMsgPtr);
@@ -533,7 +534,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(serializeDataWithKeyJni)(JNIEnv *env, job
{
size_t pickledLength = olm_pickle_account_length(accountPtr);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## serializeDataWithKeyJni(): key=%s",(char const *)keyPtr);
if(NULL == (pickledPtr = (void*)malloc((pickledLength+1)*sizeof(uint8_t))))
@@ -562,7 +563,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(serializeDataWithKeyJni)(JNIEnv *env, job
// build success output
(static_cast<char*>(pickledPtr))[pickledLength] = static_cast<char>('\0');
pickledDataRetValue = env->NewStringUTF((const char*)pickledPtr);
- LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", result, static_cast<char*>(pickledPtr));
+ LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr));
}
}
}
@@ -616,7 +617,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(initWithSerializedDataJni)(JNIEnv *env, j
{
size_t pickledLength = (size_t)env->GetStringUTFLength(aSerializedData);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## initWithSerializedDataJni(): key=%s",(char const *)keyPtr);
LOGD(" ## initWithSerializedDataJni(): pickled=%s",(char const *)pickledPtr);
@@ -633,7 +634,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(initWithSerializedDataJni)(JNIEnv *env, j
}
else
{
- LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", result);
+ LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", static_cast<long unsigned int>(result));
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp
index 810d62c..20d8cb0 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp
@@ -27,7 +27,7 @@ JNIEXPORT void OLM_INBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *env
{
OlmInboundGroupSession* sessionPtr = NULL;
- LOGD("## releaseSessionJni(): intbound group session");
+ LOGD("## releaseSessionJni(): InBound group session IN");
if(NULL == (sessionPtr = (OlmInboundGroupSession*)getInboundGroupSessionInstanceId(env,thiz)))
{
@@ -38,7 +38,7 @@ JNIEXPORT void OLM_INBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *env
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
size_t retCode = olm_clear_inbound_group_session(sessionPtr);
- LOGI(" ## releaseSessionJni(): clear_inbound_group_session=%lu",retCode);
+ LOGI(" ## releaseSessionJni(): clear_inbound_group_session=%lu",static_cast<long unsigned int>(retCode));
LOGD(" ## releaseSessionJni(): free IN");
free(sessionPtr);
@@ -67,7 +67,7 @@ JNIEXPORT jlong OLM_INBOUND_GROUP_SESSION_FUNC_DEF(createNewSessionJni)(JNIEnv *
else if(NULL != (sessionPtr=(OlmInboundGroupSession*)malloc(sessionSize)))
{
sessionPtr = olm_inbound_group_session(sessionPtr);
- LOGD(" ## createNewSessionJni(): success - inbound group session size=%lu",sessionSize);
+ LOGD(" ## createNewSessionJni(): success - inbound group session size=%lu",static_cast<long unsigned int>(sessionSize));
}
else
{
@@ -106,7 +106,7 @@ JNIEXPORT jint OLM_INBOUND_GROUP_SESSION_FUNC_DEF(initInboundGroupSessionWithSes
else
{
size_t sessionKeyLength = (size_t)env->GetStringUTFLength(aSessionKey);
- LOGD(" ## initInboundSessionFromIdKeyJni(): sessionKeyLength=%lu",sessionKeyLength);
+ LOGD(" ## initInboundSessionFromIdKeyJni(): sessionKeyLength=%lu",static_cast<long unsigned int>(sessionKeyLength));
sessionResult = olm_init_inbound_group_session(sessionPtr, sessionKeyPtr, sessionKeyLength);
if(sessionResult == olm_error()) {
@@ -116,7 +116,7 @@ JNIEXPORT jint OLM_INBOUND_GROUP_SESSION_FUNC_DEF(initInboundGroupSessionWithSes
else
{
retCode = ERROR_CODE_OK;
- LOGD(" ## initInboundSessionFromIdKeyJni(): success - result=%lu", sessionResult);
+ LOGD(" ## initInboundSessionFromIdKeyJni(): success - result=%lu", static_cast<long unsigned int>(sessionResult));
}
}
@@ -149,7 +149,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(sessionIdentifierJni)(JNIEn
{
// get the size to alloc
size_t lengthSessionId = olm_inbound_group_session_id_length(sessionPtr);
- LOGD(" ## sessionIdentifierJni(): inbound group session lengthSessionId=%lu",lengthSessionId);
+ LOGD(" ## sessionIdentifierJni(): inbound group session lengthSessionId=%lu",static_cast<long unsigned int>(lengthSessionId));
if(NULL == (sessionIdPtr = (uint8_t*)malloc((lengthSessionId+1)*sizeof(uint8_t))))
{
@@ -166,7 +166,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(sessionIdentifierJni)(JNIEn
{
// update length
sessionIdPtr[result] = static_cast<char>('\0');
- LOGD(" ## sessionIdentifierJni(): success - inbound group session result=%lu sessionId=%s",result, (char*)sessionIdPtr);
+ LOGD(" ## sessionIdentifierJni(): success - inbound group session result=%lu sessionId=%s",static_cast<long unsigned int>(result), (char*)sessionIdPtr);
returnValueStr = env->NewStringUTF((const char*)sessionIdPtr);
}
free(sessionIdPtr);
@@ -212,7 +212,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *
else
{
memcpy(tempEncryptedPtr, encryptedMsgPtr, encryptedMsgLength);
- LOGD(" ## decryptMessageJni(): encryptedMsgLength=%lu encryptedMsg=%s",encryptedMsgLength,encryptedMsgPtr);
+ LOGD(" ## decryptMessageJni(): encryptedMsgLength=%lu encryptedMsg=%s",static_cast<long unsigned int>(encryptedMsgLength),encryptedMsgPtr);
// get max plaintext length
size_t maxPlainTextLength = olm_group_decrypt_max_plaintext_length(sessionPtr,
@@ -224,7 +224,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *
}
else
{
- LOGD(" ## decryptMessageJni(): maxPlaintextLength=%lu",maxPlainTextLength);
+ LOGD(" ## decryptMessageJni(): maxPlaintextLength=%lu",static_cast<long unsigned int>(maxPlainTextLength));
// allocate output decrypted message
plainTextMsgPtr = static_cast<uint8_t*>(malloc((maxPlainTextLength+1)*sizeof(uint8_t)));
@@ -245,7 +245,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *
// update decrypted buffer size
plainTextMsgPtr[plaintextLength] = static_cast<char>('\0');
- LOGD(" ## decryptMessageJni(): decrypted returnedLg=%lu plainTextMsgPtr=%s",plaintextLength, (char*)plainTextMsgPtr);
+ LOGD(" ## decryptMessageJni(): decrypted returnedLg=%lu plainTextMsgPtr=%s",static_cast<long unsigned int>(plaintextLength), (char*)plainTextMsgPtr);
decryptedMsgRetValue = env->NewStringUTF((const char*)plainTextMsgPtr);
}
}
@@ -318,7 +318,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(serializeDataWithKeyJni)(JN
{
size_t pickledLength = olm_pickle_inbound_group_session_length(sessionPtr);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu", static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## serializeDataWithKeyJni(): key=%s",(char const *)keyPtr);
if(NULL == (pickledPtr = (void*)malloc((pickledLength+1)*sizeof(uint8_t))))
@@ -347,7 +347,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(serializeDataWithKeyJni)(JN
// build success output
(static_cast<char*>(pickledPtr))[pickledLength] = static_cast<char>('\0');
pickledDataRetValue = env->NewStringUTF((const char*)pickledPtr);
- LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", result, static_cast<char*>(pickledPtr));
+ LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr));
}
}
}
@@ -400,7 +400,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(initWithSerializedDataJni)(
{
size_t pickledLength = (size_t)env->GetStringUTFLength(aSerializedData);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## initWithSerializedDataJni(): key=%s",(char const *)keyPtr);
LOGD(" ## initWithSerializedDataJni(): pickled=%s",(char const *)pickledPtr);
@@ -417,7 +417,7 @@ JNIEXPORT jstring OLM_INBOUND_GROUP_SESSION_FUNC_DEF(initWithSerializedDataJni)(
}
else
{
- LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", result);
+ LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", static_cast<long unsigned int>(result));
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni.h b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni.h
index bb718b6..16eb8b2 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni.h
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni.h
@@ -28,12 +28,18 @@
#define TAG "OlmJniNative"
/* logging macros */
-#define ENABLE_LOGS
+//#define ENABLE_LOGS
+
+#ifdef NDK_DEBUG
+ #warning "NDK_DEBUG is defined"
+#else
+ #warning "NDK_DEBUG not defined"
+#endif
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
-#ifdef ENABLE_LOGS
+#ifdef NDK_DEBUG
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#else
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni_helper.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni_helper.cpp
index 1f0c0df..5910c42 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni_helper.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_jni_helper.cpp
@@ -45,15 +45,12 @@ bool setRandomInBuffer(uint8_t **aBuffer2Ptr, size_t aRandomSize)
}
else
{
- LOGD("## setRandomInBuffer(): randomSize=%ld",aRandomSize);
+ LOGD("## setRandomInBuffer(): randomSize=%lu",static_cast<long unsigned int>(aRandomSize));
srand(time(NULL)); // init seed
for(size_t i=0;i<aRandomSize;i++)
{
(*aBuffer2Ptr)[i] = (uint8_t)(rand()%ACCOUNT_CREATION_RANDOM_MODULO);
-
- // debug purpose
- //LOGD("## setRandomInBuffer(): randomBuffPtr[%ld]=%d",i, (*aBuffer2Ptr)[i]);
}
retCode = true;
@@ -220,7 +217,7 @@ jstring serializeDataWithKey(JNIEnv *env, jobject thiz,
{
size_t pickledLength = aGetLengthFunc(accountPtr);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## serializeDataWithKeyJni(): key=%s",(char const *)keyPtr);
if(NULL == (pickledPtr = (void*)malloc((pickledLength+1)*sizeof(uint8_t))))
@@ -249,7 +246,7 @@ jstring serializeDataWithKey(JNIEnv *env, jobject thiz,
// build success output
(static_cast<char*>(pickledPtr))[pickledLength] = static_cast<char>('\0');
pickledDataRetValue = env->NewStringUTF((const char*)pickledPtr);
- LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", result, static_cast<char*>(pickledPtr));
+ LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr));
}
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp
index 8ccd78e..f7e6754 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp
@@ -27,7 +27,7 @@ JNIEXPORT void OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *en
{
OlmOutboundGroupSession* sessionPtr = NULL;
- LOGD("## releaseSessionJni(): outbound group session");
+ LOGD("## releaseSessionJni(): OutBound group session IN");
if(NULL == (sessionPtr = (OlmOutboundGroupSession*)getOutboundGroupSessionInstanceId(env,thiz)))
{
@@ -38,7 +38,7 @@ JNIEXPORT void OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *en
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
size_t retCode = olm_clear_outbound_group_session(sessionPtr);
- LOGI(" ## releaseSessionJni(): clear_outbound_group_session=%lu",retCode);
+ LOGI(" ## releaseSessionJni(): clear_outbound_group_session=%lu",static_cast<long unsigned int>(retCode));
LOGD(" ## releaseSessionJni(): free IN");
free(sessionPtr);
@@ -67,7 +67,7 @@ JNIEXPORT jlong OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(createNewSessionJni)(JNIEnv
else if(NULL != (sessionPtr=(OlmOutboundGroupSession*)malloc(sessionSize)))
{
sessionPtr = olm_outbound_group_session(sessionPtr);
- LOGD(" ## createNewSessionJni(): success - outbound group session size=%lu",sessionSize);
+ LOGD(" ## createNewSessionJni(): success - outbound group session size=%lu",static_cast<long unsigned int>(sessionSize));
}
else
{
@@ -97,7 +97,7 @@ JNIEXPORT jint OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(initOutboundGroupSessionJni)(
{
// compute random buffer
size_t randomLength = olm_init_outbound_group_session_random_length(sessionPtr);
- LOGW(" ## initOutboundGroupSessionJni(): randomLength=%lu",randomLength);
+ LOGW(" ## initOutboundGroupSessionJni(): randomLength=%lu",static_cast<long unsigned int>(randomLength));
if((0!=randomLength) && !setRandomInBuffer(&randomBuffPtr, randomLength))
{
LOGE(" ## initOutboundGroupSessionJni(): failure - random buffer init");
@@ -116,7 +116,7 @@ JNIEXPORT jint OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(initOutboundGroupSessionJni)(
else
{
retCode = ERROR_CODE_OK;
- LOGD(" ## initOutboundGroupSessionJni(): success - result=%lu", sessionResult);
+ LOGD(" ## initOutboundGroupSessionJni(): success - result=%lu", static_cast<long unsigned int>(sessionResult));
}
}
}
@@ -148,7 +148,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionIdentifierJni)(JNIE
{
// get the size to alloc
size_t lengthSessionId = olm_outbound_group_session_id_length(sessionPtr);
- LOGD(" ## sessionIdentifierJni(): outbound group session lengthSessionId=%lu",lengthSessionId);
+ LOGD(" ## sessionIdentifierJni(): outbound group session lengthSessionId=%lu",static_cast<long unsigned int>(lengthSessionId));
if(NULL == (sessionIdPtr = (uint8_t*)malloc((lengthSessionId+1)*sizeof(uint8_t))))
{
@@ -159,13 +159,13 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionIdentifierJni)(JNIE
size_t result = olm_outbound_group_session_id(sessionPtr, sessionIdPtr, lengthSessionId);
if (result == olm_error())
{
- LOGE(" ## sessionIdentifierJni(): failure - outbound group session identifier failure Msg=%s",(const char *)olm_outbound_group_session_last_error(sessionPtr));
+ LOGE(" ## sessionIdentifierJni(): failure - outbound group session identifier failure Msg=%s",reinterpret_cast<const char*>(olm_outbound_group_session_last_error(sessionPtr)));
}
else
{
// update length
sessionIdPtr[result] = static_cast<char>('\0');
- LOGD(" ## sessionIdentifierJni(): success - outbound group session identifier result=%lu sessionId=%s",result, (char*)sessionIdPtr);
+ LOGD(" ## sessionIdentifierJni(): success - outbound group session identifier result=%lu sessionId=%s",static_cast<long unsigned int>(result), reinterpret_cast<char*>(sessionIdPtr));
returnValueStr = env->NewStringUTF((const char*)sessionIdPtr);
}
@@ -224,7 +224,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionKeyJni)(JNIEnv *env
{
// get the size to alloc
size_t sessionKeyLength = olm_outbound_group_session_key_length(sessionPtr);
- LOGD(" ## sessionKeyJni(): sessionKeyLength=%lu",sessionKeyLength);
+ LOGD(" ## sessionKeyJni(): sessionKeyLength=%lu",static_cast<long unsigned int>(sessionKeyLength));
if(NULL == (sessionKeyPtr = (uint8_t*)malloc((sessionKeyLength+1)*sizeof(uint8_t))))
{
@@ -241,7 +241,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(sessionKeyJni)(JNIEnv *env
{
// update length
sessionKeyPtr[result] = static_cast<char>('\0');
- LOGD(" ## sessionKeyJni(): success - outbound group session key result=%lu sessionKey=%s",result, (char*)sessionKeyPtr);
+ LOGD(" ## sessionKeyJni(): success - outbound group session key result=%lu sessionKey=%s",static_cast<long unsigned int>(result), reinterpret_cast<char*>(sessionKeyPtr));
returnValueStr = env->NewStringUTF((const char*)sessionKeyPtr);
}
@@ -279,7 +279,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv
{
// get clear message length
size_t clearMsgLength = (size_t)env->GetStringUTFLength(aClearMsg);
- LOGD(" ## encryptMessageJni(): clearMsgLength=%lu",clearMsgLength);
+ LOGD(" ## encryptMessageJni(): clearMsgLength=%lu",static_cast<long unsigned int>(clearMsgLength));
// compute max encrypted length
size_t encryptedMsgLength = olm_group_encrypt_message_length(sessionPtr,clearMsgLength);
@@ -289,7 +289,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv
}
else
{
- LOGD(" ## encryptMessageJni(): estimated encryptedMsgLength=%lu",encryptedMsgLength);
+ LOGD(" ## encryptMessageJni(): estimated encryptedMsgLength=%lu",static_cast<long unsigned int>(encryptedMsgLength));
size_t encryptedLength = olm_group_encrypt(sessionPtr,
(uint8_t*)clearMsgPtr,
@@ -305,7 +305,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv
// update decrypted buffer size
encryptedMsgPtr[encryptedLength] = static_cast<char>('\0');
- LOGD(" ## encryptMessageJni(): encrypted returnedLg=%lu plainTextMsgPtr=%s",encryptedLength, (char*)encryptedMsgPtr);
+ LOGD(" ## encryptMessageJni(): encrypted returnedLg=%lu plainTextMsgPtr=%s",static_cast<long unsigned int>(encryptedLength), reinterpret_cast<char*>(encryptedMsgPtr));
encryptedMsgRetValue = env->NewStringUTF((const char*)encryptedMsgPtr);
}
}
@@ -372,7 +372,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(serializeDataWithKeyJni)(J
{
size_t pickledLength = olm_pickle_outbound_group_session_length(sessionPtr);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## serializeDataWithKeyJni(): key=%s",(char const *)keyPtr);
if(NULL == (pickledPtr = (void*)malloc((pickledLength+1)*sizeof(uint8_t))))
@@ -401,7 +401,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(serializeDataWithKeyJni)(J
// build success output
(static_cast<char*>(pickledPtr))[pickledLength] = static_cast<char>('\0');
pickledDataRetValue = env->NewStringUTF((const char*)pickledPtr);
- LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", result, static_cast<char*>(pickledPtr));
+ LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr));
}
}
}
@@ -454,7 +454,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(initWithSerializedDataJni)
{
size_t pickledLength = (size_t)env->GetStringUTFLength(aSerializedData);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## initWithSerializedDataJni(): key=%s",(char const *)keyPtr);
LOGD(" ## initWithSerializedDataJni(): pickled=%s",(char const *)pickledPtr);
@@ -471,7 +471,7 @@ JNIEXPORT jstring OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(initWithSerializedDataJni)
}
else
{
- LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", result);
+ LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", static_cast<long unsigned int>(result));
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
index cfa132c..c4460b3 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_session.cpp
@@ -31,7 +31,7 @@ OlmSession* initializeSessionMemory()
if(NULL != (sessionPtr=(OlmSession*)malloc(sessionSize)))
{ // init session object
sessionPtr = olm_session(sessionPtr);
- LOGD("## initializeSessionMemory(): success - OLM session size=%lu",sessionSize);
+ LOGD("## initializeSessionMemory(): success - OLM session size=%lu",static_cast<long unsigned int>(sessionSize));
}
else
{
@@ -54,6 +54,8 @@ JNIEXPORT void OLM_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *env, jobject thiz
{
OlmSession* sessionPtr = NULL;
+ LOGD("## releaseSessionJni(): IN");
+
if(NULL == (sessionPtr = (OlmSession*)getSessionInstanceId(env,thiz)))
{
LOGE("## releaseSessionJni(): failure - invalid Session ptr=NULL");
@@ -62,10 +64,8 @@ JNIEXPORT void OLM_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *env, jobject thiz
{
olm_clear_session(sessionPtr);
- LOGD("## releaseSessionJni(): IN");
// even if free(NULL) does not crash, logs are performed for debug purpose
free(sessionPtr);
- LOGD("## releaseSessionJni(): OUT");
}
}
@@ -131,7 +131,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initOutboundSessionJni)(JNIEnv *env, jobject
else
{ // allocate random buffer
size_t randomSize = olm_create_outbound_session_random_length(sessionPtr);
- LOGD("## initOutboundSessionJni(): randomSize=%lu",randomSize);
+ LOGD("## initOutboundSessionJni(): randomSize=%lu",static_cast<long unsigned int>(randomSize));
if((0!=randomSize) && !setRandomInBuffer(&randomBuffPtr, randomSize))
{
LOGE("## initOutboundSessionJni(): failure - random buffer init");
@@ -166,7 +166,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initOutboundSessionJni)(JNIEnv *env, jobject
else
{
retCode = ERROR_CODE_OK;
- LOGD("## initOutboundSessionJni(): success - result=%ld", sessionResult);
+ LOGD("## initOutboundSessionJni(): success - result=%lu", static_cast<long unsigned int>(sessionResult));
}
}
}
@@ -231,7 +231,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initInboundSessionJni)(JNIEnv *env, jobject
else
{
size_t messageLength = (size_t)env->GetStringUTFLength(aOneTimeKeyMsg);
- LOGD("## initInboundSessionJni(): messageLength=%lu message=%s", messageLength, messagePtr);
+ LOGD("## initInboundSessionJni(): messageLength=%lu message=%s", static_cast<long unsigned int>(messageLength), messagePtr);
sessionResult = olm_create_inbound_session(sessionPtr, accountPtr, (void*)messagePtr , messageLength);
if(sessionResult == olm_error()) {
@@ -240,7 +240,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initInboundSessionJni)(JNIEnv *env, jobject
else
{
retCode = ERROR_CODE_OK;
- LOGD("## initInboundSessionJni(): success - result=%ld", sessionResult);
+ LOGD("## initInboundSessionJni(): success - result=%lu", static_cast<long unsigned int>(sessionResult));
}
// free local alloc
@@ -296,7 +296,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initInboundSessionFromIdKeyJni)(JNIEnv *env,
size_t messageLength = (size_t)env->GetStringUTFLength(aOneTimeKeyMsg);
size_t theirIdentityKeyLength = (size_t)env->GetStringUTFLength(aTheirIdentityKey);
- LOGD("## initInboundSessionFromIdKeyJni(): message=%s messageLength=%lu",messagePtr,messageLength);
+ LOGD("## initInboundSessionFromIdKeyJni(): message=%s messageLength=%lu",messagePtr,static_cast<long unsigned int>(messageLength));
sessionResult = olm_create_inbound_session_from(sessionPtr, accountPtr, theirIdentityKeyPtr, theirIdentityKeyLength, (void*)messagePtr , messageLength);
if(sessionResult == olm_error()) {
@@ -305,7 +305,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(initInboundSessionFromIdKeyJni)(JNIEnv *env,
else
{
retCode = ERROR_CODE_OK;
- LOGD("## initInboundSessionFromIdKeyJni(): success - result=%ld", sessionResult);
+ LOGD("## initInboundSessionFromIdKeyJni(): success - result=%lu", static_cast<long unsigned int>(sessionResult));
}
}
@@ -357,7 +357,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(matchesInboundSessionJni)(JNIEnv *env, jobje
else
{
retCode = ERROR_CODE_OK;
- LOGD("## matchesInboundSessionJni(): success - result=%ld", matchResult);
+ LOGD("## matchesInboundSessionJni(): success - result=%lu", static_cast<long unsigned int>(matchResult));
}
}
@@ -417,7 +417,7 @@ JNIEXPORT jint JNICALL OLM_SESSION_FUNC_DEF(matchesInboundSessionFromIdKeyJni)(J
else
{
retCode = ERROR_CODE_OK;
- LOGD("## matchesInboundSessionFromIdKeyJni(): success - result=%lu", matchResult);
+ LOGD("## matchesInboundSessionFromIdKeyJni(): success - result=%lu", static_cast<long unsigned int>(matchResult));
}
}
@@ -492,7 +492,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz
// Note: olm_encrypt_random_length() can return 0, which means
// it just does not need new random data to encrypt a new message
size_t randomLength = olm_encrypt_random_length(sessionPtr);
- LOGD("## encryptMessageJni(): randomLength=%lu", randomLength);
+ LOGD("## encryptMessageJni(): randomLength=%lu", static_cast<long unsigned int>(randomLength));
if((0!=randomLength) && !setRandomInBuffer(&randomBuffPtr, randomLength))
{
LOGE("## encryptMessageJni(): failure - random buffer init");
@@ -513,7 +513,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz
LOGW("## encryptMessageJni(): random buffer is not required");
}
- LOGD("## encryptMessageJni(): messageType=%lu randomLength=%lu clearMsgLength=%lu encryptedMsgLength=%lu",messageType,randomLength, clearMsgLength, encryptedMsgLength);
+ LOGD("## encryptMessageJni(): messageType=%lu randomLength=%lu clearMsgLength=%lu encryptedMsgLength=%lu",static_cast<long unsigned int>(messageType),static_cast<long unsigned int>(randomLength), static_cast<long unsigned int>(clearMsgLength), static_cast<long unsigned int>(encryptedMsgLength));
// encrypt message
size_t result = olm_encrypt(sessionPtr,
(void const *)clearMsgPtr,
@@ -539,7 +539,7 @@ JNIEXPORT jint OLM_SESSION_FUNC_DEF(encryptMessageJni)(JNIEnv *env, jobject thiz
env->SetObjectField(aEncryptedMsg, encryptedMsgFieldId, (jobject)encryptedJstring);
retCode = ERROR_CODE_OK;
- LOGD("## encryptMessageJni(): success - result=%lu Type=%lu utfLength=%lu encryptedMsg=%s", result, messageType, (size_t)env->GetStringUTFLength(encryptedJstring), (const char*)encryptedMsgPtr);
+ LOGD("## encryptMessageJni(): success - result=%lu Type=%lu utfLength=%lu encryptedMsg=%s", static_cast<long unsigned int>(result), static_cast<long unsigned int>(messageType), static_cast<long unsigned int>((size_t)env->GetStringUTFLength(encryptedJstring)), (const char*)encryptedMsgPtr);
}
}
}
@@ -624,7 +624,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *env, jobject t
// create a dedicated temp buffer to be used in next Olm API calls
tempEncryptedPtr = static_cast<char*>(malloc(encryptedMsgLength*sizeof(uint8_t)));
memcpy(tempEncryptedPtr, encryptedMsgPtr, encryptedMsgLength);
- LOGD("## decryptMessageJni(): MsgType=%ld encryptedMsgLength=%lu encryptedMsg=%s",encryptedMsgType,encryptedMsgLength,encryptedMsgPtr);
+ LOGD("## decryptMessageJni(): MsgType=%lu encryptedMsgLength=%lu encryptedMsg=%s",static_cast<long unsigned int>(encryptedMsgType),static_cast<long unsigned int>(encryptedMsgLength),encryptedMsgPtr);
// get max plaintext length
size_t maxPlainTextLength = olm_decrypt_max_plaintext_length(sessionPtr,
@@ -639,7 +639,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *env, jobject t
}
else
{
- LOGD("## decryptMessageJni(): maxPlaintextLength=%lu",maxPlainTextLength);
+ LOGD("## decryptMessageJni(): maxPlaintextLength=%lu",static_cast<long unsigned int>(maxPlainTextLength));
// allocate output decrypted message
plainTextMsgPtr = static_cast<void*>(malloc((maxPlainTextLength+1)*sizeof(uint8_t)));
@@ -661,7 +661,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(decryptMessageJni)(JNIEnv *env, jobject t
// update decrypted buffer size
(static_cast<char*>(plainTextMsgPtr))[plaintextLength] = static_cast<char>('\0');
- LOGD("## decryptMessageJni(): decrypted returnedLg=%lu plainTextMsgPtr=%s",plaintextLength, static_cast<char*>(plainTextMsgPtr));
+ LOGD("## decryptMessageJni(): decrypted returnedLg=%lu plainTextMsgPtr=%s",static_cast<long unsigned int>(plaintextLength), static_cast<char*>(plainTextMsgPtr));
decryptedMsgRetValue = env->NewStringUTF(static_cast<const char*>(plainTextMsgPtr));
}
}
@@ -707,7 +707,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(getSessionIdentifierJni)(JNIEnv *env, job
{
// get the size to alloc to contain the id
size_t lengthSessionId = olm_session_id_length(sessionPtr);
- LOGD("## getSessionIdentifierJni(): lengthSessionId=%lu",lengthSessionId);
+ LOGD("## getSessionIdentifierJni(): lengthSessionId=%lu",static_cast<long unsigned int>(lengthSessionId));
if(NULL == (sessionIdPtr = (void*)malloc((lengthSessionId+1)*sizeof(uint8_t))))
{
@@ -726,7 +726,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(getSessionIdentifierJni)(JNIEnv *env, job
// update length
(static_cast<char*>(sessionIdPtr))[result] = static_cast<char>('\0');
- LOGD("## getSessionIdentifierJni(): success - result=%lu sessionId=%s",result, (char*)sessionIdPtr);
+ LOGD("## getSessionIdentifierJni(): success - result=%lu sessionId=%s",static_cast<long unsigned int>(result), (char*)sessionIdPtr);
returnValueStr = env->NewStringUTF((const char*)sessionIdPtr);
}
free(sessionIdPtr);
@@ -783,7 +783,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(serializeDataWithKeyJni)(JNIEnv *env, job
{
size_t pickledLength = olm_pickle_session_length(sessionPtr);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## serializeDataWithKeyJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## serializeDataWithKeyJni(): key=%s",(char const *)keyPtr);
if(NULL == (pickledPtr = (void*)malloc((pickledLength+1)*sizeof(uint8_t))))
@@ -812,7 +812,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(serializeDataWithKeyJni)(JNIEnv *env, job
// build success output
(static_cast<char*>(pickledPtr))[pickledLength] = static_cast<char>('\0');
pickledDataRetValue = env->NewStringUTF((const char*)pickledPtr);
- LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", result, static_cast<char*>(pickledPtr));
+ LOGD(" ## serializeDataWithKeyJni(): success - result=%lu pickled=%s", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr));
}
}
}
@@ -865,7 +865,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(initWithSerializedDataJni)(JNIEnv *env, j
{
size_t pickledLength = (size_t)env->GetStringUTFLength(aSerializedData);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
- LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",pickledLength, keyLength);
+ LOGD(" ## initWithSerializedDataJni(): pickledLength=%lu keyLength=%lu",static_cast<long unsigned int>(pickledLength), static_cast<long unsigned int>(keyLength));
LOGD(" ## initWithSerializedDataJni(): key=%s",(char const *)keyPtr);
LOGD(" ## initWithSerializedDataJni(): pickled=%s",(char const *)pickledPtr);
@@ -882,7 +882,7 @@ JNIEXPORT jstring OLM_SESSION_FUNC_DEF(initWithSerializedDataJni)(JNIEnv *env, j
}
else
{
- LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", result);
+ LOGD(" ## initWithSerializedDataJni(): success - result=%lu ", static_cast<long unsigned int>(result));
}
}
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
index e11f7eb..bd93de1 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_utility.cpp
@@ -26,7 +26,7 @@ OlmUtility* initializeUtilityMemory()
if(NULL != (utilityPtr=(OlmUtility*)malloc(utilitySize)))
{
utilityPtr = olm_utility(utilityPtr);
- LOGD("## initializeUtilityMemory(): success - OLM utility size=%lu",utilitySize);
+ LOGD("## initializeUtilityMemory(): success - OLM utility size=%lu",static_cast<long unsigned int>(utilitySize));
}
else
{
@@ -61,6 +61,8 @@ JNIEXPORT void OLM_UTILITY_FUNC_DEF(releaseUtilityJni)(JNIEnv *env, jobject thiz
{
OlmUtility* utilityPtr = NULL;
+ LOGD("## releaseUtilityJni(): IN");
+
if(NULL == (utilityPtr = (OlmUtility*)getUtilityInstanceId(env,thiz)))
{
LOGE("## releaseUtilityJni(): failure - utility ptr=NULL");
@@ -118,7 +120,7 @@ JNIEXPORT jstring OLM_UTILITY_FUNC_DEF(verifyEd25519SignatureJni)(JNIEnv *env, j
size_t signatureLength = (size_t)env->GetStringUTFLength(aSignature);
size_t keyLength = (size_t)env->GetStringUTFLength(aKey);
size_t messageLength = (size_t)env->GetStringUTFLength(aMessage);
- LOGD(" ## verifyEd25519SignatureJni(): signatureLength=%lu keyLength=%lu messageLength=%lu",signatureLength,keyLength,messageLength);
+ LOGD(" ## verifyEd25519SignatureJni(): signatureLength=%lu keyLength=%lu messageLength=%lu",static_cast<long unsigned int>(signatureLength),static_cast<long unsigned int>(keyLength),static_cast<long unsigned int>(messageLength));
size_t result = olm_ed25519_verify(utilityPtr,
(void const *)keyPtr,
@@ -134,7 +136,7 @@ JNIEXPORT jstring OLM_UTILITY_FUNC_DEF(verifyEd25519SignatureJni)(JNIEnv *env, j
}
else
{
- LOGD("## verifyEd25519SignatureJni(): success - result=%ld", result);
+ LOGD("## verifyEd25519SignatureJni(): success - result=%lu", static_cast<long unsigned int>(result));
}
}
@@ -210,7 +212,7 @@ JNIEXPORT jstring OLM_UTILITY_FUNC_DEF(sha256Jni)(JNIEnv *env, jobject thiz, jst
// update length
(static_cast<char*>(hashValuePtr))[result] = static_cast<char>('\0');
- LOGD("## sha256Jni(): success - result=%lu hashValue=%s",result, (char*)hashValuePtr);
+ LOGD("## sha256Jni(): success - result=%lu hashValue=%s",static_cast<long unsigned int>(result), (char*)hashValuePtr);
sha256RetValue = env->NewStringUTF((const char*)hashValuePtr);
}
}