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.
This commit is contained in:
parent
47f61df070
commit
58d7bcead3
1
NEWS
1
NEWS
@ -14,6 +14,7 @@ Noteworthy changes in version 1.10.0 (unreleased)
|
|||||||
gpgme_set_ctx_flag EXTENDED: New flag 'auto-key-retrieve'.
|
gpgme_set_ctx_flag EXTENDED: New flag 'auto-key-retrieve'.
|
||||||
cpp: DecryptionResult::isDeVs NEW.
|
cpp: DecryptionResult::isDeVs NEW.
|
||||||
cpp: Signature::isDeVs NEW.
|
cpp: Signature::isDeVs NEW.
|
||||||
|
cpp: EngineInfo::Version::operator> NEW.
|
||||||
py: DecryptResult EXTENDED: New boolean field 'is_de_vs'.
|
py: DecryptResult EXTENDED: New boolean field 'is_de_vs'.
|
||||||
py: Signature EXTENDED: New boolean field 'is_de_vs'.
|
py: Signature EXTENDED: New boolean field 'is_de_vs'.
|
||||||
py: GpgError EXTENDED: Partial results in 'results'.
|
py: GpgError EXTENDED: Partial results in 'results'.
|
||||||
|
@ -71,20 +71,29 @@ public:
|
|||||||
|
|
||||||
bool operator < (const Version& other)
|
bool operator < (const Version& other)
|
||||||
{
|
{
|
||||||
if (major < other.major)
|
if (major > other.major ||
|
||||||
return true;
|
(major == other.major && minor > other.minor) ||
|
||||||
if (minor < other.minor)
|
(major == other.major && minor == other.minor && patch > other.patch) ||
|
||||||
return true;
|
(major >= other.major && minor >= other.minor && patch >= other.patch)) {
|
||||||
if (patch < other.patch)
|
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator < (const char* other)
|
bool operator < (const char* other)
|
||||||
{
|
{
|
||||||
return operator<(Version(other));
|
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)
|
bool operator == (const Version& other)
|
||||||
{
|
{
|
||||||
return major == other.major
|
return major == other.major
|
||||||
|
Loading…
Reference in New Issue
Block a user