Commit a201233b authored by Andrey Kamaev's avatar Andrey Kamaev

Fix warning in Android camera code

parent 36f91226
...@@ -169,8 +169,8 @@ CameraActivity::ErrorCode CameraWrapperConnector::connectToLib() ...@@ -169,8 +169,8 @@ CameraActivity::ErrorCode CameraWrapperConnector::connectToLib()
string folderPath = getPathLibFolder(); string folderPath = getPathLibFolder();
if (folderPath.empty()) if (folderPath.empty())
{ {
LOGD("Trying to find native camera in default OpenCV packages"); LOGD("Trying to find native camera in default OpenCV packages");
folderPath = getDefaultPathLibFolder(); folderPath = getDefaultPathLibFolder();
} }
LOGD("CameraWrapperConnector::connectToLib: folderPath=%s", folderPath.c_str()); LOGD("CameraWrapperConnector::connectToLib: folderPath=%s", folderPath.c_str());
...@@ -270,21 +270,21 @@ std::string CameraWrapperConnector::getDefaultPathLibFolder() ...@@ -270,21 +270,21 @@ std::string CameraWrapperConnector::getDefaultPathLibFolder()
const string packageList[] = {"tegra3", "armv7a_neon", "armv7a", "armv5", "x86"}; const string packageList[] = {"tegra3", "armv7a_neon", "armv7a", "armv5", "x86"};
for (size_t i = 0; i < 5; i++) for (size_t i = 0; i < 5; i++)
{ {
char path[128]; char path[128];
sprintf(path, "/data/data/org.opencv.lib_v%d%d_%s/lib/", CV_MAJOR_VERSION, CV_MINOR_VERSION, packageList[i].c_str()); sprintf(path, "/data/data/org.opencv.lib_v%d%d_%s/lib/", CV_MAJOR_VERSION, CV_MINOR_VERSION, packageList[i].c_str());
LOGD("Trying package \"%s\" (\"%s\")", packageList[i], path); LOGD("Trying package \"%s\" (\"%s\")", packageList[i].c_str(), path);
DIR* dir = opendir(path); DIR* dir = opendir(path);
if (!dir) if (!dir)
{ {
LOGD("Package not found"); LOGD("Package not found");
continue; continue;
} }
else else
{ {
closedir(dir); closedir(dir);
return path; return path;
} }
} }
return string(); return string();
...@@ -301,18 +301,18 @@ std::string CameraWrapperConnector::getPathLibFolder() ...@@ -301,18 +301,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
LOGD("Library name: %s", dl_info.dli_fname); LOGD("Library name: %s", dl_info.dli_fname);
LOGD("Library base address: %p", dl_info.dli_fbase); LOGD("Library base address: %p", dl_info.dli_fbase);
const char* libName=dl_info.dli_fname; const char* libName=dl_info.dli_fname;
while( ((*libName)=='/') || ((*libName)=='.') ) while( ((*libName)=='/') || ((*libName)=='.') )
libName++; libName++;
char lineBuf[2048]; char lineBuf[2048];
FILE* file = fopen("/proc/self/smaps", "rt"); FILE* file = fopen("/proc/self/smaps", "rt");
if(file) if(file)
{ {
while (fgets(lineBuf, sizeof lineBuf, file) != NULL) while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
{ {
//verify that line ends with library name //verify that line ends with library name
int lineLength = strlen(lineBuf); int lineLength = strlen(lineBuf);
int libNameLength = strlen(libName); int libNameLength = strlen(libName);
...@@ -325,7 +325,7 @@ std::string CameraWrapperConnector::getPathLibFolder() ...@@ -325,7 +325,7 @@ std::string CameraWrapperConnector::getPathLibFolder()
if (0 != strncmp(lineBuf + lineLength - libNameLength, libName, libNameLength)) if (0 != strncmp(lineBuf + lineLength - libNameLength, libName, libNameLength))
{ {
//the line does not contain the library name //the line does not contain the library name
continue; continue;
} }
...@@ -344,18 +344,18 @@ std::string CameraWrapperConnector::getPathLibFolder() ...@@ -344,18 +344,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
fclose(file); fclose(file);
return pathBegin; return pathBegin;
} }
fclose(file); fclose(file);
LOGE("Could not find library path"); LOGE("Could not find library path");
} }
else else
{ {
LOGE("Could not read /proc/self/smaps"); LOGE("Could not read /proc/self/smaps");
} }
} }
else else
{ {
LOGE("Could not get library name and base address"); LOGE("Could not get library name and base address");
} }
return string(); return string();
...@@ -429,7 +429,7 @@ int CameraActivity::getFrameWidth() ...@@ -429,7 +429,7 @@ int CameraActivity::getFrameWidth()
{ {
LOGD("CameraActivity::getFrameWidth()"); LOGD("CameraActivity::getFrameWidth()");
if (frameWidth <= 0) if (frameWidth <= 0)
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH); frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
return frameWidth; return frameWidth;
} }
...@@ -437,7 +437,7 @@ int CameraActivity::getFrameHeight() ...@@ -437,7 +437,7 @@ int CameraActivity::getFrameHeight()
{ {
LOGD("CameraActivity::getFrameHeight()"); LOGD("CameraActivity::getFrameHeight()");
if (frameHeight <= 0) if (frameHeight <= 0)
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT); frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
return frameHeight; return frameHeight;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment