Commit d41fc3ab authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

fixed further cppcheck issues + MSVC12 warning

parent a7c1e91a
...@@ -1233,7 +1233,6 @@ std::vector<std::string> FileSystem::listSubDirectories(const std::string& direc ...@@ -1233,7 +1233,6 @@ std::vector<std::string> FileSystem::listSubDirectories(const std::string& direc
WIN32_FIND_DATA findFileData = {0}; WIN32_FIND_DATA findFileData = {0};
HANDLE hFind = 0; HANDLE hFind = 0;
std::stack<std::string> stackDirs;
std::string dir(converted + "\\*"); std::string dir(converted + "\\*");
hFind = FindFirstFile(dir.c_str(), &findFileData); hFind = FindFirstFile(dir.c_str(), &findFileData);
......
...@@ -380,6 +380,9 @@ void GpuCapabilities::detectOS() { ...@@ -380,6 +380,9 @@ void GpuCapabilities::detectOS() {
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
#pragma warning(push)
#pragma warning(disable:4996) // newer MSVC versions report GetVersionEx() to be deprecated, however the alternative is so poor design, I refuse to implement it... http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
if (!GetVersionEx((OSVERSIONINFO*)&osvi)) { if (!GetVersionEx((OSVERSIONINFO*)&osvi)) {
oss << "unknown: GetVersionEx() failed"; oss << "unknown: GetVersionEx() failed";
} }
...@@ -418,6 +421,7 @@ void GpuCapabilities::detectOS() { ...@@ -418,6 +421,7 @@ void GpuCapabilities::detectOS() {
} }
oss << " (build " << osvi.dwBuildNumber << ")"; oss << " (build " << osvi.dwBuildNumber << ")";
osVersionString_ = oss.str(); osVersionString_ = oss.str();
#pragma warning(pop)
#else // WIN32 -> must be UNIX/POSIX #else // WIN32 -> must be UNIX/POSIX
osVersion_ = OS_POSIX; osVersion_ = OS_POSIX;
......
...@@ -63,7 +63,6 @@ namespace campvis { ...@@ -63,7 +63,6 @@ namespace campvis {
tfp.parse<TextFileParser::ItemSeparatorLines>(); tfp.parse<TextFileParser::ItemSeparatorLines>();
// init optional parameters with sane default values // init optional parameters with sane default values
size_t dimensionality = 3;
tgt::svec3 size; tgt::svec3 size;
WeaklyTypedPointer::BaseType pt; WeaklyTypedPointer::BaseType pt;
...@@ -104,6 +103,7 @@ namespace campvis { ...@@ -104,6 +103,7 @@ namespace campvis {
// dimensionality and size // dimensionality and size
if (tfp.hasKey("CsvFileBaseName")) { if (tfp.hasKey("CsvFileBaseName")) {
size_t dimensionality = 3;
ImageData* image = new ImageData(dimensionality, size, 1); ImageData* image = new ImageData(dimensionality, size, 1);
ImageRepresentationLocal* rep = 0; ImageRepresentationLocal* rep = 0;
size_t index = 0; size_t index = 0;
......
...@@ -74,6 +74,7 @@ namespace campvis { ...@@ -74,6 +74,7 @@ namespace campvis {
throw tgt::FileException("Could not open file " + p_url.getValue() + " for reading.", p_url.getValue()); throw tgt::FileException("Could not open file " + p_url.getValue() + " for reading.", p_url.getValue());
std::string curLine = getTrimmedLine(file); std::string curLine = getTrimmedLine(file);
// cppcheck-suppress stlIfStrFind
if (curLine.find("# vtk DataFile Version") != 0) if (curLine.find("# vtk DataFile Version") != 0)
throw tgt::FileException("Unknown identifier in vtk file.", p_url.getValue()); throw tgt::FileException("Unknown identifier in vtk file.", p_url.getValue());
......
...@@ -155,9 +155,9 @@ namespace campvis { ...@@ -155,9 +155,9 @@ namespace campvis {
stepSize[5] = p_rotationStepSize.getValue(); stepSize[5] = p_rotationStepSize.getValue();
_opt->set_initial_step(stepSize); _opt->set_initial_step(stepSize);
double minf;
nlopt::result result = nlopt::SUCCESS; nlopt::result result = nlopt::SUCCESS;
try { try {
double minf;
result = _opt->optimize(x, minf); result = _opt->optimize(x, minf);
} }
catch (std::exception& e) { catch (std::exception& e) {
......
...@@ -228,15 +228,11 @@ namespace campvis { ...@@ -228,15 +228,11 @@ namespace campvis {
if (similarities.size() >= 3 && similarities2.size() >= 3) { if (similarities.size() >= 3 && similarities2.size() >= 3) {
float countRCP = 1.f / similarities[0]; float countRCP = 1.f / similarities[0];
float meanFixed = similarities[1] * countRCP;
float meanMoving = similarities[2] * countRCP;
float varFixed = (similarities2[1] - (similarities[2] * similarities[2]) * countRCP) * countRCP; float varFixed = (similarities2[1] - (similarities[2] * similarities[2]) * countRCP) * countRCP;
float _varMoving = (similarities2[0] - (similarities[1] * similarities[1]) * countRCP) * countRCP; float _varMoving = (similarities2[0] - (similarities[1] * similarities[1]) * countRCP) * countRCP;
float correlation = 0.0f; if (varFixed > 0.0f && _varMoving > 0.0f) {
if (varFixed > 0.0f && _varMoving > 0.0f) float correlation = (similarities2[2] - (similarities[1] * similarities[2]) * countRCP) * countRCP;
{
correlation = (similarities2[2] - (similarities[1] * similarities[2]) * countRCP) * countRCP;
toReturn = correlation / sqrt(varFixed * _varMoving); toReturn = correlation / sqrt(varFixed * _varMoving);
} }
} }
......
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