From d193512f7c2161b84bd95c1db4389e86bf57bb1f Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 26 Sep 2011 21:42:34 +0100 Subject: [PATCH] Formally support v7 WKO+ Files This patch removes the invariance for the graph tab and uses the same protocol as v1 reliably. This has been tested against 600 files without error. All popular formats of the WKO format are now supported, the warnings for v7 have therefore been removed. --- src/WkoRideFile.cpp | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/src/WkoRideFile.cpp b/src/WkoRideFile.cpp index a62ed3d8a..c70db70dc 100644 --- a/src/WkoRideFile.cpp +++ b/src/WkoRideFile.cpp @@ -91,10 +91,6 @@ WkoParser::WkoParser(QFile &file, QStringList &errors, QList*rides) errors << (QString("Version of file (%1) is too old, open and save in WKO then retry: \"").arg(version) + file.fileName() + "\""); return; - // we haven't seen nearly enough v7 files to support properly - } else if (version == 7) { - errors <31) { errors << ("Version of file is new and not fully supported yet: \"" + @@ -716,38 +712,20 @@ WkoParser::parseHeaderData(WKO_UCHAR *fb) if (version != 12) p += donumber(p, &ul); // not in version 12? - if (version !=7) { // need to see more version 7 files + int arraysize = (version == 1 || version == 7) ? 8 : 16; - int arraysize = (version == 1) ? 8 : 16; + for (int i=0; i< arraysize; i++) { // 16 types of chart data - for (int i=0; i< arraysize; i++) { // 16 types of chart data + if (version != 12) { + p += 44; - if (version != 12) { - p += 44; - //p += dofloat(p, &f) /* 30: unknown */ - //p += dofloat(p, &f) /* 31: unknown */ - //p += dofloat(p, &f) /* 32: unknown */ - //p += dofloat(p, &f) /* 33: unknown */ - //p += dofloat(p, &f) /* 34: unknown */ - //p += dofloat(p, &f) /* 35: unknown */ - //p += dofloat(p, &f) /* 36: unknown */ - //p += donumber(p, &ul); /* 37: x-axis maximum */ - //p += donumber(p, &ul); /* 38: show chart? */ - //p += donumber(p, &ul); /* 39: autoscale? */ - //p += donumber(p, &ul); /* 40: autogridlines? */ - - p += doshort(p, &us); /* 41: number of gridlines XXVARIABLEXX */ - p += (us * 8); // 2 longs x number of gridlines - } else { - p += 40; - } + p += doshort(p, &us); /* 41: number of gridlines XXVARIABLEXX */ + p += (us * 8); // 2 longs x number of gridlines + } else { + p += 40; } - } else { - // version 7 -- need more files - p += 0x170; // possibly too invariant! } - /* Ranges */ // The ranges are stored as references to data points