diff options
author | pedroGitt <pedro.contreiras@amdocs.com> | 2016-11-28 11:53:54 +0100 |
---|---|---|
committer | pedroGitt <pedro.contreiras@amdocs.com> | 2016-11-28 11:53:54 +0100 |
commit | 0263cd3039568bd5e5b374451efc0e37c2629592 (patch) | |
tree | d221ad6c0fd949fc04ec7ec7760247d0752f0799 | |
parent | d3d3024ea29384093bb91d530fa5ff98002e642b (diff) |
Remove un used code
3 files changed, 0 insertions, 114 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 9e6ed2a..c8c6e8a 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 @@ -18,12 +18,6 @@ using namespace AndroidOlmSdk; -/*jstring serializeDataWithKey(JNIEnv *env, jobject thiz, - jstring aKey, - jobject aErrorMsg, - olmPickleLengthFuncPtr<OlmAccount*> aGetLengthFunc, - olmPickleFuncPtr<OlmAccount*> aGetPickleFunc, - olmLastErrorFuncPtr<OlmAccount*> aGetLastErrorFunc);*/ /** * Init memory allocation for account creation. 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 a5cae46..d70dc58 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 @@ -62,19 +62,6 @@ namespace AndroidOlmSdk } -// function pointer templates -template<typename T> using olmPickleLengthFuncPtr = size_t (*)(T); -template<typename T> using olmPickleFuncPtr = size_t (*)(T, void const *, size_t, void *, size_t); -template<typename T> using olmLastErrorFuncPtr = const char* (*)(T); - -template <typename T> -jstring serializeDataWithKey(JNIEnv *env, jobject thiz, - jstring aKey, - jobject aErrorMsg, - olmPickleLengthFuncPtr<T> aGetLengthFunc, - olmPickleFuncPtr<T> aGetPickleFunc, - olmLastErrorFuncPtr<T> aGetLastErrorFunc); - #ifdef __cplusplus extern "C" { #endif 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 561010d..a0525dc 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 @@ -178,101 +178,6 @@ jlong getUtilityInstanceId(JNIEnv* aJniEnv, jobject aJavaObject) } -template <typename T> -jstring serializeDataWithKey(JNIEnv *env, jobject thiz, - jstring aKey, - jobject aErrorMsg, - olmPickleLengthFuncPtr<T> aGetLengthFunc, - olmPickleFuncPtr<T> aGetPickleFunc, - olmLastErrorFuncPtr<T> aGetLastErrorFunc) -{ - jstring pickledDataRetValue = 0; - jclass errorMsgJClass = 0; - jmethodID errorMsgMethodId = 0; - jstring errorJstring = 0; - const char *keyPtr = NULL; - void *pickledPtr = NULL; - T accountPtr = NULL; - - LOGD("## serializeDataWithKeyJni(): IN"); - - if(NULL == (accountPtr = (T)getAccountInstanceId(env,thiz))) - { - LOGE(" ## serializeDataWithKeyJni(): failure - invalid account ptr"); - } - else if(0 == aKey) - { - LOGE(" ## serializeDataWithKeyJni(): failure - invalid key"); - } - else if(0 == aErrorMsg) - { - LOGE(" ## serializeDataWithKeyJni(): failure - invalid error object"); - } - else if(0 == (errorMsgJClass = env->GetObjectClass(aErrorMsg))) - { - LOGE(" ## serializeDataWithKeyJni(): failure - unable to get error class"); - } - else if(0 == (errorMsgMethodId = env->GetMethodID(errorMsgJClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;"))) - { - LOGE(" ## serializeDataWithKeyJni(): failure - unable to get error method ID"); - } - else if(NULL == (keyPtr = env->GetStringUTFChars(aKey, 0))) - { - LOGE(" ## serializeDataWithKeyJni(): failure - keyPtr JNI allocation OOM"); - } - else - { - size_t pickledLength = aGetLengthFunc(accountPtr); - size_t keyLength = (size_t)env->GetStringUTFLength(aKey); - 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)))) - { - LOGE(" ## serializeDataWithKeyJni(): failure - pickledPtr buffer OOM"); - } - else - { - size_t result = aGetPickleFunc(accountPtr, - (void const *)keyPtr, - keyLength, - (void*)pickledPtr, - pickledLength); - if(result == olm_error()) - { - const char *errorMsgPtr = aGetLastErrorFunc(accountPtr); - LOGE(" ## serializeDataWithKeyJni(): failure - olm_pickle_account() Msg=%s",errorMsgPtr); - - if(0 != (errorJstring = env->NewStringUTF(errorMsgPtr))) - { - env->CallObjectMethod(aErrorMsg, errorMsgMethodId, errorJstring); - } - } - else - { - // 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", static_cast<long unsigned int>(result), static_cast<char*>(pickledPtr)); - } - } - } - - // free alloc - if(NULL != keyPtr) - { - env->ReleaseStringUTFChars(aKey, keyPtr); - } - - if(NULL != pickledPtr) - { - free(pickledPtr); - } - - return pickledDataRetValue; -} - - /** * Convert a C string into a UTF-8 format string. * The conversion is performed in JAVA side to workaround the issue in NewStringUTF(). |