diff options
Diffstat (limited to 'lib/opencdk/misc.c')
-rw-r--r-- | lib/opencdk/misc.c | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/lib/opencdk/misc.c b/lib/opencdk/misc.c index 065fb7f274..97302475a7 100644 --- a/lib/opencdk/misc.c +++ b/lib/opencdk/misc.c @@ -59,82 +59,6 @@ _cdk_u32tobuf (u32 u, byte *buf) buf[3] = u ; } - -static const char * -parse_version_number (const char *s, int *number) -{ - int val = 0; - - if (*s == '0' && isdigit (s[1])) - return NULL; - /* leading zeros are not allowed */ - for (; isdigit(*s); s++) - { - val *= 10; - val += *s - '0'; - } - *number = val; - return val < 0? NULL : s; -} - - -static const char * -parse_version_string (const char * s, int * major, int * minor, int * micro) -{ - s = parse_version_number( s, major ); - if( !s || *s != '.' ) - return NULL; - s++; - s = parse_version_number (s, minor); - if (!s || *s != '.') - return NULL; - s++; - s = parse_version_number(s, micro); - if (!s) - return NULL; - return s; /* patchlevel */ -} - - -/** - * cdk_check_version: - * @req_version: The requested version - * - * Check that the the version of the library is at minimum the requested - * one and return the version string; return NULL if the condition is - * not satisfied. If a NULL is passed to this function, no check is done, - *but the version string is simply returned. - **/ -const char * -cdk_check_version (const char *req_version) -{ - const char *ver = VERSION; - int my_major, my_minor, my_micro; - int rq_major, rq_minor, rq_micro; - const char *my_plvl, *rq_plvl; - - if (!req_version) - return ver; - my_plvl = parse_version_string (ver, &my_major, &my_minor, &my_micro); - if (!my_plvl) - return NULL; - /* very strange our own version is bogus */ - rq_plvl = parse_version_string (req_version, &rq_major, &rq_minor, - &rq_micro); - if (!rq_plvl) - return NULL; /* req version string is invalid */ - if (my_major > rq_major - || (my_major == rq_major && my_minor > rq_minor) - || (my_major == rq_major && my_minor == rq_minor - && my_micro > rq_micro) - || (my_major == rq_major && my_minor == rq_minor - && my_micro == rq_micro - && strcmp (my_plvl, rq_plvl) >= 0)) - return ver; - return NULL; -} - - /** * cdk_strlist_free: * @sl: the string list |