diff --git a/include/ProjectVersion.h b/include/ProjectVersion.h index 2d49c095b4..d9c93ca6e6 100644 --- a/include/ProjectVersion.h +++ b/include/ProjectVersion.h @@ -58,9 +58,6 @@ public: private: - static int compStr(const ProjectVersion & v1, const char * v2); - static int compStr(const ProjectVersion & v1, const QString & v2); - const int m_major; const int m_minor; const int m_release; @@ -85,20 +82,6 @@ inline int compStr(const ProjectVersion & v1, const QString & v2) -inline int compStr(const char * v1, const ProjectVersion & v2) -{ - return ProjectVersion::compare(ProjectVersion(v1), v2); -} - - - -inline int compStr(const QString & v1, const ProjectVersion & v2) -{ - return ProjectVersion::compare(ProjectVersion(v1), v2); -} - - - /* * ProjectVersion v. char[] */ @@ -109,12 +92,12 @@ inline bool operator>=(const ProjectVersion & v1, const char * v2) { return comp inline bool operator==(const ProjectVersion & v1, const char * v2) { return compStr(v1, v2) == 0; } inline bool operator!=(const ProjectVersion & v1, const char * v2) { return compStr(v1, v2) != 0; } -inline bool operator<(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) < 0; } -inline bool operator>(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) > 0; } -inline bool operator<=(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) <= 0; } -inline bool operator>=(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) >= 0; } -inline bool operator==(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) == 0; } -inline bool operator!=(const char * v1, const ProjectVersion & v2) { return compStr(v1, v2) != 0; } +inline bool operator<(const char * v1, const ProjectVersion & v2) { return 0 < compStr(v2, v1); } +inline bool operator>(const char * v1, const ProjectVersion & v2) { return 0 > compStr(v2, v1); } +inline bool operator<=(const char * v1, const ProjectVersion & v2) { return 0 <= compStr(v2, v1); } +inline bool operator>=(const char * v1, const ProjectVersion & v2) { return 0 >= compStr(v2, v1); } +inline bool operator==(const char * v1, const ProjectVersion & v2) { return 0 == compStr(v2, v1); } +inline bool operator!=(const char * v1, const ProjectVersion & v2) { return 0 != compStr(v2, v1); } /* * ProjectVersion v. QString @@ -126,12 +109,12 @@ inline bool operator>=(const ProjectVersion & v1, const QString & v2) { return c inline bool operator==(const ProjectVersion & v1, const QString & v2) { return compStr(v1, v2) == 0; } inline bool operator!=(const ProjectVersion & v1, const QString & v2) { return compStr(v1, v2) != 0; } -inline bool operator<(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) < 0; } -inline bool operator>(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) > 0; } -inline bool operator<=(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) <= 0; } -inline bool operator>=(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) >= 0; } -inline bool operator==(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) == 0; } -inline bool operator!=(const QString & v1, const ProjectVersion & v2) { return compStr(v1, v2) != 0; } +inline bool operator<(const QString & v1, const ProjectVersion & v2) { return 0 < compStr(v2, v1); } +inline bool operator>(const QString & v1, const ProjectVersion & v2) { return 0 > compStr(v2, v1); } +inline bool operator<=(const QString & v1, const ProjectVersion & v2) { return 0 <= compStr(v2, v1); } +inline bool operator>=(const QString & v1, const ProjectVersion & v2) { return 0 >= compStr(v2, v1); } +inline bool operator==(const QString & v1, const ProjectVersion & v2) { return 0 == compStr(v2, v1); } +inline bool operator!=(const QString & v1, const ProjectVersion & v2) { return 0 != compStr(v2, v1); } /* * ProjectVersion v. ProjectVersion diff --git a/src/core/ProjectVersion.cpp b/src/core/ProjectVersion.cpp index 5256b40e18..22014a4424 100644 --- a/src/core/ProjectVersion.cpp +++ b/src/core/ProjectVersion.cpp @@ -25,8 +25,6 @@ */ - - #include "ProjectVersion.h" int ProjectVersion::compare(const ProjectVersion & v1, const ProjectVersion & v2) @@ -38,7 +36,7 @@ int ProjectVersion::compare(const ProjectVersion & v1, const ProjectVersion & v2 // return prematurely for Major comparison if(v1.getCompareType() == CompareType::Major || - v1.getCompareType() == CompareType::Major) + v2.getCompareType() == CompareType::Major) { return 0; } @@ -50,7 +48,7 @@ int ProjectVersion::compare(const ProjectVersion & v1, const ProjectVersion & v2 // return prematurely for Minor comparison if(v1.getCompareType() == CompareType::Minor || - v1.getCompareType() == CompareType::Minor) + v2.getCompareType() == CompareType::Minor) if(v1.getRelease() != v2.getRelease()) { @@ -58,7 +56,7 @@ int ProjectVersion::compare(const ProjectVersion & v1, const ProjectVersion & v2 } if(v1.getCompareType() == CompareType::Build || - v1.getCompareType() == CompareType::Build) + v2.getCompareType() == CompareType::Build) // make sure 0.x.y > 0.x.y-patch if(v1.getBuild().isEmpty())