diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2025-05-17 08:22:13 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2025-05-17 08:22:13 +0200 |
commit | d033bef1ded739c056243e673a9e3fbb6c57ef24 (patch) | |
tree | 792d228003d6a080efa487a327a54379efd22bf7 /csv/csv.cpp | |
parent | 5f0fef82211aa659a31a4b49308c5ad8779d2a2b (diff) |
fix build on Linux & Apple
Diffstat (limited to 'csv/csv.cpp')
-rw-r--r-- | csv/csv.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/csv/csv.cpp b/csv/csv.cpp index 7361fdd1..d899e11a 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -17,6 +17,7 @@ #include <QString> #include <QStringDecoder> #include <QFile> +#include <QByteArrayView> #include <QDebug> namespace { @@ -64,15 +65,19 @@ bool getGameData(int id, unsigned char* table, QString& gamename) return false; } QStringDecoder decoder{QStringConverter::Encoding::Utf8}; - QByteArray lineʹ; lineʹ.reserve(255); QStringList gameLine; gameLine.reserve(8); unsigned lineno = 0; + // TODO QIODevice::readLineInto() is Qt 6.9 - sh 20250515 + char buf[256]; - while (file.readLineInto(&lineʹ)) + while (auto sz = file.readLine(buf, sizeof(buf))) { - QString line = decoder.decode(lineʹ); + QString line = decoder.decode(QByteArrayView{buf, sz}); chomp(line); + if (line.isEmpty()) + continue; + gameLine = line.split(';', Qt::SplitBehaviorFlags::KeepEmptyParts); //qDebug() << "Column 0: " << gameLine.at(0); // No. |