Code normalization problems fixed.

Rair hangs on library installation fixed.
This commit is contained in:
Alexander Smorkalov 2012-10-24 12:47:43 +04:00
parent 680fba7e0d
commit 293063eed3
12 changed files with 620 additions and 631 deletions

View File

@ -60,9 +60,7 @@ status_t BnOpenCVEngine::onTransact(uint32_t code, const Parcel& data, android::
int res = reply->writeInt32(static_cast<int32_t>(result));
LOGD("InstallVersion call to Binder finished with res %d", res);
return res;
} break;
default:
{
LOGD("OpenCVEngine unknown request");

View File

@ -13,7 +13,7 @@ int GetCpuID()
map<string, string> cpu_info = GetCpuInfo();
map<string, string>::const_iterator it;
#if defined(__i386__)
#if defined(__i386__)
LOGD("Using X86 HW detector");
result |= ARCH_X86;
it = cpu_info.find("flags");
@ -34,11 +34,11 @@ int GetCpuID()
}
}
#elif defined(__mips)
#ifdef __SUPPORT_MIPS
#ifdef __SUPPORT_MIPS
result |= ARCH_MIPS;
#else
#else
result = ARCH_UNKNOWN;
#endif
#endif
#else
LOGD("Using ARM HW detector");
it = cpu_info.find("Processor");
@ -103,7 +103,7 @@ int GetCpuID()
}
}
}
#endif
#endif
return result;
}
@ -174,8 +174,8 @@ int DetectKnownPlatforms()
// NOTE: Uncomment when all Tegras will be supported
/*if (tegra_status > 0)
{
return PLATFORM_TEGRA + tegra_status - 1;
* {
* return PLATFORM_TEGRA + tegra_status - 1;
}
else
{

View File

@ -173,24 +173,16 @@ bool OpenCVEngine::InstallVersion(android::String16 version)
std::string norm_version;
bool result = false;
LOGD("OpenCVEngine::InstallVersion() begin");
norm_version = NormalizeVersionString(std_version);
if (!norm_version.empty())
{
LOGD("OpenCVEngine::InstallVersion() begin");
if (!PackageManager->CheckVersionInstalled(norm_version, Platform, CpuID))
{
LOGD("PackageManager->InstallVersion call");
result = PackageManager->InstallVersion(norm_version, Platform, CpuID);
}
else
{
LOGI("Package OpenCV of version %s is already installed. Skiped.", norm_version.c_str());
result = true;
}
}
else
{
LOGE("OpenCV version \"%s\" is not supported", norm_version.c_str());
}

View File

@ -52,7 +52,6 @@ bool ParseString(const string& src, string& key, string& value)
set<string> SplitString(const string& src, const char seporator)
{
set<string> result;
if (!src.empty())

View File

@ -8,8 +8,8 @@
using namespace std;
JavaBasedPackageManager::JavaBasedPackageManager(JavaVM* JavaMashine, jobject MarketConnector):
JavaContext(JavaMashine),
JavaPackageManager(MarketConnector)
JavaContext(JavaMashine),
JavaPackageManager(MarketConnector)
{
assert(JavaContext);
assert(JavaPackageManager);

View File

@ -67,4 +67,3 @@ JNIEXPORT void JNICALL Java_org_opencv_engine_BinderConnector_Final(JNIEnv *, jo
delete PackageManager;
PackageManager = NULL;
}

View File

@ -41,7 +41,8 @@ bool CommonPackageManager::CheckVersionInstalled(const std::string& version, int
if (!packages.empty())
{
result = (packages.end() != find(packages.begin(), packages.end(), target_package));
vector<PackageInfo>::const_iterator it = find(packages.begin(), packages.end(), target_package);
result = (it != packages.end());
}
LOGD("CommonPackageManager::CheckVersionInstalled() end");
return result;

View File

@ -189,14 +189,14 @@ inline int SplitPlatfrom(const vector<string>& features)
* Example: armv7_neon, armv5_vfpv3
*/
PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::string install_path):
Version(version),
Platform(platform),
CpuID(cpu_id),
InstallPath("")
Version(version),
Platform(platform),
CpuID(cpu_id),
InstallPath("")
{
#ifndef __SUPPORT_TEGRA3
#ifndef __SUPPORT_TEGRA3
Platform = PLATFORM_UNKNOWN;
#endif
#endif
FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1);
if (PLATFORM_UNKNOWN != Platform)
{
@ -210,41 +210,41 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
{
LOGD("PackageInfo::PackageInfo: package arch x86");
FullName += string("_") + ARCH_X86_NAME;
#ifdef __SUPPORT_INTEL_FEATURES
#ifdef __SUPPORT_INTEL_FEATURES
string features = JoinIntelFeatures(CpuID);
if (!features.empty())
{
FullName += string("_") + features;
}
#endif
#endif
}
else if (ARCH_X64 & CpuID)
{
LOGD("PackageInfo::PackageInfo: package arch x64");
#ifdef __SUPPORT_INTEL_x64
#ifdef __SUPPORT_INTEL_x64
FullName += string("_") + ARCH_X64_NAME;
#else
#else
FullName += string("_") + ARCH_X86_NAME;
#endif
#ifdef __SUPPORT_INTEL_FEATURES
#endif
#ifdef __SUPPORT_INTEL_FEATURES
string features = JoinIntelFeatures(CpuID);
if (!features.empty())
{
FullName += string("_") + features;
}
#endif
#endif
}
else if (ARCH_ARMv5 & CpuID)
{
LOGD("PackageInfo::PackageInfo: package arch ARMv5");
FullName += string("_") + ARCH_ARMv5_NAME;
#ifdef __SUPPORT_ARMEABI_FEATURES
#ifdef __SUPPORT_ARMEABI_FEATURES
string features = JoinARMFeatures(CpuID);
if (!features.empty())
{
FullName += string("_") + features;
}
#endif
#endif
}
else if (ARCH_ARMv6 & CpuID)
{
@ -252,46 +252,46 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
// NOTE: ARM v5 used instead ARM v6
//FullName += string("_") + ARCH_ARMv6_NAME;
FullName += string("_") + ARCH_ARMv5_NAME;
#ifdef __SUPPORT_ARMEABI_FEATURES
#ifdef __SUPPORT_ARMEABI_FEATURES
string features = JoinARMFeatures(CpuID);
if (!features.empty())
{
FullName += string("_") + features;
}
#endif
#endif
}
else if (ARCH_ARMv7 & CpuID)
{
LOGD("PackageInfo::PackageInfo: package arch ARMv7");
FullName += string("_") + ARCH_ARMv7_NAME;
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
string features = JoinARMFeatures(CpuID);
if (!features.empty())
{
FullName += string("_") + features;
}
#endif
#endif
}
else if (ARCH_ARMv8 & CpuID)
{
LOGD("PackageInfo::PackageInfo: package arch ARMv8");
#ifdef __SUPPORT_ARMEABI_V8
#ifdef __SUPPORT_ARMEABI_V8
FullName += string("_") + ARCH_ARMv8_NAME;
#else
#else
FullName += string("_") + ARCH_ARMv7_NAME;
#endif
#endif
//string features = JoinARMFeatures(CpuID);
//if (!features.empty())
//{
// FullName += string("_") + features;
//}
}
#ifdef __SUPPORT_MIPS
#ifdef __SUPPORT_MIPS
else if (ARCH_MIPS & CpuID)
{
FullName += string("_") + ARCH_MIPS_NAME;
}
#endif
#endif
else
{
LOGD("PackageInfo::PackageInfo: package arch unknown");
@ -316,8 +316,8 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
}
PackageInfo::PackageInfo(const string& fullname, const string& install_path, string package_version):
FullName(fullname),
InstallPath(install_path)
FullName(fullname),
InstallPath(install_path)
{
LOGD("PackageInfo::PackageInfo(\"%s\", \"%s\", \"%s\")", fullname.c_str(), install_path.c_str(), package_version.c_str());
@ -424,12 +424,12 @@ PackageInfo::PackageInfo(const string& fullname, const string& install_path, str
{
CpuID = ARCH_X64 | SplitIntelFeatures(features);
}
#ifdef __SUPPORT_MIPS
#ifdef __SUPPORT_MIPS
else if (ARCH_MIPS_NAME == features[2])
{
CpuID = ARCH_MIPS;
}
#endif
#endif
else
{
LOGD("It is not OpenCV library package for this platform");

View File

@ -126,7 +126,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWNewVersion)
EXPECT_EQ(0, result.size());
}
#else
#else // armeabi
TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();