aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2017-09-04 09:23:56 +0000
committerAndre Heinecke <[email protected]>2017-09-04 09:23:56 +0000
commit58d7bcead3394fa80c2a05d0d1e0fb4d9a1048b0 (patch)
treed8eabd6e9ed1c9f1391eabd260cbfe2f71e7cf37 /lang/cpp/src
parentcore: New context flag "auto-key-retrieve" (diff)
downloadgpgme-58d7bcead3394fa80c2a05d0d1e0fb4d9a1048b0.tar.gz
gpgme-58d7bcead3394fa80c2a05d0d1e0fb4d9a1048b0.zip
cpp: Fix version info comparison
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<): Fix logic. * lang/cpp/src/engineinfo.h (EngineInfo::Version::operator>): New. * NEWS: Mention added API -- This fixes a logic error that 2.2.0 < 2.1.19 would return true.
Diffstat (limited to '')
-rw-r--r--lang/cpp/src/engineinfo.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
index b216de80..cd1b7a72 100644
--- a/lang/cpp/src/engineinfo.h
+++ b/lang/cpp/src/engineinfo.h
@@ -71,13 +71,13 @@ public:
bool operator < (const Version& other)
{
- if (major < other.major)
- return true;
- if (minor < other.minor)
- return true;
- if (patch < other.patch)
- return true;
- return false;
+ if (major > other.major ||
+ (major == other.major && minor > other.minor) ||
+ (major == other.major && minor == other.minor && patch > other.patch) ||
+ (major >= other.major && minor >= other.minor && patch >= other.patch)) {
+ return false;
+ }
+ return true;
}
bool operator < (const char* other)
@@ -85,6 +85,15 @@ public:
return operator<(Version(other));
}
+ bool operator > (const char* other)
+ {
+ return !operator<(Version(other));
+ }
+
+ bool operator > (const Version & other)
+ {
+ return !operator<(other);
+ }
bool operator == (const Version& other)
{
return major == other.major