summaryrefslogtreecommitdiffhomepage
path: root/csv
diff options
context:
space:
mode:
Diffstat (limited to 'csv')
-rw-r--r--csv/csv.cpp11
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.