mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Improved error reporting
This commit is contained in:
parent
a6053a4d7b
commit
668558cf2e
@ -101,7 +101,7 @@ static bool readFloat(const char *data, int len, qreal &f)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool validLine(const char *line, int len)
|
static bool validSentence(const char *line, int len)
|
||||||
{
|
{
|
||||||
const char *lp;
|
const char *lp;
|
||||||
|
|
||||||
@ -395,6 +395,7 @@ bool NMEAParser::loadFile(QFile *file)
|
|||||||
{
|
{
|
||||||
qint64 len;
|
qint64 len;
|
||||||
char line[80 + 2 + 1 + 1];
|
char line[80 + 2 + 1 + 1];
|
||||||
|
bool nmea = false;
|
||||||
|
|
||||||
|
|
||||||
_errorLine = 1;
|
_errorLine = 1;
|
||||||
@ -414,12 +415,14 @@ bool NMEAParser::loadFile(QFile *file)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validLine(line, len)) {
|
if (!validSentence(line, len)) {
|
||||||
|
if (nmea)
|
||||||
fprintf(stderr, "%s:%d: Invalid NMEA sentence\n",
|
fprintf(stderr, "%s:%d: Invalid NMEA sentence\n",
|
||||||
qPrintable(file->fileName()), _errorLine);
|
qPrintable(file->fileName()), _errorLine);
|
||||||
_errorLine++;
|
_errorLine++;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else
|
||||||
|
nmea = true;
|
||||||
|
|
||||||
if (!memcmp(line + 3, "RMC,", 4)) {
|
if (!memcmp(line + 3, "RMC,", 4)) {
|
||||||
if (!readRMC(line + 7, len))
|
if (!readRMC(line + 7, len))
|
||||||
|
Loading…
Reference in New Issue
Block a user