Skip to content

Commit

Permalink
qPrintable() -> qUtf8Printable()
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Jan 3, 2025
1 parent 2b967ce commit ad13a5b
Show file tree
Hide file tree
Showing 40 changed files with 148 additions and 140 deletions.
3 changes: 2 additions & 1 deletion src/GUI/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ void GUI::mapInitialized()
_showMapAction->setEnabled(true);
_clearMapCacheAction->setEnabled(true);
} else {
qWarning("%s: %s", qPrintable(map->path()), qPrintable(map->errorString()));
qWarning("%s: %s", qUtf8Printable(map->path()),
qUtf8Printable(map->errorString()));
action->deleteLater();
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/data/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ Data::Data(const QString &fileName, bool tryUnknown)
++it;
}

qWarning("%s:", qPrintable(fileName));
qWarning("%s:", qUtf8Printable(fileName));
for (it = _parsers.find(suffix); it != _parsers.end()
&& it.key() == suffix; it++)
qWarning(" %s: line %d: %s", qPrintable(it.key()),
it.value()->errorLine(), qPrintable(it.value()->errorString()));
qWarning(" %s: line %d: %s", qUtf8Printable(it.key()),
it.value()->errorLine(), qUtf8Printable(it.value()->errorString()));

} else if (tryUnknown) {
for (it = _parsers.begin(); it != _parsers.end(); it++) {
Expand All @@ -144,10 +144,10 @@ Data::Data(const QString &fileName, bool tryUnknown)
file.reset();
}

qWarning("%s:", qPrintable(fileName));
qWarning("%s:", qUtf8Printable(fileName));
for (it = _parsers.begin(); it != _parsers.end(); it++)
qWarning(" %s: line %d: %s", qPrintable(it.key()),
it.value()->errorLine(), qPrintable(it.value()->errorString()));
qWarning(" %s: line %d: %s", qUtf8Printable(it.key()),
it.value()->errorLine(), qUtf8Printable(it.value()->errorString()));

_errorLine = 0;
_errorString = "Unknown format";
Expand Down
2 changes: 1 addition & 1 deletion src/data/igcparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ bool IGCParser::parse(QFile *file, QList<TrackData> &tracks,
/* The date H header is mandatory, but XCSOAR generates
files without it, so add a dummy date in such case */
qWarning("%s: Missing date header",
qPrintable(file->fileName()));
qUtf8Printable(file->fileName()));
ctx.date = QDate(1970, 1, 1);
}
if (!track) {
Expand Down
14 changes: 8 additions & 6 deletions src/data/onmoveparsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ bool OMDParser::readHeaderFile(const QString &omdPath, Header &hdr)
char buffer[60];

if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
if (file.read(buffer, sizeof(buffer)) != sizeof(buffer)) {
qWarning("%s: invalid OMH file", qPrintable(path));
qWarning("%s: invalid OMH file", qUtf8Printable(path));
return false;
}

Expand All @@ -48,7 +49,7 @@ bool OMDParser::readHeaderFile(const QString &omdPath, Header &hdr)

QDateTime date(QDate(Y + 2000, M, D), QTime(h, m), QTimeZone::utc());
if (!date.isValid()) {
qWarning("%s: invalid date", qPrintable(path));
qWarning("%s: invalid date", qUtf8Printable(path));
return false;
}

Expand Down Expand Up @@ -183,11 +184,12 @@ bool GHPParser::readHeaderFile(const QString &ghpPath, Header &hdr)
char buffer[96];

if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
if (file.read(buffer, sizeof(buffer)) != sizeof(buffer)) {
qWarning("%s: invalid GHT file", qPrintable(path));
qWarning("%s: invalid GHT file", qUtf8Printable(path));
return false;
}

Expand All @@ -202,7 +204,7 @@ bool GHPParser::readHeaderFile(const QString &ghpPath, Header &hdr)

QDateTime date(QDate(Y + 2000, M, D), QTime(h, m, s), QTimeZone::utc());
if (!date.isValid()) {
qWarning("%s: invalid date", qPrintable(path));
qWarning("%s: invalid date", qUtf8Printable(path));
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/data/poi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ TreeNode<QString> POI::loadDir(const QString &path)
if (loadFile(fi.absoluteFilePath()))
tree.addItem(fi.absoluteFilePath());
else
qWarning("%s: %s", qPrintable(fi.absoluteFilePath()),
qPrintable(_errorString));
qWarning("%s: %s", qUtf8Printable(fi.absoluteFilePath()),
qUtf8Printable(_errorString));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/data/slfparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
void SLFParser::warning(const char *text) const
{
const QFile *file = static_cast<QFile *>(_reader.device());
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
qWarning("%s:%lld: %s", qUtf8Printable(file->fileName()),
_reader.lineNumber(), text);
}

Expand Down
2 changes: 1 addition & 1 deletion src/data/tcxparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
void TCXParser::warning(const char *text) const
{
const QFile *file = static_cast<QFile *>(_reader.device());
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
qWarning("%s:%lld: %s", qUtf8Printable(file->fileName()),
_reader.lineNumber(), text);
}

Expand Down
11 changes: 5 additions & 6 deletions src/data/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,24 @@ Track::Track(const TrackData &data) : _pause(0)
bool hasTime = !std::isnan(seg.time.first());

for (int j = 1; j < sd.size(); j++) {
ds = sd.at(j).coordinates().distanceTo(
sd.at(j-1).coordinates());
ds = sd.at(j).coordinates().distanceTo(sd.at(j-1).coordinates());
seg.distance.append(seg.distance.last() + ds);

if (hasTime && sd.at(j).timestamp().isValid()) {
if (sd.at(j).timestamp() > sd.at(j-1).timestamp())
dt = sd.at(j-1).timestamp().msecsTo(
sd.at(j).timestamp()) / 1000.0;
else {
qWarning("%s: %s: time skew detected", qPrintable(
_data.name()), qPrintable(sd.at(j).timestamp().toString(
Qt::ISODate)));
qWarning("%s: %s: time skew detected",
qUtf8Printable(_data.name()),
qUtf8Printable(sd.at(j).timestamp().toString(Qt::ISODate)));
dt = 0;
}
} else {
dt = NAN;
if (hasTime) {
qWarning("%s: missing timestamp(s), time graphs disabled",
qPrintable(_data.name()));
qUtf8Printable(_data.name()));
hasTime = false;
for (int i = 0; i < seg.time.size(); i++)
seg.time[i] = NAN;
Expand Down
2 changes: 1 addition & 1 deletion src/data/waypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void Waypoint::loadSymbolIcons(const QString &dir)
QPixmap pm(files.at(i).absoluteFilePath());
if (pm.isNull())
qWarning("%s: error loading image",
qPrintable(files.at(i).absoluteFilePath()));
qUtf8Printable(files.at(i).absoluteFilePath()));
else
_symbolIcons.insert(files.at(i).baseName(), pm);
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/IMG/gmapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ bool GMAPData::loadTile(const QDir &dir)
if (VectorTile::isTileFile(tt)) {
if (!tile->addFile(fi.absoluteFilePath(), tt)) {
qWarning("%s: Invalid map tile structure",
qPrintable(dir.path()));
qUtf8Printable(dir.path()));
delete tile;
return false;
}
}
}

if (!tile->init()) {
qWarning("%s: Invalid map tile", qPrintable(dir.path()));
qWarning("%s: Invalid map tile", qUtf8Printable(dir.path()));
delete tile;
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/IMG/imgdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ bool IMGData::createTileTree(QFile *file, const TileMap &tileMap)
VectorTile *tile = it.value();

if (!tile->init(file)) {
qWarning("%s: %s: Invalid map tile", qPrintable(_fileName),
qPrintable(it.key()));
qWarning("%s: %s: Invalid map tile", qUtf8Printable(_fileName),
qUtf8Printable(it.key()));
delete tile;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/IMG/rastertile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
if (dynamic_cast<IMGData*>(_data)) {
_file = new QFile(_data->fileName());
if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
qWarning("%s: %s", qPrintable(_file->fileName()),
qPrintable(_file->errorString()));
qWarning("%s: %s", qUtf8Printable(_file->fileName()),
qUtf8Printable(_file->errorString()));
return;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/map/IMG/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ bool Style::parsePolygons(SubFile *file, SubFile::Handle &hdl,

if (!parsePolygon(file, hdl, section, info, type))
qWarning("%s: %x: broken polygon style",
qPrintable(file->fileName()), type);
qUtf8Printable(file->fileName()), type);
}

return true;
Expand All @@ -1201,8 +1201,8 @@ bool Style::parseLines(SubFile *file, SubFile::Handle &hdl,
? 0x10000 | (info.type << 8) | info.subtype : (info.type << 8);

if (!parseLine(file, hdl, section, info, type))
qWarning("%s: %x: broken line style", qPrintable(file->fileName()),
type);
qWarning("%s: %x: broken line style",
qUtf8Printable(file->fileName()), type);
}

return true;
Expand All @@ -1227,8 +1227,8 @@ bool Style::parsePoints(SubFile *file, SubFile::Handle &hdl,
: (info.type << 8) | info.subtype;

if (!parsePoint(file, hdl, section, info, type))
qWarning("%s: %x: broken point style", qPrintable(file->fileName()),
type);
qWarning("%s: %x: broken point style",
qUtf8Printable(file->fileName()), type);
}

return true;
Expand Down Expand Up @@ -1304,7 +1304,7 @@ bool Style::parseTYPFile(SubFile *typ)
&& parsePolygons(typ, hdl, polygons)
&& parseDrawOrder(typ, hdl, order))) {
qWarning("%s: Invalid TYP file, using default style",
qPrintable(typ->fileName()));
qUtf8Printable(typ->fileName()));
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/map/IMG/subfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class SubFile
if (!_file) {
_file = new QFile(subFile->fileName());
if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered))
qWarning("%s: %s", qPrintable(_file->fileName()),
qPrintable(_file->errorString()));
qWarning("%s: %s", qUtf8Printable(_file->fileName()),
qUtf8Printable(_file->errorString()));
_delete = true;
}
_data.resize(subFile->blockSize());
Expand Down
4 changes: 2 additions & 2 deletions src/map/aqmmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ void AQMMap::load(const Projection &in, const Projection &out,

_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
}

void AQMMap::unload()
Expand Down
7 changes: 4 additions & 3 deletions src/map/atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
OziMap::CalibrationType type;
QString cf(calibrationFile(path, type));
if (cf.isNull()) {
qWarning("%s: no calibration file found", qPrintable(path));
qWarning("%s: no calibration file found",
qUtf8Printable(path));
continue;
}
map = new OziMap(cf, type, proj, this);
Expand All @@ -165,8 +166,8 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
if (map->isValid())
_maps.append(map);
else {
qWarning("%s: %s", qPrintable(map->path()),
qPrintable(map->errorString()));
qWarning("%s: %s", qUtf8Printable(map->path()),
qUtf8Printable(map->errorString()));
delete map;
}
}
Expand Down
25 changes: 13 additions & 12 deletions src/map/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,68 +141,69 @@ bool Conversion::loadList(const QString &path)
bool res;

if (!file.open(QFile::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}

while (!csv.atEnd()) {
if (!csv.readEntry(entry)) {
qWarning("%s:%d: Parse error", qPrintable(path), csv.line());
qWarning("%s:%d: Parse error", qUtf8Printable(path), csv.line());
return false;
}
if (entry.size() < 26) {
qWarning("%s:%d: Invalid column count", qPrintable(path),
qWarning("%s:%d: Invalid column count", qUtf8Printable(path),
csv.line() - 1);
return false;
}

QString name(entry.at(0));
int proj = entry.at(1).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid projection code", qPrintable(path),
qWarning("%s:%d: Invalid projection code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int units = entry.at(2).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid linear units code", qPrintable(path),
qWarning("%s:%d: Invalid linear units code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int transform = entry.at(3).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid coordinate transformation code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
int cs = entry.at(4).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid coordinate system code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}

if (!LinearUnits(units).isValid()) {
qWarning("%s:%d: Unknown linear units code", qPrintable(path),
qWarning("%s:%d: Unknown linear units code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
if (!Method(transform).isValid()) {
qWarning("%s:%d: Unknown coordinate transformation code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
if (!CoordinateSystem(cs).isValid()) {
qWarning("%s:%d: Unknown coordinate system code", qPrintable(path),
csv.line() - 1);
qWarning("%s:%d: Unknown coordinate system code",
qUtf8Printable(path), csv.line() - 1);
continue;
}

Setup setup;
int pn = projectionSetup(entry, setup);
if (pn) {
qWarning("%s: %d: Invalid projection parameter #%d",
qPrintable(path), csv.line(), pn);
qUtf8Printable(path), csv.line(), pn);
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/map/dem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ DEM::Entry *DEM::loadTile(const Tile &tile)
} else {
QFile file(path);
if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(file.fileName()),
qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(file.fileName()),
qUtf8Printable(file.errorString()));
return new Entry();
} else
return new Entry(file.readAll());
Expand Down
2 changes: 1 addition & 1 deletion src/map/demloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool DEMLoader::loadTiles(const RectC &rect)
/* Create the user DEM dir only when a download is requested as it will
override the global DEM dir. */
if (!_dir.mkpath(_dir.absolutePath())) {
qWarning("%s: %s", qPrintable(_dir.canonicalPath()),
qWarning("%s: %s", qUtf8Printable(_dir.canonicalPath()),
"Error creating DEM directory");
return false;
}
Expand Down
Loading

0 comments on commit ad13a5b

Please sign in to comment.