Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
5334f5ca
Commit
5334f5ca
authored
Oct 24, 2016
by
Jan Möbius
Browse files
Some cppcheck fixes
parent
b5a167d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
OpenFlipper.cc
View file @
5334f5ca
...
...
@@ -111,35 +111,64 @@
#ifdef WIN32
void
attachConsole
()
{
//try to attach the console of the parent process
if
(
AttachConsole
(
-
1
))
{
//if the console was attached change stdinput and output
freopen
(
"CONIN$"
,
"r"
,
stdin
);
freopen
(
"CONOUT$"
,
"w"
,
stdout
);
freopen
(
"CONOUT$"
,
"w"
,
stderr
);
}
else
{
//create and attach a new console if needed
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole
();
freopen
(
"CONIN$"
,
"r"
,
stdin
);
freopen
(
"CONOUT$"
,
"w"
,
stdout
);
freopen
(
"CONOUT$"
,
"w"
,
stderr
);
return
;
#endif
if
(
OpenFlipper
::
Options
::
logToConsole
())
{
AllocConsole
();
freopen
(
"CONIN$"
,
"r"
,
stdin
);
freopen
(
"CONOUT$"
,
"w"
,
stdout
);
freopen
(
"CONOUT$"
,
"w"
,
stderr
);
}
}
}
{
//try to attach the console of the parent process
if
(
AttachConsole
(
-
1
))
{
//if the console was attached change stdinput and output
FILE
*
check
=
freopen
(
"CONIN$"
,
"r"
,
stdin
);
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
;
}
}
else
{
//create and attach a new console if needed
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole
();
FILE
*
check
=
freopen
(
"CONIN$"
,
"r"
,
stdin
);
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
;
#endif
if
(
OpenFlipper
::
Options
::
logToConsole
())
{
AllocConsole
();
FILE
*
check
=
freopen
(
"CONIN$"
,
"r"
,
stdin
);
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
;
}
}
}
}
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment