BUG: Fixed uninitialized variable when not building with windows console support.

This commit is contained in:
Brad King 2006-04-22 20:25:37 -04:00
parent 071e26712c
commit 415b16aab9

View File

@ -62,24 +62,23 @@ static void kwsysTerminalSetConsoleColor(HANDLE hOut,
void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...) void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
{ {
/* Setup the stream with the given color if possible. */ /* Setup the stream with the given color if possible. */
int pipeIsConsole; int pipeIsConsole = 0;
int pipeIsVT100; int pipeIsVT100 = 0;
int default_vt100 = color & kwsysTerminal_Color_AssumeTTY; int default_vt100 = color & kwsysTerminal_Color_AssumeTTY;
int default_tty = color & kwsysTerminal_Color_AssumeTTY; int default_tty = color & kwsysTerminal_Color_AssumeTTY;
#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) #if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
CONSOLE_SCREEN_BUFFER_INFO hOutInfo; CONSOLE_SCREEN_BUFFER_INFO hOutInfo;
HANDLE hOut = kwsysTerminalGetStreamHandle(stream); HANDLE hOut = kwsysTerminalGetStreamHandle(stream);
pipeIsConsole = GetConsoleScreenBufferInfo(hOut, &hOutInfo); if(GetConsoleScreenBufferInfo(hOut, &hOutInfo))
if(pipeIsConsole)
{ {
pipeIsConsole = 1;
kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream, color); kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream, color);
} }
#endif #endif
pipeIsVT100 = (!pipeIsConsole && if(!pipeIsConsole && kwsysTerminalStreamIsVT100(stream,
kwsysTerminalStreamIsVT100(stream, default_vt100, default_tty))
default_vt100, default_tty));
if(pipeIsVT100)
{ {
pipeIsVT100 = 1;
kwsysTerminalSetVT100Color(stream, color); kwsysTerminalSetVT100Color(stream, color);
} }