Tests for version of libjte, new API call isoburn_libjte_req()

This commit is contained in:
2010-10-04 15:51:37 +00:00
parent f46bcf9d5f
commit 0159052d92
5 changed files with 90 additions and 8 deletions

View File

@ -31,6 +31,9 @@
#include <time.h>
#include <regex.h>
#ifdef Xorriso_with_libjtE
#include <libjte/libjte.h>
#endif
#ifndef Xorriso_standalonE
@ -69,10 +72,10 @@ static int isoburn_emulate_toc(struct burn_drive *d, int flag);
int isoburn_initialize(char msg[1024], int flag)
{
int major, minor, micro, bad_match= 0;
int major, minor, micro, bad_match= 0, no_iso_init= 0;
/* First two ugly compile time checks for header version compatibility.
/* First the ugly compile time checks for header version compatibility.
If everthing matches, then they produce no C code. In case of mismatch,
intentionally faulty C code will be inserted.
*/
@ -108,7 +111,7 @@ int isoburn_initialize(char msg[1024], int flag)
#ifdef Isoburn_libisofs_dot_h_too_olD
LIBISOFS_MISCONFIGURATION = 0;
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_h = 0;
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_c = 0;
LIBISOFS_MISCONFIGURATION_ = 0;
#endif
@ -149,14 +152,62 @@ INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libburn_dot_h_TOO_OLD__SEE_libisobu
LIBBURN_MISCONFIGURATION_ = 0;
#endif
#ifdef Xorriso_with_libjtE
/* The minimum requirement of libisoburn towards the libjte header
at compile time is the same as the one of a usable libisfs itowards libjte.
So the requirement is defined in libisofs/libisofs.h :
iso_libjte_req_major , iso_libjte_req_minor , iso_libjte_req_micro
*/
/* The indendation is an advise of man gcc to help old compilers ignoring */
#if iso_libjte_req_major > LIBJTE_VERSION_MAJOR
#define Libisofs_libjte_dot_h_too_olD 1
#endif
#if iso_libjte_req_major == LIBJTE_VERSION_MAJOR && iso_libjte_req_minor > LIBJTE_VERSION_MINOR
#define Libisofs_libjte_dot_h_too_olD 1
#endif
#if iso_libjte_req_minor == LIBJTE_VERSION_MINOR && iso_libjte_req_micro > LIBJTE_VERSION_MICRO
#define Libisofs_libjte_dot_h_too_olD 1
#endif
#ifdef Libisofs_libjte_dot_h_too_olD
LIBJTE_MISCONFIGURATION = 0;
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libjte_dot_h_TOO_OLD__SEE_libisofs_dot_h_AND_burn_wrap.c_c = 0;
LIBJTE_MISCONFIGURATION_ = 0;
#endif
#endif /* Xorriso_with_libjtE */
/* End of ugly compile time tests (scroll up for explanation) */
msg[0]= 0;
if(iso_init()<0) {
sprintf(msg+strlen(msg), "Cannot initialize libisofs\n");
return(0);
#ifdef Xorriso_with_libjtE
libjte__version(&major, &minor, &micro);
sprintf(msg + strlen(msg), "libjte-%d.%d.%d ", major, minor, micro);
if (libjte__is_compatible(LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR,
LIBJTE_VERSION_MICRO, 0)) {
sprintf(msg+strlen(msg), "ok, ");
} else {
sprintf(msg + strlen(msg),
"- TOO OLD -, need at least libjte-%d.%d.%d ,\n",
LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR,
LIBJTE_VERSION_MICRO);
bad_match= 1;
no_iso_init= 1; /* iso_init() will fail anyway */
}
#endif /* Xorriso_with_libjtE */
if(!no_iso_init) {
if(iso_init()<0) {
sprintf(msg+strlen(msg), "Cannot initialize libisofs\n");
return(0);
}
}
iso_lib_version(&major, &minor, &micro);
sprintf(msg+strlen(msg), "libisofs-%d.%d.%d ", major, minor, micro);
@ -233,6 +284,16 @@ int isoburn_libburn_req(int *major, int *minor, int *micro)
}
/* API @since 0.6.4 */
int isoburn_libjte_req(int *major, int *minor, int *micro)
{
*major= LIBJTE_VERSION_MAJOR;
*minor= LIBJTE_VERSION_MINOR;
*micro= LIBJTE_VERSION_MICRO;
return(1);
}
int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code,
char msg_text[], int os_errno,
char severity[], int flag),