diff --git a/.gitignore b/.gitignore index f25279037..e971e4710 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ ui_*.h # vscode related thingss .vscode/ +.theia/ diff --git a/tools/ld-chroma-decoder/encoder/main.cpp b/tools/ld-chroma-decoder/encoder/main.cpp index 58abce158..df0814faf 100644 --- a/tools/ld-chroma-decoder/encoder/main.cpp +++ b/tools/ld-chroma-decoder/encoder/main.cpp @@ -29,6 +29,11 @@ #include #include +#ifdef _WIN32 + #include + #include +#endif + #include "lddecodemetadata.h" #include "logging.h" @@ -37,6 +42,10 @@ int main(int argc, char *argv[]) { + #ifdef _WIN32 + _setmode(_fileno(stdout), O_BINARY); + _setmode(_fileno(stdin), O_BINARY); + #endif // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-chroma-decoder/main.cpp b/tools/ld-chroma-decoder/main.cpp index a4b807f48..292c183d7 100644 --- a/tools/ld-chroma-decoder/main.cpp +++ b/tools/ld-chroma-decoder/main.cpp @@ -97,6 +97,8 @@ static bool loadTransformThresholds(QCommandLineParser &parser, QCommandLineOpti int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-disc-stacker/main.cpp b/tools/ld-disc-stacker/main.cpp index ebf71cdf1..451862f3e 100644 --- a/tools/ld-disc-stacker/main.cpp +++ b/tools/ld-disc-stacker/main.cpp @@ -37,6 +37,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-discmap/main.cpp b/tools/ld-discmap/main.cpp index 090633a06..5a667ebf7 100644 --- a/tools/ld-discmap/main.cpp +++ b/tools/ld-discmap/main.cpp @@ -33,6 +33,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-dropout-correct/main.cpp b/tools/ld-dropout-correct/main.cpp index f56810eab..86f16df70 100644 --- a/tools/ld-dropout-correct/main.cpp +++ b/tools/ld-dropout-correct/main.cpp @@ -35,6 +35,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-export-metadata/main.cpp b/tools/ld-export-metadata/main.cpp index 2ba4e3b16..14e04e785 100644 --- a/tools/ld-export-metadata/main.cpp +++ b/tools/ld-export-metadata/main.cpp @@ -38,6 +38,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-lds-converter/main.cpp b/tools/ld-lds-converter/main.cpp index 1a9e0fccb..6e961c8c3 100644 --- a/tools/ld-lds-converter/main.cpp +++ b/tools/ld-lds-converter/main.cpp @@ -32,6 +32,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-process-ac3/decode/main.cpp b/tools/ld-process-ac3/decode/main.cpp index caaa05924..92e47708e 100644 --- a/tools/ld-process-ac3/decode/main.cpp +++ b/tools/ld-process-ac3/decode/main.cpp @@ -28,6 +28,11 @@ #include #include +#ifdef _WIN32 + #include + #include +#endif + #include "../logger.hpp" #include "AC3Framer.hpp" #include "ac3_parsing.hpp" // mostly for debug & stats @@ -49,6 +54,10 @@ void doHelp(const std::string &app) { } int main(int argc, char *argv[]) { + #ifdef _WIN32 + _setmode(_fileno(stdout), O_BINARY); + _setmode(_fileno(stdin), O_BINARY); + #endif while (true) { switch (getopt(argc, argv, "v:h?")) { // could have stdin/stdout as defaults, with switches to change them diff --git a/tools/ld-process-ac3/demodulate/main.cpp b/tools/ld-process-ac3/demodulate/main.cpp index 3a892e547..feffcd09c 100644 --- a/tools/ld-process-ac3/demodulate/main.cpp +++ b/tools/ld-process-ac3/demodulate/main.cpp @@ -29,6 +29,11 @@ #include #include +#ifdef _WIN32 + #include + #include +#endif + #include "../logger.hpp" #include "OneBitADC.hpp" #include "Reclocker.hpp" @@ -52,6 +57,11 @@ void doHelp(const std::string &app) { int main(int argc, char *argv[]) { + + #ifdef _WIN32 + _setmode(_fileno(stdout), O_BINARY); + _setmode(_fileno(stdin), O_BINARY); + #endif int slidingAvgLength = 1e3; // todo 8/16bit and little-/big-endian switches? leave it to sox? diff --git a/tools/ld-process-efm/main.cpp b/tools/ld-process-efm/main.cpp index 5ab9807dc..91c0bb7e4 100644 --- a/tools/ld-process-efm/main.cpp +++ b/tools/ld-process-efm/main.cpp @@ -33,6 +33,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-process-vbi/main.cpp b/tools/ld-process-vbi/main.cpp index a2f89f026..6650ac712 100644 --- a/tools/ld-process-vbi/main.cpp +++ b/tools/ld-process-vbi/main.cpp @@ -33,6 +33,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/ld-process-vits/main.cpp b/tools/ld-process-vits/main.cpp index d0d0f05ae..9b327323a 100644 --- a/tools/ld-process-vits/main.cpp +++ b/tools/ld-process-vits/main.cpp @@ -37,6 +37,8 @@ int main(int argc, char *argv[]) { + //set 'binary mode' for stdin and stdout on windows + setBinaryMode(); // Install the local debug message handler setDebug(true); qInstallMessageHandler(debugOutputHandler); diff --git a/tools/library/tbc/logging.cpp b/tools/library/tbc/logging.cpp index 3f2cc1b5b..7b0280466 100644 --- a/tools/library/tbc/logging.cpp +++ b/tools/library/tbc/logging.cpp @@ -122,6 +122,14 @@ void setQuiet(bool state) quietDebug = state; } +void setBinaryMode(void) +{ + #ifdef _WIN32 + _setmode(_fileno(stdout), O_BINARY); + _setmode(_fileno(stdin), O_BINARY); + #endif +} + // Method to add the standard debug options to the command line parser void addStandardDebugOptions(QCommandLineParser &parser) { diff --git a/tools/library/tbc/logging.h b/tools/library/tbc/logging.h index abf02eba0..d12543bdb 100644 --- a/tools/library/tbc/logging.h +++ b/tools/library/tbc/logging.h @@ -31,10 +31,16 @@ #include #include +#ifdef _WIN32 + #include + #include +#endif + // Prototypes void debugOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); void setDebug(bool state); void setQuiet(bool state); +void setBinaryMode(void); void openDebugFile(QString filename); void closeDebugFile(void); void addStandardDebugOptions(QCommandLineParser &parser);