re-add error message formatting from 7b5d790

This commit is contained in:
Aaron Liu 2024-02-17 14:14:32 -05:00
parent b783c67f66
commit 4cb242b7f5
No known key found for this signature in database
GPG key ID: 2D4DA57B12065A35

View file

@ -140,10 +140,10 @@ void printImage(const cimg_library::CImg<unsigned char> &image,
: findCharData(get_pixel, x, y, flags); : findCharData(get_pixel, x, y, flags);
if (x == 0 || charData.bgColor != lastCharData.bgColor) if (x == 0 || charData.bgColor != lastCharData.bgColor)
printTermColor(flags | FLAG_BG, charData.bgColor[0], printTermColor(flags | FLAG_BG, charData.bgColor[0],
charData.bgColor[1], charData.bgColor[2]); charData.bgColor[1], charData.bgColor[2]);
if (x == 0 || charData.fgColor != lastCharData.fgColor) if (x == 0 || charData.fgColor != lastCharData.fgColor)
printTermColor(flags | FLAG_FG, charData.fgColor[0], printTermColor(flags | FLAG_FG, charData.fgColor[0],
charData.fgColor[1], charData.fgColor[2]); charData.fgColor[1], charData.fgColor[2]);
printCodepoint(charData.codePoint); printCodepoint(charData.codePoint);
lastCharData = charData; lastCharData = charData;
} }
@ -296,9 +296,8 @@ int main(int argc, char *argv[]) {
// ioctl call's failed ) // ioctl call's failed )
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != 0 || if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != 0 ||
(w.ws_col | w.ws_row) == 0) { (w.ws_col | w.ws_row) == 0) {
std::cerr << "Warning: failed to determine most reasonable size, " std::cerr << "Warning: failed to determine most reasonable size: "
"defaulting to 80x24" << strerror(errno) << ", defaulting to 20x6" << std::endl;
<< std::endl;
} else { } else {
maxWidth = w.ws_col * 4; maxWidth = w.ws_col * 4;
maxHeight = w.ws_row * 8; maxHeight = w.ws_row * 8;
@ -312,8 +311,8 @@ int main(int argc, char *argv[]) {
maxHeight = w.dwSize.Y * 8; maxHeight = w.dwSize.Y * 8;
} else { } else {
std::cerr << "Warning: failed to determine most reasonable size: " std::cerr << "Warning: failed to determine most reasonable size: "
"Error code" << std::system_category().message(GetLastError())
<< GetLastError() << ", defaulting to 80x24" << std::endl; << ", defaulting to 80x24" << std::endl;
} }
#else #else
std::cerr << "Warning: failed to determine most reasonable size: " std::cerr << "Warning: failed to determine most reasonable size: "