1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-21 04:39:10 +02:00

Compare commits

..

No commits in common. "b7415ca2c90a540667f46d76ee02ca99059fb786" and "d26842efd3a0082c24e95a8ec2969ae51de58da3" have entirely different histories.

3 changed files with 5 additions and 32 deletions

View File

@ -178,14 +178,14 @@ void AreaItem::setDigitalZoom(int zoom)
prepareGeometryChange(); prepareGeometryChange();
_digitalZoom = zoom; _digitalZoom = zoom;
_pen.setWidthF(width() * pow(2, -_digitalZoom)); _pen.setWidthF(_width * pow(2, -_digitalZoom));
} }
void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
_pen.setWidthF((width() + 1) * pow(2, -_digitalZoom)); _pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
update(); update();
} }
@ -193,6 +193,6 @@ void AreaItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
_pen.setWidthF(width() * pow(2, -_digitalZoom)); _pen.setWidthF(_width * pow(2, -_digitalZoom));
update(); update();
} }

View File

@ -104,26 +104,6 @@ static void setWaypointProperties(Waypoint &waypoint,
waypoint.setStyle(PointStyle(color, size)); 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) GeoJSONParser::Type GeoJSONParser::type(const QJsonObject &json)
{ {
@ -424,13 +404,6 @@ bool GeoJSONParser::parse(QFile *file, QList<TrackData> &tracks,
QList<RouteData> &routes, QList<Area> &areas, QVector<Waypoint> &waypoints) QList<RouteData> &routes, QList<Area> &areas, QVector<Waypoint> &waypoints)
{ {
Q_UNUSED(routes); Q_UNUSED(routes);
if (!isJSONObject(file)) {
_errorString = "Not a GeoJSON file";
return false;
} else
file->reset();
QJsonParseError error; QJsonParseError error;
QJsonDocument doc(QJsonDocument::fromJson(file->readAll(), &error)); QJsonDocument doc(QJsonDocument::fromJson(file->readAll(), &error));

View File

@ -486,7 +486,7 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
Q_UNUSED(routes); Q_UNUSED(routes);
Q_UNUSED(polygons); Q_UNUSED(polygons);
qint64 len; qint64 len;
char line[80 + 2/*CRLF*/ + 1/*'\0'*/ + 1/*extra byte for limit check*/]; char line[80 + 2 + 1 + 1];
SegmentData segment; SegmentData segment;
CTX ctx; CTX ctx;
@ -500,7 +500,7 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
if (len < 0) { if (len < 0) {
_errorString = "I/O error"; _errorString = "I/O error";
return false; return false;
} else if (len >= (qint64)sizeof(line) - 1) { } else if (len > (qint64)sizeof(line) - 1) {
_errorString = "Line limit exceeded"; _errorString = "Line limit exceeded";
return false; return false;
} }