fix: fix build error in Linux environment.

- fix various build error in Linux environment.
- the convertion between UTF8, UTF16 and UTF32 have error in Linux and will be fixed in future.
This commit is contained in:
2024-06-19 13:28:51 +08:00
parent b61f718084
commit 1fd132f0c9
3 changed files with 18 additions and 13 deletions

View File

@ -171,7 +171,7 @@ namespace YYCC::ConsoleHelper {
#else
// just return true and do nothing
return true
return true;
#endif
}
@ -226,7 +226,7 @@ namespace YYCC::ConsoleHelper {
WinConsoleWrite(strl, bIsErr);
#else
// in linux, directly use C function to write.
std::fputs(strl.c_str(), to_stderr ? stderr : stdout);
std::fputs(strl.c_str(), bIsErr ? stderr : stdout);
#endif
}
@ -245,11 +245,13 @@ namespace YYCC::ConsoleHelper {
}
void Write(const char* u8_strl) {
RawWrite<false, false, false>(u8_strl, va_list());
va_list empty;
RawWrite<false, false, false>(u8_strl, empty);
}
void WriteLine(const char* u8_strl) {
RawWrite<false, false, true>(u8_strl, va_list());
va_list empty;
RawWrite<false, false, true>(u8_strl, empty);
}
void ErrFormat(const char* u8_fmt, ...) {
@ -267,11 +269,13 @@ namespace YYCC::ConsoleHelper {
}
void ErrWrite(const char* u8_strl) {
RawWrite<false, true, false>(u8_strl, va_list());
va_list empty;
RawWrite<false, true, false>(u8_strl, empty);
}
void ErrWriteLine(const char* u8_strl) {
RawWrite<false, true, true>(u8_strl, va_list());
va_list empty;
RawWrite<false, true, true>(u8_strl, empty);
}
}

View File

@ -1,6 +1,7 @@
#include "EncodingHelper.hpp"
#include <cuchar>
#include <climits>
namespace YYCC::EncodingHelper {