Merge pull request #242 from asmorkalov:manager_warning_fix

pull/243/merge
Andrey Kamaev 12 years ago committed by OpenCV Buildbot
commit 7c37f5d7de
  1. 4
      android/service/engine/jni/BinderComponent/OpenCVEngine.cpp
  2. 12
      android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
  3. 8
      android/service/engine/jni/NativeService/PackageInfo.cpp
  4. 2
      android/service/engine/jni/include/EngineCommon.h

@ -130,7 +130,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
LOGD("Trying to load info library \"%s\"", tmp.c_str()); LOGD("Trying to load info library \"%s\"", tmp.c_str());
void* handle; void* handle;
const char* (*info_func)(); InfoFunctionType info_func;
handle = dlopen(tmp.c_str(), RTLD_LAZY); handle = dlopen(tmp.c_str(), RTLD_LAZY);
if (handle) if (handle)
@ -138,7 +138,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
const char* error; const char* error;
dlerror(); dlerror();
*(void **) (&info_func) = dlsym(handle, "GetLibraryList"); info_func = (InfoFunctionType)dlsym(handle, "GetLibraryList");
if ((error = dlerror()) == NULL) if ((error = dlerror()) == NULL)
{ {
result = String16((*info_func)()); result = String16((*info_func)());

@ -24,12 +24,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
(JNIEnv* env, jobject, jlong handle) (JNIEnv* env, jobject, jlong handle)
{ {
const char* (*info_func)(); InfoFunctionType info_func;
const char* result; const char* result;
const char* error; const char* error;
dlerror(); dlerror();
*(void **) (&info_func) = dlsym((void*)handle, "GetPackageName"); info_func = (InfoFunctionType)dlsym((void*)handle, "GetPackageName");
if ((error = dlerror()) == NULL) if ((error = dlerror()) == NULL)
result = (*info_func)(); result = (*info_func)();
else else
@ -44,12 +44,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageNam
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(JNIEnv* env, jobject, jlong handle) (JNIEnv* env, jobject, jlong handle)
{ {
const char* (*info_func)(); InfoFunctionType info_func;
const char* result; const char* result;
const char* error; const char* error;
dlerror(); dlerror();
*(void **) (&info_func) = dlsym((void*)handle, "GetLibraryList"); info_func = (InfoFunctionType)dlsym((void*)handle, "GetLibraryList");
if ((error = dlerror()) == NULL) if ((error = dlerror()) == NULL)
result = (*info_func)(); result = (*info_func)();
else else
@ -64,12 +64,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryLis
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
(JNIEnv* env, jobject, jlong handle) (JNIEnv* env, jobject, jlong handle)
{ {
const char* (*info_func)(); InfoFunctionType info_func;
const char* result; const char* result;
const char* error; const char* error;
dlerror(); dlerror();
*(void **) (&info_func) = dlsym((void*)handle, "GetRevision"); info_func = (InfoFunctionType)dlsym((void*)handle, "GetRevision");
if ((error = dlerror()) == NULL) if ((error = dlerror()) == NULL)
result = (*info_func)(); result = (*info_func)();
else else

@ -342,8 +342,8 @@ InstallPath(install_path)
LOGD("Trying to load info library \"%s\"", tmp.c_str()); LOGD("Trying to load info library \"%s\"", tmp.c_str());
void* handle; void* handle;
const char* (*name_func)(); InfoFunctionType name_func;
const char* (*revision_func)(); InfoFunctionType revision_func;
handle = dlopen(tmp.c_str(), RTLD_LAZY); handle = dlopen(tmp.c_str(), RTLD_LAZY);
if (handle) if (handle)
@ -351,8 +351,8 @@ InstallPath(install_path)
const char* error; const char* error;
dlerror(); dlerror();
*(void **) (&name_func) = dlsym(handle, "GetPackageName"); name_func = (InfoFunctionType)dlsym(handle, "GetPackageName");
*(void **) (&revision_func) = dlsym(handle, "GetRevision"); revision_func = (InfoFunctionType)dlsym(handle, "GetRevision");
error = dlerror(); error = dlerror();
if (!error && revision_func && name_func) if (!error && revision_func && name_func)

@ -17,4 +17,6 @@
// Class name of OpenCV engine binder object. Is needned for connection to service // Class name of OpenCV engine binder object. Is needned for connection to service
#define OPECV_ENGINE_CLASSNAME "org.opencv.engine.OpenCVEngineInterface" #define OPECV_ENGINE_CLASSNAME "org.opencv.engine.OpenCVEngineInterface"
typedef const char* (*InfoFunctionType)();
#endif #endif
Loading…
Cancel
Save