Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

begin clearing errors and warning #13

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atools.pro
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# End of configuration documentation
# =============================================================================

QT += sql xml svg core widgets network
QT += sql xml svg core widgets network core5compat
QT -= gui
CONFIG += build_all c++14 staticlib
CONFIG -= debug_and_release debug_and_release_target
Expand Down
4 changes: 2 additions & 2 deletions src/atools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ QStringList probeFile(const QString& file, int numLinesRead)
if(testFile.open(QIODevice::ReadOnly))
{
QTextStream stream(&testFile);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream.setAutoDetectUnicode(true);

int numLines = 0, numLinesTotal = 0;
Expand Down Expand Up @@ -435,7 +435,7 @@ QTime timeFromHourMinStr(const QString& timeStr)
if(timeStr.contains(":"))
time = QTime(timeStr.section(':', 0, 0).toInt(&okHours), timeStr.section(':', 1, 1).toInt(&okMinutes));
else if(timeStr.length() == 3 || timeStr.length() == 4)
time = QTime(timeStr.left(timeStr.length() - 2).toInt(&okHours), timeStr.rightRef(2).toInt(&okMinutes));
time = QTime(timeStr.left(timeStr.length() - 2).toInt(&okHours), timeStr.right(2).toInt(&okMinutes));

return !okHours || !okMinutes ? QTime() : time;
}
Expand Down
39 changes: 1 addition & 38 deletions src/atools.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QDebug>
#include <QLineF>
#include <QPointF>
#include <QTextCodec>

class QFile;
class QFileInfo;
Expand Down Expand Up @@ -166,12 +167,6 @@ Q_DECL_CONSTEXPR bool inRange(const QList<TYPE>& list, int index)
return index >= 0 && index < list.size();
}

template<typename TYPE>
Q_DECL_CONSTEXPR bool inRange(const QVector<TYPE>& list, int index)
{
return index >= 0 && index < list.size();
}

template<typename TYPE>
Q_DECL_CONSTEXPR bool inRange(TYPE minValue, TYPE maxValue, TYPE index)
{
Expand Down Expand Up @@ -212,16 +207,6 @@ const TYPE& at(const QList<TYPE>& list, int index, const TYPE& defaultType = TYP
return defaultType;
}

template<typename TYPE>
const TYPE& at(const QVector<TYPE>& list, int index, const TYPE& defaultType = TYPE())
{
if(inRange(list, index))
return list.at(index);
else
qWarning() << "index out of bounds:" << index << "list size" << list.size();
return defaultType;
}

template<typename TYPE>
const TYPE& at(const QList<TYPE>& list, int index, const QString& msg, const TYPE& defaultType = TYPE())
{
Expand All @@ -232,16 +217,6 @@ const TYPE& at(const QList<TYPE>& list, int index, const QString& msg, const TYP
return defaultType;
}

template<typename TYPE>
const TYPE& at(const QVector<TYPE>& list, int index, const QString& msg, const TYPE& defaultType = TYPE())
{
if(inRange(list, index))
return list.at(index);
else
qWarning() << "index out of bounds:" << index << "list size" << list.size() << "message" << msg;
return defaultType;
}

/* Writes a warning message includiing the string list */
QString at(const QStringList& columns, int index, bool error);

Expand All @@ -261,18 +236,6 @@ const TYPE *firstOrNull(const QList<TYPE>& list)
return list.isEmpty() ? nullptr : &list.first();
}

template<typename TYPE>
TYPE *firstOrNull(QVector<TYPE>& list)
{
return list.isEmpty() ? nullptr : &list.first();
}

template<typename TYPE>
const TYPE *firstOrNull(const QVector<TYPE>& list)
{
return list.isEmpty() ? nullptr : &list.first();
}

/* Remove all special characters from the filename that can disturb any filesystem */
static const int MAX_FILENAME_CHARS = 150;
QString cleanFilename(const QString& filename, int maxLength = MAX_FILENAME_CHARS);
Expand Down
24 changes: 12 additions & 12 deletions src/fs/bgl/ap/airport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ Airport::Airport(const NavDatabaseOptions *options, BinaryStream *bs,
rec::AirportRecordType type = r.getId<rec::AirportRecordType>();
if(checkSubRecord(r))
{
qWarning().noquote().nospace() << Q_FUNC_INFO << "Invalid record" << hex << " 0x" << r.getId()
<< dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
qWarning().noquote().nospace() << Q_FUNC_INFO << "Invalid record" << Qt::hex << " 0x" << r.getId()
<< Qt::dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
return;
}

// qDebug().nospace() << Q_FUNC_INFO << hex << " 0x" << r.getId()
// << dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
// qDebug().nospace() << Q_FUNC_INFO << Qt::hex << " 0x" << r.getId()
// << Qt::dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();

switch(type)
{
Expand Down Expand Up @@ -361,19 +361,19 @@ Airport::Airport(const NavDatabaseOptions *options, BinaryStream *bs,
case rec::MSFS_SID:
case rec::MSFS_STAR:

// qWarning() << Q_FUNC_INFO << "Unknown record" << hex << " 0x" << r.getId()
// << dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
// qWarning() << Q_FUNC_INFO << "Unknown record" << Qt::hex << " 0x" << r.getId()
// << Qt::dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
break;

default:

qWarning().noquote().nospace() << "Unknown record" << hex << " 0x" << r.getId()
<< dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();
qWarning().noquote().nospace() << "Unknown record" << Qt::hex << " 0x" << r.getId()
<< Qt::dec << " " << airportRecordTypeStr(type) << " " << bs->tellg();

if(subrecordIndex == 0)
{
qWarning().nospace().noquote() << "Ignoring airport. Unexpected initial record type in Airport record 0x"
<< hex << type << dec << getObjectName();
<< Qt::hex << type << Qt::dec << getObjectName();

// Stop reading when the first subrecord is already invalid
seekToStart();
Expand Down Expand Up @@ -667,14 +667,14 @@ void Airport::updateParking(const QList<atools::fs::bgl::Jetway>& jetways,
if(index != -1 && index < parkings.size())
{
if(parkings.at(index).jetway)
qWarning().nospace().noquote() << "Parking for jetway " << jw << " already set" << dec
qWarning().nospace().noquote() << "Parking for jetway " << jw << " already set" << Qt::dec
<< " for parking " << parkings.at(index)
<< " for ident " << ident;
else
parkings[index].jetway = true;
}
else
qWarning().nospace().noquote() << "Parking for jetway " << jw << " not found" << dec
qWarning().nospace().noquote() << "Parking for jetway " << jw << " not found" << Qt::dec
<< " for ident " << ident;
}
}
Expand Down Expand Up @@ -777,7 +777,7 @@ QDebug operator<<(QDebug out, const Airport& record)
<< ", name " << record.name
<< ", region " << record.region
<< ", " << record.position.getPos()
<< ", magvar " << record.magVar << ", " << endl;
<< ", magvar " << record.magVar << ", " << Qt::endl;
out << record.runways;
out << record.coms;
out << record.aprons;
Expand Down
4 changes: 2 additions & 2 deletions src/fs/bgl/ap/approach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Approach::Approach(const NavDatabaseOptions *options, BinaryStream *bs, bool sid
break;

default:
qWarning().nospace().noquote() << "Unexpected record type in approach record 0x" << hex << t << dec
qWarning().nospace().noquote() << "Unexpected record type in approach record 0x" << Qt::hex << t << Qt::dec
<< " for airport ident " << fixAirportIdent << bs->tellg();
}
r.seekToEnd();
Expand All @@ -145,7 +145,7 @@ QDebug operator<<(QDebug out, const Approach& record)
<< ", fix region " << record.fixRegion
<< ", ap icao " << record.fixAirportIdent
<< ", alt " << record.altitude
<< ", hdg " << record.heading << endl;
<< ", hdg " << record.heading << Qt::endl;
out << record.transitions;
out << record.legs;
out << record.missedLegs;
Expand Down
2 changes: 1 addition & 1 deletion src/fs/bgl/ap/apron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ QDebug operator<<(QDebug out, const Apron& record)

out.nospace().noquote() << static_cast<const Record&>(record)
<< " Runway[surface " << surface::surfaceToDbStr(record.surface) << "/"
<< surface::surfaceToDbStr(record.surface) << endl;
<< surface::surfaceToDbStr(record.surface) << Qt::endl;
out << record.vertices;
out << "]";
return out;
Expand Down
2 changes: 1 addition & 1 deletion src/fs/bgl/ap/apron2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ QDebug operator<<(QDebug out, const Apron2& record)
<< " Apron2[surface " << surface::surfaceToDbStr(record.surface) << "/"
<< surface::surfaceToDbStr(record.surface)
<< ", drawSurface " << record.drawSurface
<< ", drawDetail " << record.drawDetail << endl;
<< ", drawDetail " << record.drawDetail << Qt::endl;
out << record.vertices;
out << record.triangles;
out << "]";
Expand Down
2 changes: 1 addition & 1 deletion src/fs/bgl/ap/del/deleteairport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ QString DeleteAirport::deleteAllFlagsToStr(del::DeleteAllFlags flags)

// TODO find out missing flags with bgl compiler also for MSFS
// else if(flags != 0)
// qWarning().nospace().noquote() << "Found unknown delete all flags 0x" << hex << flags;
// qWarning().nospace().noquote() << "Found unknown delete all flags 0x" << Qt::hex << flags;

if(retval.endsWith(","))
retval.chop(1);
Expand Down
2 changes: 1 addition & 1 deletion src/fs/bgl/ap/helipad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ QDebug operator<<(QDebug out, const Helipad& record)

out.nospace().noquote() << static_cast<const Record&>(record)
<< " Helipad[type " << Helipad::helipadTypeToStr(record.type)
<< ", surface " << surface::surfaceToDbStr(record.surface) << endl
<< ", surface " << surface::surfaceToDbStr(record.surface) << Qt::endl
<< ", length " << record.length
<< ", width " << record.width
<< ", heading " << record.heading
Expand Down
8 changes: 4 additions & 4 deletions src/fs/bgl/ap/rw/runway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Runway::Runway(const NavDatabaseOptions *options, BinaryStream *bs, const QStrin
break;

default:
qWarning().nospace().noquote() << "Unexpected record type in Runway record 0x" << hex << t << dec
qWarning().nospace().noquote() << "Unexpected record type in Runway record 0x" << Qt::hex << t << Qt::dec
<< " for ident " << airportIdent
<< " runway " << primary.getName() << "/" << secondary.getName()
<< " " << bs->tellg();
Expand Down Expand Up @@ -284,9 +284,9 @@ QDebug operator<<(QDebug out, const Runway& record)
<< " Runway[length " << record.length
<< ", width " << record.width
<< ", hdg " << record.heading
<< ", surface " << surface::surfaceToDbStr(record.surface) << endl
<< ", primary " << record.primary << endl
<< ", secondary " << record.secondary << endl
<< ", surface " << surface::surfaceToDbStr(record.surface) << Qt::endl
<< ", primary " << record.primary << Qt::endl
<< ", secondary " << record.secondary << Qt::endl
<< "]";
return out;
}
Expand Down
4 changes: 2 additions & 2 deletions src/fs/bgl/ap/transition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Transition::Transition(const NavDatabaseOptions *options, BinaryStream *bs)
break;

default:
qWarning().nospace().noquote() << "Unexpected record type in transition record 0x" << hex << t << dec
qWarning().nospace().noquote() << "Unexpected record type in transition record 0x" << Qt::hex << t << Qt::dec
<< " for airport ident " << fixAirportIdent;
}
r.seekToEnd();
Expand All @@ -151,7 +151,7 @@ QDebug operator<<(QDebug out, const Transition& record)
<< ", dmeRegion " << record.dmeRegion
<< ", dmeAirportIdent " << record.dmeAirportIdent
<< ", dmeRadial " << record.dmeRadial
<< ", dmeDist " << record.dmeDist << endl;
<< ", dmeDist " << record.dmeDist << Qt::endl;
out << record.legs;
out << "]";
return out;
Expand Down
2 changes: 1 addition & 1 deletion src/fs/bgl/bglbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void BglBase::seekToStart()
QDebug operator<<(QDebug out, const BglBase& base)
{
QDebugStateSaver saver(out);
out.nospace().noquote() << hex << " BglBase[start 0x" << base.startOffset << "]";
out.nospace().noquote() << Qt::hex << " BglBase[start 0x" << base.startOffset << "]";
return out;
}

Expand Down
8 changes: 4 additions & 4 deletions src/fs/bgl/bglfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void BglFile::handleBoundaries(BinaryStream *bs)
else if(type != rec::GEOPOL)
// Should only contain boundaries and geopol records
qWarning().nospace() << "while reading boundaries: unexpected record "
<< hex << "0x" << type << " at " << hex << "0x" << bs->tellg();
<< Qt::hex << "0x" << type << " at " << Qt::hex << "0x" << bs->tellg();

rec.seekToEnd();
}
Expand Down Expand Up @@ -255,7 +255,7 @@ void BglFile::readRecords(BinaryStream *bs, const atools::fs::scenery::SceneryAr
if(options->isVerbose())
{
qDebug() << "=======================";
qDebug().nospace().noquote() << "Records of 0x" << hex << subsection.getFirstDataRecordOffset() << dec
qDebug().nospace().noquote() << "Records of 0x" << Qt::hex << subsection.getFirstDataRecordOffset() << Qt::dec
<< " type " << sectionTypeStr(type);
}

Expand Down Expand Up @@ -372,7 +372,7 @@ void BglFile::readRecords(BinaryStream *bs, const atools::fs::scenery::SceneryAr
break;

default:
qWarning().nospace().noquote() << "Unknown section type at 0x" << hex << bs->tellg() << dec << ": " << type;
qWarning().nospace().noquote() << "Unknown section type at 0x" << Qt::hex << bs->tellg() << Qt::dec << ": " << type;

}
if(rec == nullptr)
Expand All @@ -383,7 +383,7 @@ void BglFile::readRecords(BinaryStream *bs, const atools::fs::scenery::SceneryAr
rec->seekToEnd();
else
qWarning().nospace().noquote() << "Invalid record size " << rec->getSize()
<< " at 0x" << hex << bs->tellg()
<< " at 0x" << Qt::hex << bs->tellg()
<< " type 0x" << rec->getId();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/fs/bgl/boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Boundary::Boundary(const NavDatabaseOptions *options, BinaryStream *bs)
{
if(id != rec::BOUNDARY)
{
qWarning() << "Not a boundary record" << hex << "0x" << id << dec;
qWarning() << "Not a boundary record" << Qt::hex << "0x" << id << Qt::dec;
excluded = true;
return;
}
Expand Down Expand Up @@ -227,7 +227,7 @@ QDebug operator<<(QDebug out, const Boundary& record)
<< ", minAltType " << Boundary::altTypeToStr(record.minAltType)
<< ", maxAltType " << Boundary::altTypeToStr(record.maxAltType)
<< ", minPosition " << record.minPosition
<< ", maxPosition " << record.maxPosition << endl;
<< ", maxPosition " << record.maxPosition << Qt::endl;
out << record.lines;
out << "]";

Expand Down
10 changes: 5 additions & 5 deletions src/fs/bgl/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ QString intToIcao(unsigned int icao, bool noBitShift)
if(coded == 0)
break;
if(coded > 1 && coded < 12)
icaoStr.insert(0, '0' + (coded - 2));
icaoStr.insert(0, "0" + QString((QChar)(coded - 2)));
else
icaoStr.insert(0, 'A' + (coded - 12));
icaoStr.insert(0, "A" + QString((QChar)(coded - 12)));
}
return icaoStr;
}
Expand All @@ -100,7 +100,7 @@ QString runwayToStr(int runwayNumber, int designator)
{
// Normal one digit runway number with leading zero
retval += "0";
retval += static_cast<char>(runwayNumber) + '0';
retval += QString((QChar)((int)'0' + runwayNumber));
}
else if(runwayNumber > 36)
{
Expand Down Expand Up @@ -138,8 +138,8 @@ QString runwayToStr(int runwayNumber, int designator)
else
{
// Normal two digit runway number without leading zero
retval += static_cast<char>(runwayNumber / 10) + '0';
retval += static_cast<char>(runwayNumber % 10) + '0';
retval += QString((QChar)((int)'0' + (runwayNumber / 10)));
retval += QString((QChar)((int)'0' + (runwayNumber % 10)));
}
// Add designator if there is one
retval += designatorStr(designator);
Expand Down
Loading