From 1a431508f5c96560f6d9d3798854b034cfcf7de0 Mon Sep 17 00:00:00 2001 From: Dan Nagle Date: Sat, 15 Jun 2024 13:14:17 -0500 Subject: [PATCH] ifdef EOL for various OSes --- src/globals.h | 7 +++++++ src/mainpacketreceiver.cpp | 4 ++-- src/threadedtcpserver.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/globals.h b/src/globals.h index c610aab7..6ee39a0e 100755 --- a/src/globals.h +++ b/src/globals.h @@ -63,6 +63,13 @@ #define UPDOWNICON ":icons/moveupdown.png" +// Hard-coding EOL for linux since Qt distros vary widely +#ifdef __linux__ + #define ENDL "\n"; +#else + #define ENDL Qt::endl; +#endif + //Qt 5.10 changed the way sockets bind //It seems dual ipv4/ipv6 mode works better. diff --git a/src/mainpacketreceiver.cpp b/src/mainpacketreceiver.cpp index dc0931cb..848467a6 100644 --- a/src/mainpacketreceiver.cpp +++ b/src/mainpacketreceiver.cpp @@ -51,7 +51,7 @@ void MainPacketReceiver::readPendingDatagrams() QTextStream out(stdout); QString output = MainPacketReceiver::datagramOutput(datagram, false); - out << output << Qt::endl; + out << output << ENDL; out.flush(); output.clear(); @@ -74,7 +74,7 @@ void MainPacketReceiver::readPendingDatagrams() out << "\nResponse Time:" << QDateTime::currentDateTime().toString(DATETIMEFORMAT); out << "\nResponse HEX:" << sendit.hexString; out << "\nResponse ASCII:" << sendit.asciiString(); - out << Qt::endl; + out << ENDL; } diff --git a/src/threadedtcpserver.cpp b/src/threadedtcpserver.cpp index 2c16c76d..45b9f826 100644 --- a/src/threadedtcpserver.cpp +++ b/src/threadedtcpserver.cpp @@ -148,7 +148,7 @@ void ThreadedTCPServer::outputTCPPacket(Packet receivePacket) out << "\nResponse ASCII:" << receivePacket.asciiString(); } - out << Qt::endl; + out << ENDL; out.flush();