Added iso_lib_is_compatible() function.

This commit is contained in:
Vreixo Formoso 2008-01-29 20:16:06 +01:00
parent 6434de535c
commit 69d0503053
2 changed files with 22 additions and 0 deletions

View File

@ -557,6 +557,14 @@ int iso_image_new(const char *name, IsoImage **image);
*/
void iso_lib_version(int *major, int *minor, int *micro);
/**
* Check if the library is ABI compatible with the given version.
*
* @return
* 1 lib is compatible, 0 is not.
*/
int iso_lib_is_compatible(int major, int minor, int micro);
/**
* Creates an IsoWriteOpts for writing an image. You should set the options
* desired with the correspondent setters.

View File

@ -1248,3 +1248,17 @@ void iso_lib_version(int *major, int *minor, int *micro)
*minor = LIBISOFS_MINOR_VERSION;
*micro = LIBISOFS_MICRO_VERSION;
}
int iso_lib_is_compatible(int major, int minor, int micro)
{
int cmajor, cminor, cmicro;
/* for now, the rule is that library is compitable if requested
* version is lower */
iso_lib_version(&cmajor, &cminor, &cmicro);
return cmajor > major
|| (cmajor == major
&& (cminor > minor
|| (cminor == minor && cmicro >= micro)));
}