From 332d9d0c09c1f1f60bf970ea2b9a30cc95b9f5f5 Mon Sep 17 00:00:00 2001 From: pedroGitt Date: Sun, 23 Oct 2016 23:55:45 +0200 Subject: Add serialization for inbound group session - remove compiler warnings when logs are not enabled - new getInstanceId() function to refactor code --- .../OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_account.cpp') 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 1a1b360..baa7939 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 @@ -119,8 +119,7 @@ JNIEXPORT jlong OLM_ACCOUNT_FUNC_DEF(initNewAccountJni)(JNIEnv *env, jobject thi // create account accountRetCode = olm_create_account(accountPtr, (void*)randomBuffPtr, randomSize); if(accountRetCode == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGE("## initNewAccount(): failure - account creation failed Msg=%s", errorMsgPtr); + LOGE("## initNewAccount(): failure - account creation failed Msg=%s", (const char *)olm_account_last_error(accountPtr)); } LOGD("## initNewAccount(): success - OLM account created"); @@ -171,8 +170,7 @@ JNIEXPORT jbyteArray OLM_ACCOUNT_FUNC_DEF(identityKeysJni)(JNIEnv *env, jobject { // retrieve key pairs in identityKeysBytesPtr keysResult = olm_account_identity_keys(accountPtr, identityKeysBytesPtr, identityKeysLength); if(keysResult == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGE("## identityKeys(): failure - error getting identity keys Msg=%s",errorMsgPtr); + LOGE("## identityKeys(): failure - error getting identity keys Msg=%s",(const char *)olm_account_last_error(accountPtr)); } else { // allocate the byte array to be returned to java @@ -253,8 +251,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(generateOneTimeKeys)(JNIEnv *env, jobject th // retrieve key pairs in keysBytesPtr result = olm_account_generate_one_time_keys(accountPtr, (size_t)aNumberOfKeys, (void*)randomBufferPtr, randomLength); if(result == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGE("## generateOneTimeKeys(): failure - error generating one time keys Msg=%s",errorMsgPtr); + LOGE("## generateOneTimeKeys(): failure - error generating one time keys Msg=%s",(const char *)olm_account_last_error(accountPtr)); } else { @@ -302,8 +299,7 @@ JNIEXPORT jbyteArray OLM_ACCOUNT_FUNC_DEF(oneTimeKeysJni)(JNIEnv *env, jobject t { // retrieve key pairs in keysBytesPtr keysResult = olm_account_one_time_keys(accountPtr, keysBytesPtr, keysLength); if(keysResult == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGE("## oneTimeKeysJni(): failure - error getting one time keys Msg=%s",errorMsgPtr); + LOGE("## oneTimeKeysJni(): failure - error getting one time keys Msg=%s",(const char *)olm_account_last_error(accountPtr)); } else { // allocate the byte array to be returned to java @@ -351,8 +347,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(removeOneTimeKeysForSessionJni)(JNIEnv *env, result = olm_remove_one_time_keys(accountPtr, sessionPtr); if(result == olm_error()) { // the account doesn't have any matching "one time keys".. - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGW("## removeOneTimeKeysForSessionJni(): failure - removing one time keys Msg=%s",errorMsgPtr); + LOGW("## removeOneTimeKeysForSessionJni(): failure - removing one time keys Msg=%s",(const char *)olm_account_last_error(accountPtr)); retCode = ERROR_CODE_NO_MATCHING_ONE_TIME_KEYS; } @@ -386,8 +381,7 @@ JNIEXPORT jint OLM_ACCOUNT_FUNC_DEF(markOneTimeKeysAsPublishedJni)(JNIEnv *env, result = olm_account_mark_keys_as_published(accountPtr); if(result == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGW("## markOneTimeKeysAsPublishedJni(): failure - Msg=%s",errorMsgPtr); + LOGW("## markOneTimeKeysAsPublishedJni(): failure - Msg=%s",(const char *)olm_account_last_error(accountPtr)); retCode = ERROR_CODE_KO; } else @@ -448,8 +442,7 @@ JNIEXPORT jstring OLM_ACCOUNT_FUNC_DEF(signMessageJni)(JNIEnv *env, jobject thiz signatureLength); if(resultSign == olm_error()) { - const char *errorMsgPtr = olm_account_last_error(accountPtr); - LOGE("## signMessageJni(): failure - error signing message Msg=%s",errorMsgPtr); + LOGE("## signMessageJni(): failure - error signing message Msg=%s",(const char *)olm_account_last_error(accountPtr)); } else { -- cgit v1.2.3