From 2b051c6057920c564c13c5d6a3e6dca93446fa12 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 20 Jun 2014 14:09:57 -0400 Subject: [PATCH] Rename HB_VERSION_CHECK and hb_version_check to "atleast" HB_VERSION_CHECK's comparison was originally written wrongly by mistake. When API tests were written, they were also written wrongly to pass given the wrong implementation... Sigh. Given the purpose of this API, there's no point in fixing it without renaming it. As such, rename. API changes: HB_VERSION_CHECK -> HB_VERSION_ATLEAST hb_version_check -> hb_version_atleast --- docs/reference/harfbuzz-sections.txt | 4 ++-- src/hb-common.cc | 10 +++++----- src/hb-version.h.in | 10 +++++----- test/api/test-version.c | 29 ++++++++++++++-------------- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/docs/reference/harfbuzz-sections.txt b/docs/reference/harfbuzz-sections.txt index 973009cf6..3612dad61 100644 --- a/docs/reference/harfbuzz-sections.txt +++ b/docs/reference/harfbuzz-sections.txt @@ -487,12 +487,12 @@ hb_uniscribe_font_get_logfontw
hb-version -HB_VERSION_CHECK +HB_VERSION_ATLEAST HB_VERSION_MAJOR HB_VERSION_MICRO HB_VERSION_MINOR HB_VERSION_STRING hb_version -hb_version_check +hb_version_atleast hb_version_string
diff --git a/src/hb-common.cc b/src/hb-common.cc index 33d2e55f0..da5f4f702 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -569,7 +569,7 @@ hb_version_string (void) } /** - * hb_version_check: + * hb_version_atleast: * @major: * @minor: * @micro: @@ -581,9 +581,9 @@ hb_version_string (void) * Since: 1.0 **/ hb_bool_t -hb_version_check (unsigned int major, - unsigned int minor, - unsigned int micro) +hb_version_atleast (unsigned int major, + unsigned int minor, + unsigned int micro) { - return HB_VERSION_CHECK (major, minor, micro); + return HB_VERSION_ATLEAST (major, minor, micro); } diff --git a/src/hb-version.h.in b/src/hb-version.h.in index 43634f91c..2517160d1 100644 --- a/src/hb-version.h.in +++ b/src/hb-version.h.in @@ -42,8 +42,8 @@ HB_BEGIN_DECLS #define HB_VERSION_STRING "@HB_VERSION@" -#define HB_VERSION_CHECK(major,minor,micro) \ - ((major)*10000+(minor)*100+(micro) >= \ +#define HB_VERSION_ATLEAST(major,minor,micro) \ + ((major)*10000+(minor)*100+(micro) <= \ HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO) @@ -56,9 +56,9 @@ const char * hb_version_string (void); hb_bool_t -hb_version_check (unsigned int major, - unsigned int minor, - unsigned int micro); +hb_version_atleast (unsigned int major, + unsigned int minor, + unsigned int micro); HB_END_DECLS diff --git a/test/api/test-version.c b/test/api/test-version.c index 4c9bd3778..e6378b61c 100644 --- a/test/api/test-version.c +++ b/test/api/test-version.c @@ -46,27 +46,28 @@ test_version (void) g_free (s); g_assert (0 == strcmp (HB_VERSION_STRING, hb_version_string ())); - g_assert (HB_VERSION_CHECK (major, minor, micro)); - g_assert (HB_VERSION_CHECK (major+1, minor, micro)); - g_assert (HB_VERSION_CHECK (major, minor+1, micro)); - g_assert (HB_VERSION_CHECK (major, minor, micro+1)); + g_assert (HB_VERSION_ATLEAST (major, minor, micro)); if (major) - g_assert (!HB_VERSION_CHECK (major-1, minor, micro)); + g_assert (HB_VERSION_ATLEAST (major-1, minor, micro)); if (minor) - g_assert (!HB_VERSION_CHECK (major, minor-1, micro)); + g_assert (HB_VERSION_ATLEAST (major, minor-1, micro)); if (micro) - g_assert (!HB_VERSION_CHECK (major, minor, micro-1)); + g_assert (HB_VERSION_ATLEAST (major, minor, micro-1)); + g_assert (!HB_VERSION_ATLEAST (major+1, minor, micro)); + g_assert (!HB_VERSION_ATLEAST (major, minor+1, micro)); + g_assert (!HB_VERSION_ATLEAST (major, minor, micro+1)); + g_assert (!HB_VERSION_ATLEAST (major, minor, micro+1)); - g_assert (hb_version_check (major, minor, micro)); - g_assert (hb_version_check (major+1, minor, micro)); - g_assert (hb_version_check (major, minor+1, micro)); - g_assert (hb_version_check (major, minor, micro+1)); + g_assert (hb_version_atleast (major, minor, micro)); if (major) - g_assert (!hb_version_check (major-1, minor, micro)); + g_assert (hb_version_atleast (major-1, minor, micro)); if (minor) - g_assert (!hb_version_check (major, minor-1, micro)); + g_assert (hb_version_atleast (major, minor-1, micro)); if (micro) - g_assert (!hb_version_check (major, minor, micro-1)); + g_assert (hb_version_atleast (major, minor, micro-1)); + g_assert (!hb_version_atleast (major+1, minor, micro)); + g_assert (!hb_version_atleast (major, minor+1, micro)); + g_assert (!hb_version_atleast (major, minor, micro+1)); } int