mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-05-04 10:27:44 +02:00
Improved error reporting
This commit is contained in:
parent
ba50e67380
commit
ed4c18b773
@ -259,13 +259,9 @@ bool ISO8211::readUDA(quint64 pos, const FieldDefinition &def,
|
|||||||
|
|
||||||
bool ISO8211::readRecord(Record &record)
|
bool ISO8211::readRecord(Record &record)
|
||||||
{
|
{
|
||||||
if (_file.atEnd())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QVector<FieldDefinition> fields;
|
QVector<FieldDefinition> fields;
|
||||||
qint64 pos = _file.pos();
|
qint64 pos = _file.pos();
|
||||||
|
|
||||||
|
|
||||||
if (readDR(fields) < 0) {
|
if (readDR(fields) < 0) {
|
||||||
_errorString = "Error reading DR";
|
_errorString = "Error reading DR";
|
||||||
return false;
|
return false;
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
ISO8211(const QString &path) : _file(path) {}
|
ISO8211(const QString &path) : _file(path) {}
|
||||||
bool readDDR();
|
bool readDDR();
|
||||||
bool readRecord(Record &record);
|
bool readRecord(Record &record);
|
||||||
|
bool atEnd() const {return _file.atEnd();}
|
||||||
const QString &errorString() const {return _errorString;}
|
const QString &errorString() const {return _errorString;}
|
||||||
|
|
||||||
static constexpr quint32 NAME(const char str[4])
|
static constexpr quint32 NAME(const char str[4])
|
||||||
|
@ -829,9 +829,15 @@ MapData::MapData(const QString &path)
|
|||||||
|
|
||||||
if (!ddf.readDDR())
|
if (!ddf.readDDR())
|
||||||
return;
|
return;
|
||||||
while (ddf.readRecord(record))
|
while (!ddf.atEnd()) {
|
||||||
|
if (!ddf.readRecord(record)) {
|
||||||
|
qWarning("%s: %s", qUtf8Printable(path),
|
||||||
|
qUtf8Printable(ddf.errorString()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!processRecord(record, fe, vi, vc, ve, comf, somf, huni))
|
if (!processRecord(record, fe, vi, vc, ve, comf, somf, huni))
|
||||||
qWarning("Invalid S-57 record");
|
qWarning("%s: Invalid S-57 record", qUtf8Printable(path));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < fe.size(); i++) {
|
for (int i = 0; i < fe.size(); i++) {
|
||||||
const ISO8211::Record &r = fe.at(i);
|
const ISO8211::Record &r = fe.at(i);
|
||||||
|
@ -127,14 +127,14 @@ ENCAtlas::ENCAtlas(const QString &fileName, QObject *parent)
|
|||||||
_errorString = ddf.errorString();
|
_errorString = ddf.errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (ddf.readRecord(record)) {
|
while (!ddf.atEnd()) {
|
||||||
if (processRecord(record, file, bounds))
|
if (!ddf.readRecord(record)) {
|
||||||
addMap(dir, file, bounds);
|
|
||||||
}
|
|
||||||
if (!ddf.errorString().isNull()) {
|
|
||||||
_errorString = ddf.errorString();
|
_errorString = ddf.errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (processRecord(record, file, bounds))
|
||||||
|
addMap(dir, file, bounds);
|
||||||
|
}
|
||||||
|
|
||||||
if (_data.isEmpty()) {
|
if (_data.isEmpty()) {
|
||||||
_errorString = "No usable ENC map found";
|
_errorString = "No usable ENC map found";
|
||||||
|
@ -143,16 +143,16 @@ ENCMap::ENCMap(const QString &fileName, QObject *parent)
|
|||||||
_errorString = ddf.errorString();
|
_errorString = ddf.errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (ddf.readRecord(record)) {
|
while (!ddf.atEnd()) {
|
||||||
|
if (!ddf.readRecord(record)) {
|
||||||
|
_errorString = ddf.errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!processRecord(record, gv, comf, dsnm)) {
|
if (!processRecord(record, gv, comf, dsnm)) {
|
||||||
_errorString = "Invalid S-57 record";
|
_errorString = "Invalid S-57 record";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ddf.errorString().isNull()) {
|
|
||||||
_errorString = ddf.errorString();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_name = dsnm;
|
_name = dsnm;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user