From 7603ed4160722e686b993536b0dd6e60e79af57b Mon Sep 17 00:00:00 2001 From: Syping Date: Sat, 1 May 2021 15:32:32 +0200 Subject: [PATCH] Fix luaenginec legacy build --- src/luaenginec/main.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/luaenginec/main.cpp b/src/luaenginec/main.cpp index d3e7559..7dc40c5 100644 --- a/src/luaenginec/main.cpp +++ b/src/luaenginec/main.cpp @@ -24,6 +24,12 @@ #include #include +#if QT_VERSION >= 0x050F00 +#define le_endl Qt::endl +#else +#define le_endl endl +#endif + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -47,7 +53,7 @@ int main(int argc, char *argv[]) QString outputFile; const QStringList args = parser.positionalArguments(); if (args.length() < 1) { - QTextStream(stderr) << "Error: No input files." << Qt::endl; + QTextStream(stderr) << "Error: No input files." << le_endl; return 1; } else { @@ -62,7 +68,7 @@ int main(int argc, char *argv[]) QFile luaScript(inputFile); if (!luaScript.open(QIODevice::ReadOnly)) { - QTextStream(stderr) << "Error: Failed to open \"" << inputFile << "\"." << Qt::endl; + QTextStream(stderr) << "Error: Failed to open \"" << inputFile << "\"." << le_endl; return 1; } @@ -75,13 +81,13 @@ int main(int argc, char *argv[]) LuaEngine luaEngine; if (!luaEngine.loadLuaScript(luaScript.readAll())) { - QTextStream(stderr) << "Error: Failed to load \"" << inputFile << "\"." << Qt::endl; + QTextStream(stderr) << "Error: Failed to load \"" << inputFile << "\"." << le_endl; return 1; } QSaveFile outputSaveFile(outputFile); if (!outputSaveFile.open(QIODevice::WriteOnly)) { - QTextStream(stderr) << "Error: Failed to open \"" << outputFile << "\"." << Qt::endl; + QTextStream(stderr) << "Error: Failed to open \"" << outputFile << "\"." << le_endl; return 1; } @@ -91,7 +97,7 @@ int main(int argc, char *argv[]) if (!portableLuaEngine.open(QIODevice::ReadOnly)) { outputSaveFile.cancelWriting(); outputSaveFile.commit(); - QTextStream(stderr) << "Error: Failed to open \"" << pLuaEngine << "\"." << Qt::endl; + QTextStream(stderr) << "Error: Failed to open \"" << pLuaEngine << "\"." << le_endl; return 1; } outputSaveFile.write(portableLuaEngine.readAll()); @@ -106,7 +112,7 @@ int main(int argc, char *argv[]) if (lengthArray.size() > 8) { outputSaveFile.cancelWriting(); outputSaveFile.commit(); - QTextStream(stderr) << "Error: Lua Engine script is too large." << Qt::endl; + QTextStream(stderr) << "Error: Lua Engine script is too large." << le_endl; return 1; } else { @@ -119,7 +125,7 @@ int main(int argc, char *argv[]) } if (!outputSaveFile.commit()) { - QTextStream(stderr) << "Error: Failed to write \"" << args.at(1) << "\"." << Qt::endl; + QTextStream(stderr) << "Error: Failed to write \"" << args.at(1) << "\"." << le_endl; return 1; }