Skip to content

Commit

Permalink
wup
Browse files Browse the repository at this point in the history
  • Loading branch information
aklomp committed Jan 28, 2024
1 parent d8cc0bd commit c6c2b61
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/base64.c
Expand Up @@ -360,26 +360,26 @@ static bool
encode (const struct config *config, struct buffer *buf)
{
#ifdef WIN
DWORD fdwMode;
DWORD fdwMode = {};

// Get the standard output handle.
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);

// Check for errors.
if (hStdout == INVALID_HANDLE_VALUE) {
fprintf(stderr, "GetStdHandle: %d\n", GetLastError());
fprintf(stderr, "GetStdHandle: err#%d\n", GetLastError());
return false;
}

// Save the current output mode.
if (!GetConsoleMode(hStdout, &fdwMode)) {
fprintf(stderr, "GetConsoleMode: %d\n", GetLastError());
return false;
}
// if (!GetConsoleMode(hStdout, &fdwMode)) {
// fprintf(stderr, "GetConsoleMode: err#%d\n", GetLastError());
// return false;
// }

// Disable the mangling of newlines.
if (!SetConsoleMode(hStdout, fdwMode | DISABLE_NEWLINE_AUTO_RETURN)) {
fprintf(stderr, "SetConsoleMode: %d\n", GetLastError());
fprintf(stderr, "SetConsoleMode: err#%d\n", GetLastError());
return false;
}
#endif
Expand All @@ -390,7 +390,7 @@ encode (const struct config *config, struct buffer *buf)

// Restore the original console settings.
if (!SetConsoleMode(hStdout, fdwMode)) {
fprintf(stderr, "SetConsoleMode: %d\n", GetLastError());
fprintf(stderr, "SetConsoleMode: err#%d\n", GetLastError());
}
#endif

Expand Down

0 comments on commit c6c2b61

Please sign in to comment.