mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-20 20:29:10 +02:00
Compare commits
4 Commits
d26842efd3
...
b7415ca2c9
Author | SHA1 | Date | |
---|---|---|---|
b7415ca2c9 | |||
dec70f6bfe | |||
4f661128ba | |||
15bc9ac774 |
@ -178,14 +178,14 @@ void AreaItem::setDigitalZoom(int zoom)
|
||||
prepareGeometryChange();
|
||||
|
||||
_digitalZoom = zoom;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF((width() + 1) * pow(2, -_digitalZoom));
|
||||
update();
|
||||
}
|
||||
|
||||
@ -193,6 +193,6 @@ void AreaItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
update();
|
||||
}
|
||||
|
@ -104,6 +104,26 @@ static void setWaypointProperties(Waypoint &waypoint,
|
||||
waypoint.setStyle(PointStyle(color, size));
|
||||
}
|
||||
|
||||
static bool isWS(char c)
|
||||
{
|
||||
return (c == 0x20 || c == 0x09 || c == 0x0A || c == 0x0D) ? true : false;
|
||||
}
|
||||
|
||||
static bool isJSONObject(QFile *file)
|
||||
{
|
||||
char c;
|
||||
|
||||
while (file->getChar(&c)) {
|
||||
if (isWS(c))
|
||||
continue;
|
||||
else if (c == '{')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GeoJSONParser::Type GeoJSONParser::type(const QJsonObject &json)
|
||||
{
|
||||
@ -404,6 +424,13 @@ bool GeoJSONParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Area> &areas, QVector<Waypoint> &waypoints)
|
||||
{
|
||||
Q_UNUSED(routes);
|
||||
|
||||
if (!isJSONObject(file)) {
|
||||
_errorString = "Not a GeoJSON file";
|
||||
return false;
|
||||
} else
|
||||
file->reset();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc(QJsonDocument::fromJson(file->readAll(), &error));
|
||||
|
||||
|
@ -486,7 +486,7 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
Q_UNUSED(routes);
|
||||
Q_UNUSED(polygons);
|
||||
qint64 len;
|
||||
char line[80 + 2 + 1 + 1];
|
||||
char line[80 + 2/*CRLF*/ + 1/*'\0'*/ + 1/*extra byte for limit check*/];
|
||||
SegmentData segment;
|
||||
CTX ctx;
|
||||
|
||||
@ -500,7 +500,7 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
if (len < 0) {
|
||||
_errorString = "I/O error";
|
||||
return false;
|
||||
} else if (len > (qint64)sizeof(line) - 1) {
|
||||
} else if (len >= (qint64)sizeof(line) - 1) {
|
||||
_errorString = "Line limit exceeded";
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user