From 71e7d444d8b1f82355596878bac0e274e948edb1 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Thu, 20 Dec 2012 12:28:30 +0400 Subject: [PATCH] All OpenCV Manager compiler warrnings fixed. --- .../engine/jni/BinderComponent/OpenCVEngine.cpp | 4 ++-- .../engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp | 12 ++++++------ .../service/engine/jni/NativeService/PackageInfo.cpp | 8 ++++---- android/service/engine/jni/include/EngineCommon.h | 2 ++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/android/service/engine/jni/BinderComponent/OpenCVEngine.cpp b/android/service/engine/jni/BinderComponent/OpenCVEngine.cpp index e08082004c..7cfe73ddfb 100644 --- a/android/service/engine/jni/BinderComponent/OpenCVEngine.cpp +++ b/android/service/engine/jni/BinderComponent/OpenCVEngine.cpp @@ -130,7 +130,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version) LOGD("Trying to load info library \"%s\"", tmp.c_str()); void* handle; - const char* (*info_func)(); + InfoFunctionType info_func; handle = dlopen(tmp.c_str(), RTLD_LAZY); if (handle) @@ -138,7 +138,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version) const char* error; dlerror(); - *(void **) (&info_func) = dlsym(handle, "GetLibraryList"); + info_func = (InfoFunctionType)dlsym(handle, "GetLibraryList"); if ((error = dlerror()) == NULL) { result = String16((*info_func)()); diff --git a/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp b/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp index c1cbccfe83..e7dc6d2f14 100644 --- a/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp +++ b/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp @@ -24,12 +24,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName (JNIEnv* env, jobject, jlong handle) { - const char* (*info_func)(); + InfoFunctionType info_func; const char* result; const char* error; dlerror(); - *(void **) (&info_func) = dlsym((void*)handle, "GetPackageName"); + info_func = (InfoFunctionType)dlsym((void*)handle, "GetPackageName"); if ((error = dlerror()) == NULL) result = (*info_func)(); else @@ -44,12 +44,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageNam JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList (JNIEnv* env, jobject, jlong handle) { - const char* (*info_func)(); + InfoFunctionType info_func; const char* result; const char* error; dlerror(); - *(void **) (&info_func) = dlsym((void*)handle, "GetLibraryList"); + info_func = (InfoFunctionType)dlsym((void*)handle, "GetLibraryList"); if ((error = dlerror()) == NULL) result = (*info_func)(); else @@ -64,12 +64,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryLis JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName (JNIEnv* env, jobject, jlong handle) { - const char* (*info_func)(); + InfoFunctionType info_func; const char* result; const char* error; dlerror(); - *(void **) (&info_func) = dlsym((void*)handle, "GetRevision"); + info_func = (InfoFunctionType)dlsym((void*)handle, "GetRevision"); if ((error = dlerror()) == NULL) result = (*info_func)(); else diff --git a/android/service/engine/jni/NativeService/PackageInfo.cpp b/android/service/engine/jni/NativeService/PackageInfo.cpp index 1f4878f972..396178d5dc 100644 --- a/android/service/engine/jni/NativeService/PackageInfo.cpp +++ b/android/service/engine/jni/NativeService/PackageInfo.cpp @@ -342,8 +342,8 @@ InstallPath(install_path) LOGD("Trying to load info library \"%s\"", tmp.c_str()); void* handle; - const char* (*name_func)(); - const char* (*revision_func)(); + InfoFunctionType name_func; + InfoFunctionType revision_func; handle = dlopen(tmp.c_str(), RTLD_LAZY); if (handle) @@ -351,8 +351,8 @@ InstallPath(install_path) const char* error; dlerror(); - *(void **) (&name_func) = dlsym(handle, "GetPackageName"); - *(void **) (&revision_func) = dlsym(handle, "GetRevision"); + name_func = (InfoFunctionType)dlsym(handle, "GetPackageName"); + revision_func = (InfoFunctionType)dlsym(handle, "GetRevision"); error = dlerror(); if (!error && revision_func && name_func) diff --git a/android/service/engine/jni/include/EngineCommon.h b/android/service/engine/jni/include/EngineCommon.h index 8aa99f8c94..2bee139ea3 100644 --- a/android/service/engine/jni/include/EngineCommon.h +++ b/android/service/engine/jni/include/EngineCommon.h @@ -17,4 +17,6 @@ // Class name of OpenCV engine binder object. Is needned for connection to service #define OPECV_ENGINE_CLASSNAME "org.opencv.engine.OpenCVEngineInterface" +typedef const char* (*InfoFunctionType)(); + #endif \ No newline at end of file