diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-11-17 08:24:07 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-11-17 12:56:40 -0800 |
commit | d6d3c9a02ffbb739ba197457d465e3e1fddd08d5 (patch) | |
tree | 27a39db4208bc49ecbf9d660b23ec367ec217776 | |
parent | 71389cfa928b22216dc4753f86827f6bc05a1bd2 (diff) | |
download | subsurface-d6d3c9a02ffbb739ba197457d465e3e1fddd08d5.tar.gz |
core: fix incorrect QString::asprintf/vasprintf usage
These are static functions, they cannot be used as a method on an object to
construct that object.
commit aa5f2e7c73 ("cleanup: replace deprecated sprintf()/vsprintf() calls")
introduced this bug in an ill-advised attempt to deal with a deprecation
warning.
This caused us to not print GPS coordinates in the UI.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | core/downloadfromdcthread.cpp | 2 | ||||
-rw-r--r-- | core/qthelper.cpp | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e12c2a74d..d19b39aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- core: fix missing GPS coordinate strings in the UI - core: Gracefully handle infinte MND for oxygen - mobile: add location service warning as required by Google Play - mobile: fix manually adding dives in the past [#2971] diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index a93bba7ab..554618388 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -18,7 +18,7 @@ static QString str_error(const char *fmt, ...) { va_list args; va_start(args, fmt); - const QString str = QString().vasprintf(fmt, args); + const QString str = QString::vasprintf(fmt, args); va_end(args); return str; diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 5e375997a..fd19e78a3 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -107,11 +107,11 @@ QString printGPSCoords(const location_t *location) lonmin = (lon % 1000000U) * 60U; latsec = (latmin % 1000000) * 60; lonsec = (lonmin % 1000000) * 60; - result.asprintf("%u°%02d\'%06.3f\"%s %u°%02d\'%06.3f\"%s", + result = QString::asprintf("%u°%02d\'%06.3f\"%s %u°%02d\'%06.3f\"%s", latdeg, latmin / 1000000, latsec / 1000000, qPrintable(lath), londeg, lonmin / 1000000, lonsec / 1000000, qPrintable(lonh)); } else { - result.asprintf("%f %f", (double) lat / 1000000.0, (double) lon / 1000000.0); + result = QString::asprintf("%f %f", (double) lat / 1000000.0, (double) lon / 1000000.0); } return result; } |