Commit ddbf56c63beb295078876aa69efce0e18926f53c

Authored by Scott Klum
1 parent f1129f62

Bug fixes

openbr/plugins/gallery/csv.cpp
... ... @@ -93,10 +93,10 @@ public:
93 93 header.indices.append(i);
94 94  
95 95 // Look for other subheaders with the same key
96   - for (int j=i; j<headers.size(); j++)
  96 + for (int j=i+1; j<headers.size(); j++)
97 97 if (headers[j].contains("_")) {
98 98 const QStringList subKeys = headers[j].split("_");
99   - if (subKeys.first() == header.key) {
  99 + if (subKeys.first() == header.key && !header.subKeys.contains(subKeys.last()) /* Check for ill-formed csvs */) {
100 100 header.indices.append(j);
101 101 header.subKeys.append(subKeys.last());
102 102 }
... ... @@ -159,10 +159,7 @@ class csvGallery : public FileGallery
159 159  
160 160 void setValuesFromHeaders(File &f, const CSVHeaderList &headers, const QVariantList &values)
161 161 {
162   - qDebug() << headers.keys();
163   -
164 162 foreach (const CSVHeader &header, headers) {
165   - qDebug() << header.key;
166 163 if (header.indices.size() == 1)
167 164 f.set(header.key, values[header.indices.first()]);
168 165 else if (header.indices.size() == 2) // QPointF
... ... @@ -198,7 +195,7 @@ class csvGallery : public FileGallery
198 195 *done = true;
199 196 QMap<QString, File> combinedFiles;
200 197  
201   - for (qint64 i = 0; i < !f.atEnd(); i++) {
  198 + while (!f.atEnd()) {
202 199 const QVariantList values = parseLine(f.readLine());
203 200 const QString name = values.first().toString();
204 201 File &in = combinedFiles[name];
... ... @@ -206,7 +203,6 @@ class csvGallery : public FileGallery
206 203 setValuesFromHeaders(in, headers, values.mid(1));
207 204 }
208 205  
209   - qDebug() << combinedFiles.values();
210 206 foreach (const File &in, combinedFiles.values())
211 207 templates.append(in);
212 208 } else {
... ...