aboutsummaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-14 17:50:48 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-14 17:50:48 -0800
commit06bbf9f4c8a0f99a44363d7ebadc978cf0072cfc (patch)
tree7bf6400155b2763db41d017b94ab232fd1ceef61 /qthelper.cpp
parent12f422a1a3468d5c29e99bb2c388248680227025 (diff)
downloadsubsurface-06bbf9f4c8a0f99a44363d7ebadc978cf0072cfc.tar.gz
Use C API for printGPSCoords
This way we can call this helper from both C and C++ code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index 902dc5e6d..8d4703b0a 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -31,7 +31,7 @@ QString weight_string(int weight_in_grams)
return (str);
}
-QString printGPSCoords(int lat, int lon)
+extern "C" const char *printGPSCoords(int lat, int lon)
{
unsigned int latdeg, londeg;
unsigned int latmin, lonmin;
@@ -39,7 +39,7 @@ QString printGPSCoords(int lat, int lon)
QString lath, lonh, result;
if (!lat && !lon)
- return QString();
+ return strdup("");
lath = lat >= 0 ? translate("gettextFromC", "N") : translate("gettextFromC", "S");
lonh = lon >= 0 ? translate("gettextFromC", "E") : translate("gettextFromC", "W");
@@ -54,7 +54,7 @@ QString printGPSCoords(int lat, int lon)
result.sprintf("%u%s%02d\'%06.3f\"%s %u%s%02d\'%06.3f\"%s",
latdeg, UTF8_DEGREE, latmin / 1000000, latsec / 1000000, lath.toUtf8().data(),
londeg, UTF8_DEGREE, lonmin / 1000000, lonsec / 1000000, lonh.toUtf8().data());
- return result;
+ return strdup(result.toUtf8().data());
}
static bool parseCoord(const QString& txt, int& pos, const QString& positives,