From daec168f56a133a260b64b016de8609289e7a448 Mon Sep 17 00:00:00 2001 From: AOYAMA Kazuharu Date: Sun, 14 Apr 2024 20:12:29 +0900 Subject: [PATCH] fix compilation error --- codegenerator.cpp | 2 +- compiler.cpp | 2 ++ main.cpp | 2 ++ print.cpp | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/codegenerator.cpp b/codegenerator.cpp index b5195a4..b76bc3f 100644 --- a/codegenerator.cpp +++ b/codegenerator.cpp @@ -119,7 +119,7 @@ QString CodeGenerator::generateMainFunc(bool safety) const { QString src; - if (_code.contains(QRegularExpression(" main\\s*\\("))) { + if (_code.contains(QRegularExpression(" main\\s*\\("))) { // main function src += _headers; src += "\n"; src += _code; diff --git a/compiler.cpp b/compiler.cpp index ea374ed..29799b4 100644 --- a/compiler.cpp +++ b/compiler.cpp @@ -249,7 +249,9 @@ int Compiler::compileFileAndExecute(const QString &path) } QTextStream ts(&srcFile); +#if QT_VERSION >= 0x060000 ts.setEncoding(QStringConverter::System); +#endif QString src = ts.readLine().trimmed(); // read first line if (src.startsWith("#!")) { // check shebang diff --git a/main.cpp b/main.cpp index 6d30a48..7020899 100644 --- a/main.cpp +++ b/main.cpp @@ -441,7 +441,9 @@ int main(int argv, char *argc[]) } else if (QCoreApplication::arguments().contains("-")) { // Check pipe option QString src; QTextStream tsstdin(stdin); +#if QT_VERSION >= 0x060000 tsstdin.setEncoding(QStringConverter::System); +#endif while (!tsstdin.atEnd()) { src += tsstdin.readAll(); } diff --git a/print.cpp b/print.cpp index 374fcf7..dfa3517 100644 --- a/print.cpp +++ b/print.cpp @@ -4,7 +4,9 @@ Print &Print::globalInstance() { static Print global; +#if QT_VERSION >= 0x060000 global.setEncoding(QStringConverter::System); +#endif global.flush(); return global; }