clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 07193d0a3c4a9f921504908ce494acef2e2be74c
parent 06a01ce4df23554c67068871a5df4515b67b893f
Author: Paul Walker <paul@pwjw.com>
Date:   Fri, 30 Dec 2022 15:01:41 -0500

Correct CLAP_VERSION_LT

CLAP_VERSION_LT was backwards; it compared if the argument was less
than current, not if current was less than the argument. This is
really counter-intuitive so change it quickly.

Diffstat:
MChangeLog.md | 5+++++
Minclude/clap/version.h | 8++++----
Msrc/main.cc | 20++++++++++++++++++++
3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md @@ -1,3 +1,8 @@ +# Changes in 1.1.6 + +* [version.h](include/clap/version.h) `CLAP_VERSION_LT` was backwards (comparing current with arg + vs arg with current). Correct and enhance tests. + # Changes in 1.1.5 * [plugin.h](include/clap/plugin.h): clarify plugin state after init() diff --git a/include/clap/version.h b/include/clap/version.h @@ -22,14 +22,14 @@ typedef struct clap_version { #define CLAP_VERSION_MAJOR 1 #define CLAP_VERSION_MINOR 1 -#define CLAP_VERSION_REVISION 5 +#define CLAP_VERSION_REVISION 6 #define CLAP_VERSION_INIT \ { (uint32_t)CLAP_VERSION_MAJOR, (uint32_t)CLAP_VERSION_MINOR, (uint32_t)CLAP_VERSION_REVISION } -#define CLAP_VERSION_LT(maj,min,rev) (((maj) < CLAP_VERSION_MAJOR) || \ - ((maj) == CLAP_VERSION_MAJOR && (min) < CLAP_VERSION_MINOR ) || \ - ((maj) == CLAP_VERSION_MAJOR && (min) == CLAP_VERSION_MINOR && (rev) < CLAP_VERSION_REVISION)) +#define CLAP_VERSION_LT(maj,min,rev) ((CLAP_VERSION_MAJOR < (maj)) || \ + ((maj) == CLAP_VERSION_MAJOR && CLAP_VERSION_MINOR < (min)) || \ + ((maj) == CLAP_VERSION_MAJOR && (min) == CLAP_VERSION_MINOR && CLAP_VERSION_REVISION < (rev))) #define CLAP_VERSION_EQ(maj,min,rev) (((maj) == CLAP_VERSION_MAJOR) && ((min) == CLAP_VERSION_MINOR) && ((rev) == CLAP_VERSION_REVISION)) #define CLAP_VERSION_GE(maj,min,rev) (!CLAP_VERSION_LT(maj,min,rev)) diff --git a/src/main.cc b/src/main.cc @@ -28,6 +28,26 @@ #error CLAP_VERSION_GE was inroduced in 1.1.5 so we should be later than that version. #endif +#if !CLAP_VERSION_LT(CLAP_VERSION_MAJOR + 1, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION) +#error CLAP_VERSION_LT is inconsistent (MAJOR) +#endif +#if !CLAP_VERSION_LT(CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR + 1, CLAP_VERSION_REVISION) +#error CLAP_VERSION_LT is inconsistent (MINOR) +#endif +#if !CLAP_VERSION_LT(CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION + 1) +#error CLAP_VERSION_LT is inconsistent (REVISION) +#endif + +#if CLAP_VERSION_LT(CLAP_VERSION_MAJOR - 1, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION) +#error CLAP_VERSION_LT is inconsistent (MAJOR) +#endif +#if CLAP_VERSION_LT(CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR - 1, CLAP_VERSION_REVISION) +#error CLAP_VERSION_LT is inconsistent (MINOR) +#endif +#if CLAP_VERSION_LT(CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION - 1) +#error CLAP_VERSION_LT is inconsistent (REVISION) +#endif + static const CLAP_CONSTEXPR clap_version m = CLAP_VERSION; int main(int, char **) {