Skip to content

Commit

Permalink
fix compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
treefrogframework committed Apr 14, 2024
1 parent f546f22 commit daec168
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion codegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 2 additions & 0 deletions print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Print &Print::globalInstance()
{
static Print global;
#if QT_VERSION >= 0x060000
global.setEncoding(QStringConverter::System);
#endif
global.flush();
return global;
}
Expand Down

0 comments on commit daec168

Please sign in to comment.