Browse Source

Added iso_lib_is_compatible() function.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent
commit
69d0503053
  1. 8
      libisofs/libisofs.h
  2. 14
      libisofs/util.c

8
libisofs/libisofs.h

@ -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.

14
libisofs/util.c

@ -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)));
}

Loading…
Cancel
Save