From 9bae94f30d19bf2c260cb2a4537cac15bc705754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 24 Sep 2018 23:07:11 +0200 Subject: [PATCH] qWarning() mesage formating cleanup --- src/data/data.cpp | 4 ++-- src/data/slfparser.cpp | 2 +- src/data/tcxparser.cpp | 2 +- src/map/downloader.cpp | 10 +++++----- src/map/tar.cpp | 2 +- src/map/tileloader.cpp | 4 ++-- src/map/wmsmap.cpp | 2 +- src/map/wmtsmap.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/data/data.cpp b/src/data/data.cpp index 56f57f24..d8708a17 100644 --- a/src/data/data.cpp +++ b/src/data/data.cpp @@ -98,9 +98,9 @@ bool Data::loadFile(const QString &fileName) file.reset(); } - qWarning("Error loading data file: %s:\n", qPrintable(fileName)); + qWarning("Error loading data file: %s:", qPrintable(fileName)); for (it = _parsers.begin(); it != _parsers.end(); it++) - qWarning("%s: line %d: %s\n", qPrintable(it.key()), + qWarning("%s: line %d: %s", qPrintable(it.key()), it.value()->errorLine(), qPrintable(it.value()->errorString())); _errorLine = 0; diff --git a/src/data/slfparser.cpp b/src/data/slfparser.cpp index f62e2e55..59141ecb 100644 --- a/src/data/slfparser.cpp +++ b/src/data/slfparser.cpp @@ -3,7 +3,7 @@ void SLFParser::warning(const char *text) const { const QFile *file = static_cast(_reader.device()); - qWarning("%s:%lld: %s\n", qPrintable(file->fileName()), + qWarning("%s:%lld: %s", qPrintable(file->fileName()), _reader.lineNumber(), text); } diff --git a/src/data/tcxparser.cpp b/src/data/tcxparser.cpp index a3bef9b2..b554e7b7 100644 --- a/src/data/tcxparser.cpp +++ b/src/data/tcxparser.cpp @@ -4,7 +4,7 @@ void TCXParser::warning(const char *text) const { const QFile *file = static_cast(_reader.device()); - qWarning("%s:%lld: %s\n", qPrintable(file->fileName()), + qWarning("%s:%lld: %s", qPrintable(file->fileName()), _reader.lineNumber(), text); } diff --git a/src/map/downloader.cpp b/src/map/downloader.cpp index feb938a5..3d414875 100644 --- a/src/map/downloader.cpp +++ b/src/map/downloader.cpp @@ -90,7 +90,7 @@ bool Downloader::doDownload(const Download &dl, QUrl url(dl.url()); if (!url.isValid() || !(url.scheme() == "http" || url.scheme() == "https")) { - qWarning("%s: Invalid URL\n", qPrintable(url.toString())); + qWarning("%s: Invalid URL", qPrintable(url.toString())); if (redirect) _errorDownloads.insert(redirect->origin(), RETRIES); return false; @@ -138,7 +138,7 @@ bool Downloader::saveToDisk(const QString &filename, QIODevice *data) QFile file(filename); if (!file.open(QIODevice::WriteOnly)) { - qWarning("Error writing file: %s: %s\n", + qWarning("Error writing file: %s: %s", qPrintable(filename), qPrintable(file.errorString())); return false; } @@ -166,11 +166,11 @@ void Downloader::downloadFinished(QNetworkReply *reply) QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl(); if (origin.isEmpty()) { insertError(url, error); - qWarning("Error downloading file: %s: %s\n", + qWarning("Error downloading file: %s: %s", url.toEncoded().constData(), qPrintable(reply->errorString())); } else { insertError(origin, error); - qWarning("Error downloading file: %s -> %s: %s\n", + qWarning("Error downloading file: %s -> %s: %s", origin.toEncoded().constData(), url.toEncoded().constData(), qPrintable(reply->errorString())); } @@ -186,7 +186,7 @@ void Downloader::downloadFinished(QNetworkReply *reply) if (level >= MAX_REDIRECT_LEVEL) { _errorDownloads.insert(origin, RETRIES); qWarning("Error downloading file: %s: " - "redirect level limit reached (redirect loop?)\n", + "redirect level limit reached (redirect loop?)", origin.toEncoded().constData()); } else { QUrl redirectUrl; diff --git a/src/map/tar.cpp b/src/map/tar.cpp index 5f45d957..9cbbe474 100644 --- a/src/map/tar.cpp +++ b/src/map/tar.cpp @@ -96,7 +96,7 @@ bool Tar::loadTmi(const QString &path) QByteArray line = file.readLine(); int pos = line.indexOf(':'); if (line.size() < 10 || pos < 7 || !line.startsWith("block")) { - qWarning("%s:%d: syntax error\n", qPrintable(path), ln); + qWarning("%s:%d: syntax error", qPrintable(path), ln); _index.clear(); return false; } diff --git a/src/map/tileloader.cpp b/src/map/tileloader.cpp index b0eb1b92..b0acd87d 100644 --- a/src/map/tileloader.cpp +++ b/src/map/tileloader.cpp @@ -7,7 +7,7 @@ static bool loadTileFile(Tile &tile, const QString &file) { if (!tile.pixmap().load(file)) { - qWarning("%s: error loading tile file\n", qPrintable(file)); + qWarning("%s: error loading tile file", qPrintable(file)); return false; } @@ -18,7 +18,7 @@ TileLoader::TileLoader(const QString &dir, QObject *parent) : QObject(parent), _dir(dir) { if (!QDir().mkpath(_dir)) - qWarning("%s: %s\n", qPrintable(_dir), "Error creating tiles directory"); + qWarning("%s: %s", qPrintable(_dir), "Error creating tiles directory"); _downloader = new Downloader(this); connect(_downloader, SIGNAL(finished()), this, SIGNAL(finished())); diff --git a/src/map/wmsmap.cpp b/src/map/wmsmap.cpp index 37fa2878..a59cae43 100644 --- a/src/map/wmsmap.cpp +++ b/src/map/wmsmap.cpp @@ -118,7 +118,7 @@ void WMSMap::clearCache() _zoom = 0; if (!loadWMS()) - qWarning("%s: %s\n", qPrintable(_name), qPrintable(_errorString)); + qWarning("%s: %s", qPrintable(_name), qPrintable(_errorString)); } QRectF WMSMap::bounds() diff --git a/src/map/wmtsmap.cpp b/src/map/wmtsmap.cpp index 9ec21a79..21634605 100644 --- a/src/map/wmtsmap.cpp +++ b/src/map/wmtsmap.cpp @@ -52,7 +52,7 @@ void WMTSMap::clearCache() _zoom = 0; if (!loadWMTS()) - qWarning("%s: %s\n", qPrintable(_name), qPrintable(_errorString)); + qWarning("%s: %s", qPrintable(_name), qPrintable(_errorString)); } QString WMTSMap::tilesDir() const