Commit 5334f5ca authored by Jan Möbius's avatar Jan Möbius
Browse files

Some cppcheck fixes

parent b5a167d0
...@@ -116,27 +116,56 @@ ...@@ -116,27 +116,56 @@
if (AttachConsole(-1)) if (AttachConsole(-1))
{ {
//if the console was attached change stdinput and output //if the console was attached change stdinput and output
freopen("CONIN$", "r", stdin); FILE* check = freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout); if (check) {
freopen("CONOUT$", "w", stderr); std::cerr << "Error reopening stdin" << std::endl;
}
ckeck = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
} }
else else
{ {
//create and attach a new console if needed //create and attach a new console if needed
#ifndef NDEBUG #ifndef NDEBUG
//always open a console in debug mode //always open a console in debug mode
AllocConsole(); AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout); FILE* check = freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stderr); if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
ckeck = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
return; return;
#endif #endif
if (OpenFlipper::Options::logToConsole()) if (OpenFlipper::Options::logToConsole())
{ {
AllocConsole(); AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout); FILE* check = freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stderr); if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
ckeck = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
} }
} }
} }
......
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