summaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-20 07:59:50 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-20 07:59:50 -0800
commit2882a1ef412643ae29bf4dca12195063764393ff (patch)
tree3be133bc03d231755e22923fe611ca42e2ddabc9 /subsurface-core
parentc819d40c19e4983f0deac4dff671bb25aabfc116 (diff)
downloadsubsurface-2882a1ef412643ae29bf4dca12195063764393ff.tar.gz
Remove the non-canonical Subusrface version
It no longer makes sense to lie about the version. If you are running a product build, then the canonical version is the same version as the plain version used to be. And in either case it makes much more sense to simply log the full version information. We used to have the differently styled versions for different OSs, but I don't think this is needed anymore. Let's hope this doesn't go down as one of these "famous last words" moments... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/qthelper.cpp11
-rw-r--r--subsurface-core/qthelperfromc.h1
-rw-r--r--subsurface-core/save-git.c2
-rw-r--r--subsurface-core/version.c5
-rw-r--r--subsurface-core/version.h1
5 files changed, 11 insertions, 9 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index a840f4dd2..d55e8438f 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -791,9 +791,9 @@ QString getUserAgent()
// fill in the system data - use ':' as separator
// replace all other ':' with ' ' so that this is easy to parse
#ifdef SUBSURFACE_MOBILE
- QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_canonical_version());
#else
- QString userAgent = QString("Subsurface:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface:%1:").arg(subsurface_canonical_version());
#endif
userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":");
arch = SubsurfaceSysInfo::buildCpuArchitecture().replace(':', ' ');
@@ -805,6 +805,13 @@ QString getUserAgent()
}
+extern "C" const char *subsurface_user_agent()
+{
+ static QString uA = getUserAgent();
+
+ return strdup(qPrintable(uA));
+}
+
QString uiLanguage(QLocale *callerLoc)
{
QString shortDateFormat;
diff --git a/subsurface-core/qthelperfromc.h b/subsurface-core/qthelperfromc.h
index d2e80144c..32aed8949 100644
--- a/subsurface-core/qthelperfromc.h
+++ b/subsurface-core/qthelperfromc.h
@@ -17,5 +17,6 @@ void cache_picture(struct picture *picture);
char *cloud_url();
char *hashfile_name_string();
char *picturedir_string();
+const char *subsurface_user_agent();
#endif // QTHELPERFROMC_H
diff --git a/subsurface-core/save-git.c b/subsurface-core/save-git.c
index 9bdf9dfd0..310882606 100644
--- a/subsurface-core/save-git.c
+++ b/subsurface-core/save-git.c
@@ -1047,7 +1047,7 @@ static void create_commit_message(struct membuffer *msg)
} while ((dc = dc->next) != NULL);
put_format(msg, "\n");
}
- put_format(msg, "Created by subsurface %s\n", subsurface_version());
+ put_format(msg, "Created by subsurface %s\n", subsurface_user_agent());
}
static int create_new_commit(git_repository *repo, const char *remote, const char *branch, git_oid *tree_id)
diff --git a/subsurface-core/version.c b/subsurface-core/version.c
index 5b54bf4c7..98207efe2 100644
--- a/subsurface-core/version.c
+++ b/subsurface-core/version.c
@@ -1,10 +1,5 @@
#include "ssrf-version.h"
-const char *subsurface_version(void)
-{
- return VERSION_STRING;
-}
-
const char *subsurface_git_version(void)
{
return GIT_VERSION_STRING;
diff --git a/subsurface-core/version.h b/subsurface-core/version.h
index bc0aac00d..98385e970 100644
--- a/subsurface-core/version.h
+++ b/subsurface-core/version.h
@@ -5,7 +5,6 @@
extern "C" {
#endif
-const char *subsurface_version(void);
const char *subsurface_git_version(void);
const char *subsurface_canonical_version(void);