From a34914798f35f584c59e015fedff3e5d12f6dc47 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 14 Oct 2012 19:04:56 +0000 Subject: [PATCH] New API call Xorriso__severity_cmp() --- libisoburn/trunk/libisoburn/libisoburn.ver | 1 + libisoburn/trunk/xorriso/lib_mgt.c | 19 +++++++++++++++++++ libisoburn/trunk/xorriso/parse_exec.c | 15 ++++++++++++++- libisoburn/trunk/xorriso/xorriso.h | 13 ++++++++++++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/libisoburn/trunk/libisoburn/libisoburn.ver b/libisoburn/trunk/libisoburn/libisoburn.ver index a35121b4..7dadb2a2 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.ver +++ b/libisoburn/trunk/libisoburn/libisoburn.ver @@ -118,6 +118,7 @@ Xorriso__dispose_words; Xorriso__get_patch_level_text; Xorriso__is_compatible; Xorriso__preset_signal_behavior; +Xorriso__severity_cmp; Xorriso__version; Xorriso_change_is_pending; Xorriso_destroy; diff --git a/libisoburn/trunk/xorriso/lib_mgt.c b/libisoburn/trunk/xorriso/lib_mgt.c index 22de6efd..fb8ecf88 100644 --- a/libisoburn/trunk/xorriso/lib_mgt.c +++ b/libisoburn/trunk/xorriso/lib_mgt.c @@ -377,6 +377,25 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag) } +int Xorriso__severity_cmp(char *sev1, char *sev2) +{ + int s1= 0x7fffffff, s2= 0x7fffffff, ret; + char *default_sev= "FATAL"; + + ret= Xorriso__text_to_sev(sev1, &s1, 0); + if(ret <= 0) + Xorriso__text_to_sev(default_sev, &s1, 0); + ret= Xorriso__text_to_sev(sev2, &s2, 0); + if(ret <= 0) + Xorriso__text_to_sev(default_sev, &s2, 0); + if(s1 < s2) + return -1; + if(s1 > s2) + return(1); + return(0); +} + + /* @param flag bit0= report libisofs error text bit1= victim is disk_path bit2= do not inquire libisofs, report msg_text and min_severity diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index 8d29e072..ae475d3d 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -1734,7 +1734,7 @@ next_command:; struct Xorriso_lsT *info_list, int *line_count, int flag); int pargc, pflag, max_words; - char **pargv= NULL, *pline, *prefix, *separators; + char **pargv= NULL, *pline, *prefix, *separators, *sev1, *sev2; (*idx)++; if(strcmp(arg1, "push") == 0) { @@ -1805,6 +1805,19 @@ next_command:; for(i= 0; i < pargc; i++) fprintf(stderr, "xorriso_test: argv[%d]= '%s'\n", i, pargv[i]); Xorriso__dispose_words(&pargc, &pargv); + } else if(strcmp(arg1, "severity_cmp") == 0) { + (*idx)+= 2; + sev1= "FATAL"; + if(*idx - 2 < argc) + sev1= argv[*idx - 2]; + sev2= "FATAL"; + if(*idx - 1 < argc) + sev2= argv[*idx - 1]; + ret= Xorriso__severity_cmp(sev1, sev2); + fprintf(stderr, + "xorriso_test: Xorriso__severity_cmp(\"%s\", \"%s\")= %d\n", + sev1, sev2, ret); + } else { fprintf(stderr, "xorriso -test: unknwon mode: %s\n", arg1); } diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index ef0a9e78..eb7e735c 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -524,10 +524,21 @@ int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, int flag); -/* The next two functions are part of Xorriso_eval_problem_status(). +/* The next three functions are part of Xorriso_eval_problem_status(). You may use them to build an own advisor function. */ +/** Compare two severity texts for their severeness. + @since 1.2.6 + @param sev1 First severity text to compare + @param sev2 Second severity text to compare + @return -1 sev1 is less severe than sev2 + 0 sev1 is equally severe to sev2 + 1 sev1 is more severe than sev2 +*/ +int Xorriso__severity_cmp(char *sev1, char *sev2); + + /** Obtain the current problem status of the xorriso handle. @param xorriso The environment handle @param severity The severity text matching the current problem status diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index b7b32510..674e8203 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.10.03.124152" +#define Xorriso_timestamP "2012.10.14.190352"