diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-14 09:58:12 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-14 18:14:46 +0200 |
commit | 82b9f72b22d25d16656c5db439fba14190cc3e21 (patch) | |
tree | e8c5f9e177518c58a65db58c9dfafd11e4ab7179 | |
parent | 4ce3ce22c5d50dd3bd92223e43182d4efdfe4ef8 (diff) |
csv: fix GNU CXX 6.1 scanf modifier
GNU cxx 6.1 doesn't allow for non-standard cxx scanf modifiers. Have to
use %02x and convert to unsigned char later.
-rw-r--r-- | csv/csv.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/csv/csv.cpp b/csv/csv.cpp index 26a36b70..c1971256 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -106,8 +106,8 @@ bool CSV::getGameData( const int id, unsigned char* table, QString& gamename) if (gameLine.count() > 6) { if (gameLine.at(6).compare( gameID, Qt::CaseInsensitive ) == 0) { QByteArray id = gameLine.at(7).toLatin1(); - unsigned char tmp[8]; - unsigned char fuzz[3]; + unsigned int tmp[8]; + unsigned int fuzz[3]; bool ret = true; if (gameLine.at(3) == QString("V160")) { @@ -115,7 +115,7 @@ bool CSV::getGameData( const int id, unsigned char* table, QString& gamename) ret = false; } else if (sscanf(id.constData(), - "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx", + "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", fuzz + 2, fuzz + 0, tmp + 3, @@ -133,7 +133,10 @@ bool CSV::getGameData( const int id, unsigned char* table, QString& gamename) } else for (int i = 0; i < 8; i++) - table[i] = tmp[i]; + { + using t = unsigned char; + table[i] = t(tmp[i]); + } qDebug() << gameID << "game-id" << gameLine.at(7); gamename = gameLine.at(1); file.close(); |