From 9e5ba80e29fdbd8105cc734b3393376eb569e047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Sun, 17 Jan 2021 11:34:37 +0100 Subject: [PATCH] chore: better use of configure features --- .github/workflows/release.yml | 8 +-- .github/workflows/tests.yml | 6 +- INSTALL | 2 +- Makefile | 5 +- README.md | 2 +- configure | 58 ++++++++++------- scripts/bash-based-configure | 15 ++++- scripts/time-stamper.bash | 2 +- src/closure.c | 12 ++-- src/ds-marker.c | 24 +++---- src/dvdisaster.c | 8 +-- src/dvdisaster.h | 51 +++++++-------- src/ecc-rs01.c | 6 +- src/ecc-rs02.c | 6 +- src/ecc-rs03.c | 6 +- src/image.c | 8 +-- src/large-io.c | 6 +- src/medium-info.c | 40 ++++++------ src/misc.c | 48 +++++++------- src/raw-sector-cache.c | 6 +- src/read-adaptive.c | 116 +++++++++++++++++----------------- src/read-linear.c | 82 ++++++++++++------------ src/rs01-common.c | 12 ++-- src/rs01-create.c | 52 +++++++-------- src/rs01-fix.c | 36 +++++------ src/rs01-includes.h | 6 +- src/rs01-verify.c | 92 +++++++++++++-------------- src/rs02-common.c | 2 +- src/rs02-create.c | 42 ++++++------ src/rs02-fix.c | 34 +++++----- src/rs02-includes.h | 6 +- src/rs02-recognize.c | 8 +-- src/rs02-verify.c | 68 ++++++++++---------- src/rs03-create.c | 50 +++++++-------- src/rs03-fix.c | 40 ++++++------ src/rs03-includes.h | 8 +-- src/rs03-verify.c | 92 +++++++++++++-------------- src/scsi-layer.c | 8 +-- src/udf.c | 2 +- 39 files changed, 550 insertions(+), 525 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 680ef07..edda455 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: msystem: MINGW32 grep: 386 - ui: cli - clionly: 1 + clionly: --with-cli-only defaults: run: shell: msys2 {0} @@ -37,9 +37,7 @@ jobs: shell: bash - uses: actions/checkout@v2 - name: configure - env: - CLI_ONLY: ${{ matrix.clionly }} - run: ./configure + run: ./configure ${{ matrix.clionly }} - name: make run: nproc && make -j$(nproc) - name: check executable @@ -80,7 +78,7 @@ jobs: - name: install prerequisites run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man - name: configure - run: env CLI_ONLY=1 ./configure + run: ./configure --with-cli-only - name: make run: nproc && make -j$(nproc) && make static && mv -f dvdisaster-static dvdisaster - name: check executable diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 722b3ef..4a65f76 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -89,7 +89,7 @@ jobs: shell: bash - uses: actions/checkout@v2 - name: configure - run: env CLI_ONLY=1 ./configure + run: ./configure --with-cli-only - name: make run: nproc && make -j$(nproc) - name: check executable @@ -125,7 +125,7 @@ jobs: shell: bash - uses: actions/checkout@v2 - name: configure - run: env CLI_ONLY=1 ./configure + run: ./configure --with-cli-only - name: make run: nproc && make -j$(nproc) - name: check executable @@ -153,7 +153,7 @@ jobs: - name: install prerequisites run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man jq - name: configure - run: env CLI_ONLY=1 ./configure + run: ./configure --with-cli-only - name: make run: nproc && make -j$(nproc) - name: check executability diff --git a/INSTALL b/INSTALL index 595d4bc..49225c4 100644 --- a/INSTALL +++ b/INSTALL @@ -130,7 +130,7 @@ user@host> ./configure If you want to build a CLI-only version, which doesn't depend on the gtk2 libraries, you can run instead: -user@host> CLI_ONLY=1 ./configure +user@host> ./configure --with-cli-only The script will possibly print some errors about missing libraries. Type "configure --help" to learn about pointing configure diff --git a/Makefile b/Makefile index 673e935..70c2011 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,9 @@ all: @echo @echo "Please run \`./configure' first." - @echo "To build a CLI-only version," - @echo "run \`CLI_ONLY=1 ./configure' instead." + @echo + @echo "To build a CLI-only version, run `./configure --with-cli-only'." + @echo @echo "Note that dvdisaster requires GNU make to build." @echo "Under non-Linux systems, it might be known as \`gmake'." @echo diff --git a/README.md b/README.md index 1a14de2..3b60d06 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This version is built on top of the latest upstream version, with the following - Most Debian patches have been applied, those specific to Debian have been omitted - Windows build supported again, it was dropped upstream a few versions back -- A CLI-only version, not depending on gtk (`CLI_ONLY=1 ./configure && make clean && make -j4`) +- A CLI-only version, not depending on gtk (`./configure --with-cli-only && make clean && make -j4`) - Regression tests confirmed working on Linux64, Windows32 and Windows64, for normal and CLI-only builds - Added pre-defined sizes for BD-R Triple Layer (100GB), BD-R Quadruple Layer (128GB) diff --git a/configure b/configure index a448bbf..98e5b90 100755 --- a/configure +++ b/configure @@ -4,26 +4,10 @@ BASH_BASED_CONFIGURE=./scripts/bash-based-configure BASH_BASED_CONFIGURE_OPTS="--buildtmp=$(pwd)/build $@" -REQUIRED_CFLAGS="-DPATCHLEVEL=5 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I. -pipe" +REQUIRED_CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I. -pipe" RECOMMENDED_CFLAGS="-O2 -fomit-frame-pointer -Wall -Wno-unknown-warning-option -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-format-zero-length" DEBUG_CFLAGS="-ggdb -Wall" -if [ "$CLI_ONLY" = 1 ]; then - REQUIRED_CFLAGS="-DCLI $REQUIRED_CFLAGS" -fi - -if [ "$DEBUG_PRINTF_FORMAT" = 1 ]; then - # don't use the binary compiled with this, - # it's only useful to properly get all the build-time - # warnings around printf-errors, that are otherwise - # not catched by the compiler because of the _() macro - REQUIRED_CFLAGS="-DDEBUG_PRINTF_FORMAT $REQUIRED_CFLAGS" -else - # warnings given by -Wformat-security are bogus because of _(), - # see above comment if you actually want to check for format errors - RECOMMENDED_CFLAGS="$RECOMMENDED_CFLAGS -Wno-format-security" -fi - CFG_USE_CYGWIN="no" # do not change if test -e $BASH_BASED_CONFIGURE; then @@ -37,8 +21,8 @@ fi # Set the package name and version PACKAGE dvdisaster 0.79.6 -CFG_HAVE_OPTIONS="$CFG_HAVE_OPTIONS -DHAVE_UNSTABLE_RELEASE" - +DEFINE_INT PATCHLEVEL 5 +DEFINE_STRING HAVE_UNSTABLE_RELEASE 1 # Check for some essential tools. @@ -60,12 +44,22 @@ GET_LOCALEDIR GET_BUILDROOT GET_BUILDTMP +PRINT_MESSAGE "\nDetermining build flavor:" + +# old way of specifying --with-cli-only +if [ "$CLI_ONLY" = 1 ]; then + cfg_with_cli_only=yes + unset CLI_ONLY +fi + +WITH_OPTION cli-only no "[yes | no]" + # Look for required libraries PRINT_MESSAGE "\nLooking for includes and libraries:" REQUIRE_GLIB2 2 32 0 -if [ "$CLI_ONLY" != 1 ]; then +if test "$cfg_with_cli_only" != "yes"; then REQUIRE_GTK2 2 6 0 WITH_THREADS fi echo @@ -129,7 +123,7 @@ if ! EXECUTE_PROGRAM "xgettext --help" xgettext \ cfg_force_with_nls=no fi -if [ "$CLI_ONLY" != 1 ]; then +if test "$cfg_with_cli_only" != "yes"; then if ! EXECUTE_PROGRAM "gdk-pixbuf-csource --help" gdk_pixbuf_csource ; then echo "* gdk-pixbuf not installed" echo "* or path to gdk-pixbuf-csource is missing." @@ -147,6 +141,24 @@ WITH_OPTION embedded-src-path yes "[yes | no]" PRINT_MESSAGE "\nDebugging options (do not use in production system):" WITH_OPTION memdebug no "[no | yes]" +WITH_OPTION debug-printf-format no "[no | yes]" +WITH_OPTION werror no "[no | yes]" + +if test "$cfg_with_debug_printf_format" == "yes"; then + # don't use the binary compiled with this, + # it's only useful to properly get all the build-time + # warnings around printf-errors, that are otherwise + # not catched by the compiler because of the _() macro + DEFINE_STRING DEBUG_PRINTF_FORMAT 1 +else + # warnings given by -Wformat-security are bogus because of _(), + # see above comment if you actually want to check for format errors + CFG_CFLAGS="$CFG_CFLAGS -Wno-format-security" +fi + +if test "$cfg_with_werror" == "yes"; then + CFG_CFLAGS="$CFG_CFLAGS -Werror" +fi if test "$cfg_with_efence" == "yes"; then if ! CHECK_LIBRARY efence malloc efence; then @@ -172,7 +184,7 @@ cfiles="src/method-link.c" ofiles="$BUILDTMP/method-link.o" for cfile in src/*.c; do - if [ "$CLI_ONLY" = 1 ]; then + if test "$cfg_with_cli_only" == "yes"; then grep -q 'DVDISASTER_GUI_FILE' "$cfile" && continue fi cfile_prefix=`echo $cfile | sed -e 's/\.c//'` @@ -184,7 +196,7 @@ done echo echo -e "\nCFG_CFILES = $cfiles" >> Makefile.config echo "CFG_OFILES = $ofiles" >> Makefile.config -if [ "$CLI_ONLY" != 1 ]; then +if test "$cfg_with_cli_only" != "yes"; then echo "ICONS = src/inlined-icons.h" >> Makefile.config fi diff --git a/scripts/bash-based-configure b/scripts/bash-based-configure index 641c782..cd6c136 100644 --- a/scripts/bash-based-configure +++ b/scripts/bash-based-configure @@ -470,7 +470,7 @@ function PACKAGE() echo "CFG_VERSION = $VERSION" >> Makefile.config } -# Add -D$1=$2 to CFG_OTHER_OPTIONS +# Add -D$1="$2" to CFG_OTHER_OPTIONS function DEFINE_STRING() { @@ -483,6 +483,19 @@ function DEFINE_STRING() CFG_OTHER_OPTIONS="$CFG_OTHER_OPTIONS -D$1=\\\"$2\\\"" } +# Add -D$1=$2 to CFG_OTHER_OPTIONS + +function DEFINE_INT() +{ + if test -z "$1" || test -z "$2"; then + echo "DEFINE_INT $1 $2:" + echo " needs two arguments" + exit 1; + fi + + CFG_OTHER_OPTIONS="$CFG_OTHER_OPTIONS -D$1=$2" +} + # Add CFG_$1 = $2 to makefile function DEFINE_VAR() diff --git a/scripts/time-stamper.bash b/scripts/time-stamper.bash index b31003a..4efc96a 100755 --- a/scripts/time-stamper.bash +++ b/scripts/time-stamper.bash @@ -2,7 +2,7 @@ build=$(grep BUILDNUM $1 2>/dev/null | cut -d\ -f3) build=$((build+1)) cat >$1 <... string */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void UpdateMarkup(char **string, GdkColor *color) { int hexval; @@ -339,7 +339,7 @@ void ReadDotfile() if(!strcmp(symbol, "verbose")) { Closure->verbose = atoi(value); continue; } if(!strcmp(symbol, "welcome-msg")) { Closure->welcomeMessage = atoi(value); continue; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!strcmp(symbol, "positive-text")) { get_color(Closure->greenText, value); UpdateMarkup(&Closure->greenMarkup, Closure->greenText); continue; @@ -445,7 +445,7 @@ static void update_dotfile() g_fprintf(dotfile, "verbose: %d\n", Closure->verbose); g_fprintf(dotfile, "welcome-msg: %d\n\n", Closure->welcomeMessage); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES save_colors(dotfile, "positive-text", Closure->greenText); save_colors(dotfile, "negative-text", Closure->redText); save_colors(dotfile, "bar-color", Closure->barColor); @@ -566,7 +566,7 @@ void InitClosure() Closure->bdSize3 = Closure->savedBDSize3 = BDXL_TL_SIZE; Closure->bdSize4 = Closure->savedBDSize4 = BDXL_QL_SIZE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->logString = g_string_sized_new(1024); Closure->logLock = g_malloc0(sizeof(GMutex)); g_mutex_init(Closure->logLock); @@ -633,7 +633,7 @@ void cond_free_ptr_array(GPtrArray *a) void FreeClosure() { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) #endif /* in CLI-only mode, always update dotfile */ @@ -664,7 +664,7 @@ void FreeClosure() cond_free(Closure->dDumpDir); cond_free(Closure->dDumpPrefix); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->prefsContext) FreePreferences(Closure->prefsContext); diff --git a/src/ds-marker.c b/src/ds-marker.c index d258654..13bd9de 100644 --- a/src/ds-marker.c +++ b/src/ds-marker.c @@ -260,7 +260,7 @@ int CheckForMissingSectors(unsigned char *buf, guint64 sector, *** Dialogue for indicating problem with the missing sector ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void insert_buttons(GtkDialog *dialog) { gtk_dialog_add_buttons(dialog, @@ -271,7 +271,7 @@ static void insert_buttons(GtkDialog *dialog) void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int source_type, int *number) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int answer; #endif guint64 recorded_number; @@ -293,7 +293,7 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou /* In CLI mode, only report the first unrecoverable sector unless verbose is given. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode && !Closure->verbose && *number > 0) #else if(!Closure->verbose && *number > 0) @@ -313,7 +313,7 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou vol_label = get_volume_label(buf); if(vol_label) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) label_msg = g_strdup_printf(_("\n\nThe label of the original (defective) medium was:\n%s\n\n"), vol_label); else @@ -339,11 +339,11 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou "repaired by dvdisaster. Also it will not be possible to create\n" "error correction data for it. Sorry for the bad news.\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintLogWithAsterisks(msg,sector, recorded_number, label_msg); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, sector, recorded_number, label_msg); @@ -366,11 +366,11 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou "repaired by dvdisaster. Also it will not be possible to create\n" "error correction data for it. Sorry for the bad news.\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintLogWithAsterisks(msg,sector, label_msg); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, sector, label_msg); @@ -395,11 +395,11 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou "repaired by dvdisaster. Also it will not be possible to create\n" "error correction data for it. Sorry for the bad news.\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintLogWithAsterisks(msg, sector); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, sector); @@ -419,11 +419,11 @@ void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int sou "in the ecc file are missing and its error correction\n" "capacity will be reduced.\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintLogWithAsterisks(msg, sector); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, sector); diff --git a/src/dvdisaster.c b/src/dvdisaster.c index 47ace29..d3c0e26 100644 --- a/src/dvdisaster.c +++ b/src/dvdisaster.c @@ -114,7 +114,7 @@ typedef enum int main(int argc, char *argv[]) { int mode = MODE_NONE; int sequence = MODE_NONE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int devices_queried = FALSE; #endif char *debug_arg = NULL; @@ -763,7 +763,7 @@ int main(int argc, char *argv[]) if(!Closure->device && mode == MODE_SEQUENCE && (sequence & (1<device = DefaultDevice(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES devices_queried = TRUE; #endif } @@ -920,7 +920,7 @@ int main(int argc, char *argv[]) /*** If no mode was selected, print the help screen. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(mode == MODE_HELP) #else if(mode == MODE_HELP || mode == MODE_NONE) @@ -1019,7 +1019,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* If no mode was selected at the command line, start the graphical user interface. */ diff --git a/src/dvdisaster.h b/src/dvdisaster.h index 856fbe8..61922d9 100644 --- a/src/dvdisaster.h +++ b/src/dvdisaster.h @@ -53,7 +53,7 @@ #include #include -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES #include #endif @@ -86,13 +86,14 @@ Note that these functions are even required when WITH_NLS_NO is set! */ -#ifdef DEBUG_PRINTF_FORMAT -/* disable sgettext() calls so that the compiler can analyze printf format strings */ -#define _(string) string -#define _utf(string) string +#ifndef WITH_DEBUG_PRINTF_FORMAT_YES + #define _(string) sgettext(string) + #define _utf(string) sgettext_utf8(string) #else -#define _(string) sgettext(string) -#define _utf(string) sgettext_utf8(string) +/* disable sgettext() calls so that the compiler + can analyze printf format strings */ + #define _(string) string + #define _utf(string) string #endif /* File permissions for images */ @@ -109,7 +110,7 @@ #define round(x) rint(x) #endif -#ifdef CLI +#ifdef WITH_CLI_ONLY_YES #define STATUS_LABEL_OR_NULL NULL #else #define STATUS_LABEL_OR_NULL Closure->status @@ -310,7 +311,7 @@ typedef struct _GlobalClosure struct _CrcBuf *crcBuf; /* crcBuf of last image read */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** GUI-related things */ int guiMode; /* TRUE if GUI is active */ @@ -318,7 +319,7 @@ typedef struct _GlobalClosure #endif int noMissingWarnings; /* suppress warnings about inconsistent missing sectors */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES GtkWidget *logWidget; /* Dialog for the log display */ GtkScrolledWindow *logScroll; /* and its scrolled window */ GtkTextBuffer *logBuffer; /* Text buffer for the log output */ @@ -401,7 +402,7 @@ typedef struct _GlobalClosure GtkWidget *readLinearFootlineBox; #endif gint64 crcErrors, readErrors; /* these are passed between threads and must therefore be global */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** Widgets for the adaptive reading action */ @@ -549,7 +550,7 @@ int ProbeCacheLineSize(); void InitClosure(void); void LocalizedFileDefaults(void); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void UpdateMarkup(char**, GdkColor*); void DefaultColors(void); #endif @@ -624,7 +625,7 @@ int CrcBufValid(CrcBuf*, struct _Image*, EccHeader*); void PrintCrcBuf(CrcBuf*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** curve.c ***/ @@ -735,7 +736,7 @@ void PrintEccHeader(EccHeader*); *** fix-window.c ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void CreateFixWindow(GtkWidget*); #endif @@ -795,7 +796,7 @@ void FreeGaloisTables(GaloisTables*); ReedSolomonTables *CreateReedSolomonTables(GaloisTables*, gint32, gint32, int); void FreeReedSolomonTables(ReedSolomonTables*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** help-dialogs.c ***/ @@ -1073,7 +1074,7 @@ int forget(void*); void check_memleaks(void); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** menubar.c ***/ @@ -1109,7 +1110,7 @@ typedef struct _Method void (*updateCksums)(Image*, gint64, unsigned char*);/* checksum while reading an image */ int (*finalizeCksums)(Image*); void *ckSumClosure; /* working closure for above */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void (*createVerifyWindow)(struct _Method*, GtkWidget*); void (*createCreateWindow)(struct _Method*, GtkWidget*); void (*createFixWindow)(struct _Method*, GtkWidget*); @@ -1121,7 +1122,7 @@ typedef struct _Method void (*readPreferences)(struct _Method*); #endif void (*destroy)(struct _Method*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int tabWindowIndex; /* our position in the (invisible) notebook */ void *widgetList; /* linkage to window system */ #endif @@ -1155,7 +1156,7 @@ void Verbose(char*, ...) PRINTF_FORMAT(1); void PrintTimeToLog(GTimer*, char*, ...) PRINTF_FORMAT(2); void PrintProgress(char*, ...) PRINTF_FORMAT(1); void ClearProgress(void); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void PrintCLIorLabel(GtkLabel*, char*, ...) PRINTF_FORMAT(2); #else void PrintCLIorLabel(void*, char*, ...) PRINTF_FORMAT(2); @@ -1169,7 +1170,7 @@ void UnregisterCleanup(void); GThread* CreateGThread(GThreadFunc, gpointer); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void ShowWidget(GtkWidget*); void AllowActions(gboolean); @@ -1186,7 +1187,7 @@ int ModalWarning(char*, ...) PRINTF_FORMAT(1); #define ModalWarningOrCLI(a,b,c,d,...) ModalWarning(d,__VA_ARGS__) #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void SetText(PangoLayout*, char*, int*, int*); void SwitchAndSetFootline(GtkWidget*, int, GtkWidget*, char*, ...) PRINTF_FORMAT(4); @@ -1200,7 +1201,7 @@ void LockLabelSize(GtkLabel*, char*, ...) PRINTF_FORMAT(2); int ConfirmImageDeletion(char *); int ConfirmEccDeletion(char *); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** preferences.c ***/ @@ -1270,7 +1271,7 @@ void ReadDefectiveSectorFile(DefectiveSectorHeader *, struct _RawBuffer*, char*) void ReadMediumLinear(gpointer); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** read-linear-window.c ***/ @@ -1292,7 +1293,7 @@ void GetReadingRange(gint64, gint64*, gint64*); void ReadMediumAdaptive(gpointer); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** read-adaptive-window.c ***/ @@ -1473,7 +1474,7 @@ void *PrepareIterativeSmartLEC(RawBuffer*); void SmartLECIteration(void*, char*); void EndIterativeSmartLEC(void*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** spiral.c ***/ diff --git a/src/ecc-rs01.c b/src/ecc-rs01.c index 8b44271..f0c3ccc 100644 --- a/src/ecc-rs01.c +++ b/src/ecc-rs01.c @@ -53,7 +53,7 @@ void register_rs01(void) method->finalizeCksums = RS01FinalizeCksums; method->expectedImageSize = RS01ExpectedImageSize; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** Linkage to rs01-window.c */ method->createCreateWindow = CreateRS01EWindow; @@ -80,13 +80,13 @@ void register_rs01(void) static void destroy(Method *method) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl = (RS01Widgets*)method->widgetList; #endif g_free(method->ckSumClosure); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(wl) { if(wl->fixCurve) FreeCurve(wl->fixCurve); diff --git a/src/ecc-rs02.c b/src/ecc-rs02.c index 483cfc7..e22b4ea 100644 --- a/src/ecc-rs02.c +++ b/src/ecc-rs02.c @@ -54,7 +54,7 @@ void register_rs02(void) method->finalizeCksums = RS02FinalizeCksums; method->expectedImageSize = RS02ExpectedImageSize; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** Linkage to rs02-window.c */ method->createCreateWindow = CreateRS02EncWindow; @@ -82,7 +82,7 @@ void register_rs02(void) static void destroy(Method *method) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl = (RS02Widgets*)method->widgetList; #endif RS02CksumClosure *csc = (RS02CksumClosure*)method->ckSumClosure; @@ -91,7 +91,7 @@ static void destroy(Method *method) g_free(csc->lay); g_free(method->ckSumClosure); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(wl) { if(wl->fixCurve) FreeCurve(wl->fixCurve); diff --git a/src/ecc-rs03.c b/src/ecc-rs03.c index 58f47c9..6c8efb3 100644 --- a/src/ecc-rs03.c +++ b/src/ecc-rs03.c @@ -55,7 +55,7 @@ void register_rs03(void) method->recognizeEccFile = RS03RecognizeFile; method->recognizeEccImage = RS03RecognizeImage; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** Linkage to rs03-window.c */ method->createCreateWindow = CreateRS03EncWindow; @@ -83,7 +83,7 @@ void register_rs03(void) static void destroy(Method *method) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl = (RS03Widgets*)method->widgetList; #endif RS03CksumClosure *csc = (RS03CksumClosure*)method->ckSumClosure; @@ -92,7 +92,7 @@ static void destroy(Method *method) g_free(csc->lay); g_free(method->ckSumClosure); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(wl) { if(wl->fixCurve) FreeCurve(wl->fixCurve); diff --git a/src/image.c b/src/image.c index 52a08c0..8919225 100644 --- a/src/image.c +++ b/src/image.c @@ -148,7 +148,7 @@ int ReportImageEccInconsistencies(Image *image) if(!image || image->type == IMAGE_NONE) { if(image) CloseImage(image); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { CreateMessage(_("Image file %s not present or permission denied.\n"), GTK_MESSAGE_ERROR, Closure->imageName); return TRUE; @@ -163,7 +163,7 @@ int ReportImageEccInconsistencies(Image *image) if(image->eccFile && !image->eccFileMethod) { CloseImage(image); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { CreateMessage(_("\nError correction file type unknown.\n"), GTK_MESSAGE_ERROR); return TRUE; @@ -178,7 +178,7 @@ int ReportImageEccInconsistencies(Image *image) if(!image->eccFile && image->eccFileState == ECCFILE_NOPERM) { CloseImage(image); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { CreateMessage(_("\nPermission denied on ecc file (perhaps not writeable?).\n"), GTK_MESSAGE_ERROR); @@ -195,7 +195,7 @@ int ReportImageEccInconsistencies(Image *image) if(!image->eccFile && !image->eccMethod) { CloseImage(image); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { CreateMessage(_("\nNo error correction file present.\n" "No error correction data recognized in image.\n"), GTK_MESSAGE_ERROR); diff --git a/src/large-io.c b/src/large-io.c index 7b913e9..79228cc 100644 --- a/src/large-io.c +++ b/src/large-io.c @@ -211,7 +211,7 @@ ssize_t LargeRead(LargeFile *lf, void *buf, size_t count) * Writing large files */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void insert_buttons(GtkDialog *dialog) { gtk_dialog_add_buttons(dialog, @@ -226,7 +226,7 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count) /* Simply fail when going out of space in command line mode */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { while(count) @@ -243,7 +243,7 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count) return total; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* Give the user a chance to free more space in GUI mode. When running out of space, the last write() may complete with nguiMode) print_defaults(mi); #endif @@ -125,7 +125,7 @@ void PrintMediumInfo(void *mi_ptr) print_tab("Medium type:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->physicalType, #else NULL, @@ -133,7 +133,7 @@ NULL, "%s\n", dh->typeDescr); print_tab("Book type:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->bookType, #else NULL, @@ -141,7 +141,7 @@ NULL, "%s\n", dh->bookDescr); print_tab("Manuf.-ID:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->manufID, #else NULL, @@ -149,7 +149,7 @@ NULL, "%s\n", dh->manuID); print_tab("Drive profile:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->profileDescr, #else NULL, @@ -172,7 +172,7 @@ NULL, print_tab("Disc status:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->discStatus, #else NULL, @@ -184,7 +184,7 @@ NULL, print_tab("Used sectors:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->usedCapacity1, #else NULL, @@ -193,7 +193,7 @@ NULL, dh->readCapacity+1, (dh->readCapacity+1)>>9); print_tab(" ",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->usedCapacity2, #else NULL, @@ -203,7 +203,7 @@ NULL, print_tab("Blank capacity:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->blankCapacity, #else NULL, @@ -225,7 +225,7 @@ NULL, print_tab("Medium label:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->isoLabel, #else NULL, @@ -233,7 +233,7 @@ NULL, "%s\n", image->isoInfo->volumeLabel); print_tab("File system size:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->isoSize, #else NULL, @@ -242,7 +242,7 @@ NULL, image->isoInfo->volumeSize, (gint64)image->isoInfo->volumeSize>>9); print_tab("Creation time:",tab_width); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mi->isoTime, #else NULL, @@ -271,7 +271,7 @@ NULL, memcpy(method, eh->method, 4); method[4] = 0; print_tab("Error correction data:",tab_width); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES PrintCLIorLabel(mi->eccState, _("%s, %d roots, %4.1f%% redundancy.\n"), #else PrintCLIorLabel(NULL, _("%s, %d roots, %4.1f%% redundancy.\n"), @@ -279,7 +279,7 @@ NULL, method, eh->eccBytes, ((double)eh->eccBytes*100.0)/(double)eh->dataBytes); print_tab("Augmented image size:",tab_width); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES PrintCLIorLabel(mi->eccSize, _("%" PRIu64 " sectors (%" PRId64 " MiB)\n"), #else PrintCLIorLabel(NULL, _("%" PRId64 " sectors (%" PRId64 " MiB)\n"), @@ -289,13 +289,13 @@ NULL, print_tab("dvdisaster version:", tab_width); if(micro) -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES PrintCLIorLabel(mi->eccVersion, "%d.%d.%d", major, minor, micro); #else PrintCLIorLabel(NULL, "%d.%d.%d", major, minor, micro); #endif else -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES PrintCLIorLabel(mi->eccVersion, "%d.%d", major, minor); #else PrintCLIorLabel(NULL, "%d.%d", major, minor); @@ -310,7 +310,7 @@ NULL, /*** *** GUI callbacks ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* * Callback for drive selection diff --git a/src/misc.c b/src/misc.c index d2f34d2..fd16c30 100644 --- a/src/misc.c +++ b/src/misc.c @@ -58,7 +58,7 @@ char *sgettext(char *msgid) char *sgettext_utf8(char *msgid) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static gchar ringbuf[20][1024]; static int ringptr; #endif @@ -80,7 +80,7 @@ char *sgettext_utf8(char *msgid) /*** If we are running the GUI, convert to UTF8 for Gtk+ */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { char *msg_utf8 = g_locale_to_utf8(msgval, -1, NULL, NULL, NULL); @@ -148,7 +148,7 @@ void CalcSectors(guint64 size, guint64 *sectors, int *in_last) * Append message to the log window. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES #define MAX_LOG_WIN_SIZE 10240 @@ -241,7 +241,7 @@ void PrintCLI(char *format, ...) va_end(argp); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(Closure->verbose) { va_start(argp, format); @@ -271,7 +271,7 @@ void PrintProgress(char *format, ...) va_list argp; int n; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) return; #endif @@ -338,7 +338,7 @@ void PrintLog(char *format, ...) va_start(argp, format); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) log_window_vprintf(format, argp); else @@ -389,7 +389,7 @@ void PrintLogWithAsterisks(char *format, ...) va_start(argp, format); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) log_window_vprintf(new_format, argp); else @@ -423,7 +423,7 @@ void Verbose(char *format, ...) va_start(argp, format); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) log_window_vprintf(format, argp); else @@ -459,7 +459,7 @@ void PrintTimeToLog(GTimer *timer, char *format, ...) tmp2 = g_strdup_printf("%02d:%02d:%04.1f %s", hours, minutes, seconds, tmp1); va_end(argp); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { log_window_append(tmp2); @@ -480,7 +480,7 @@ void PrintTimeToLog(GTimer *timer, char *format, ...) * or show it in the given label */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void PrintCLIorLabel(GtkLabel *label, char *format, ...) #else void PrintCLIorLabel(void *unused, char *format, ...) @@ -495,7 +495,7 @@ void PrintCLIorLabel(void *unused, char *format, ...) va_start(argp, format); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { char *c,*tmp; @@ -562,7 +562,7 @@ static void vlog_warning(char *format, va_list argp) prefix[len] = 0; str = g_string_sized_new(256); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES g_string_append_printf(str,"* %s:%c", warn, Closure->guiMode ? '\n' : ' '); #else g_string_append_printf(str,"* %s: ", warn); @@ -570,7 +570,7 @@ static void vlog_warning(char *format, va_list argp) do { c = strchr(line,'\n'); if(c) *c=0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_string_append_printf(str,"* %s\n",line); else #endif @@ -584,7 +584,7 @@ static void vlog_warning(char *format, va_list argp) if(Closure->logFileEnabled) PrintLogFile("%s", str->str); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { log_window_append(str->str); } @@ -637,7 +637,7 @@ void Stop(char *format, ...) /*** CLI mode */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { g_printf("%s", _("\n*\n* dvdisaster - can not continue:\n*\n")); @@ -650,7 +650,7 @@ void Stop(char *format, ...) /*** GUI mode */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { char *titled,*msg,*utf_msg; int idx; @@ -710,7 +710,7 @@ void Stop(char *format, ...) /* see above: possibly unreachable in GUI mode! */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { FreeClosure(); @@ -782,7 +782,7 @@ void CallIdleFunc(gboolean (*idle_func)(gpointer), gpointer data) /*** *** Graphical user interface convenience ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* * Show the given widget @@ -1111,7 +1111,7 @@ int ModalWarning(char *msg, ...) vlog_warning(msg, argp); va_end(argp); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { va_start(argp, msg); result = vmodal_dialog(mt, bt, button_fn, msg, argp); @@ -1126,7 +1126,7 @@ int ModalWarning(char *msg, ...) * Set the text in the pango layout and retrieve its extents. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void SetText(PangoLayout *layout, char *text, int *w, int *h) { PangoRectangle rect; char *t = g_locale_to_utf8(text, -1, NULL, NULL, NULL); @@ -1316,12 +1316,12 @@ static void insert_button(GtkDialog *dialog) #endif int ConfirmImageDeletion(char *file) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) /* Always delete it in command line mode */ #endif return TRUE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->confirmDeletion) /* I told you so... */ return TRUE; @@ -1338,12 +1338,12 @@ int ConfirmImageDeletion(char *file) int ConfirmEccDeletion(char *file) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) /* Always delete it in command line mode */ #endif return TRUE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->confirmDeletion) /* I told you so... */ return TRUE; diff --git a/src/raw-sector-cache.c b/src/raw-sector-cache.c index c0aaa5d..10266b7 100644 --- a/src/raw-sector-cache.c +++ b/src/raw-sector-cache.c @@ -195,7 +195,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan) if(!LargeStat(filename, &length)) { PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -272,7 +272,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan) LargeClose(file); PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -327,7 +327,7 @@ int TryDefectiveSectorCache(RawBuffer *rb, unsigned char *outbuf) if(!status) { PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, diff --git a/src/read-adaptive.c b/src/read-adaptive.c index 07e7ce3..d05d1ad 100644 --- a/src/read-adaptive.c +++ b/src/read-adaptive.c @@ -368,7 +368,7 @@ static void cleanup(gpointer data) } bail_out: -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(rc->earlyTermination) SetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText); @@ -401,7 +401,7 @@ bail_out: g_free(rc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -490,7 +490,7 @@ static void print_progress(read_closure *rc, int immediate) int total = rc->readable+rc->correctable; int percent = (int)((1000LL*(long long)total)/rc->expectedSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) return; #endif @@ -542,7 +542,7 @@ static void print_progress(read_closure *rc, int immediate) static void clear_progress(read_closure *rc) { if(!rc->progressMsgLen || -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->guiMode) #else 0) @@ -564,7 +564,7 @@ static void clear_progress(read_closure *rc) * Sector markup in the spiral */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color) { int segment; int changed = FALSE; @@ -654,7 +654,7 @@ static void open_and_determine_mode(read_closure *rc) PrintLog(_("%s-type ECC found\n"), "RS01"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadMinimumPercentage((1000*(rc->eh->dataBytes-rc->eh->eccBytes))/rc->eh->dataBytes); #endif } @@ -664,7 +664,7 @@ static void open_and_determine_mode(read_closure *rc) rc->eh = rc->medium->eccHeader; rc->lay = RS02LayoutFromImage(rc->medium); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadMinimumPercentage((1000*rc->lay->ndata)/255); #endif @@ -706,7 +706,7 @@ static void open_and_determine_mode(read_closure *rc) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); #endif rc->earlyTermination = FALSE; @@ -769,7 +769,7 @@ static void check_size(read_closure *rc) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); #endif rc->earlyTermination = FALSE; @@ -788,7 +788,7 @@ static void check_size(read_closure *rc) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); #endif rc->earlyTermination = FALSE; @@ -808,13 +808,13 @@ void GetReadingRange(gint64 sectors, gint64 *firstSector, gint64 *lastSector) if(Closure->readStart || Closure->readEnd) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) /* more range checks are made below */ #endif { first = Closure->readStart; last = Closure->readEnd < 0 ? sectors-1 : Closure->readEnd; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else /* be more permissive in GUI mode */ { first = 0; last = sectors-1; @@ -861,7 +861,7 @@ static void check_ecc_fingerprint(read_closure *rc) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); #endif rc->earlyTermination = FALSE; @@ -911,11 +911,11 @@ int check_image_fingerprint(read_closure *rc) if(memcmp(image_fp, medium_fp, 16)) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif Stop(_("Image file does not match the optical disc.")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { int answer = ConfirmImageDeletion(Closure->imageName); @@ -956,7 +956,7 @@ void check_image_size(read_closure *rc, gint64 image_file_sectors) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); #endif rc->earlyTermination = FALSE; @@ -976,13 +976,13 @@ static void load_crc_buf(read_closure *rc) { switch(rc->readMode) { case ECC_IN_FILE: -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadSubtitle(_utf("Loading CRC data.")); #endif rc->crcBuf = GetCRCFromRS01_obsolete(rc->ei); break; case ECC_IN_IMAGE: -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SetAdaptiveReadSubtitle(_utf("Loading CRC data.")); #endif rc->crcBuf = GetCRCFromRS02_obsolete(rc->lay, rc->dh, rc->image); @@ -1015,7 +1015,7 @@ static void build_interval_from_image(read_closure *rc) Check them for "dead sector markers" and for checksum failures if ecc data is present. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadSubtitle(_("Analysing existing image file")); #endif @@ -1025,7 +1025,7 @@ static void build_interval_from_image(read_closure *rc) /* Check for user interruption. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); rc->earlyTermination = FALSE; @@ -1045,7 +1045,7 @@ static void build_interval_from_image(read_closure *rc) if(current_missing) { int fixme=0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, s, Closure->redSector); #endif ExplainMissingSector(rc->buf, s, current_missing, SOURCE_IMAGE, &fixme); @@ -1067,7 +1067,7 @@ static void build_interval_from_image(read_closure *rc) make it missing due to the CRC failure. */ if(!current_missing) { current_missing = 1; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, s, Closure->yellowSector); #endif } @@ -1084,7 +1084,7 @@ static void build_interval_from_image(read_closure *rc) if(rc->map) SetBit(rc->map, s); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, s, Closure->greenSector); #endif @@ -1121,7 +1121,7 @@ static void build_interval_from_image(read_closure *rc) percent = (100*s)/(rc->highestWrittenSector+1); if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintProgress(_("Analysing existing image file: %2d%%"),percent); @@ -1151,7 +1151,7 @@ static void build_interval_from_image(read_closure *rc) /*** Now that all readable sectors are known, determine those which can already be corrected. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadSubtitle(_("Determining correctable sectors")); #endif @@ -1186,7 +1186,7 @@ static void build_interval_from_image(read_closure *rc) #ifdef CHECK_VISITED rc->count[layer_idx]++; #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, layer_idx, Closure->greenSector); #endif } @@ -1221,7 +1221,7 @@ static void build_interval_from_image(read_closure *rc) && !GetBit(rc->map, sector)) { SetBit(rc->map, sector); rc->correctable++; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, sector, Closure->greenSector); #endif } @@ -1238,7 +1238,7 @@ static void build_interval_from_image(read_closure *rc) else PrintLog(_("Analysing existing image file: %" PRId64 " readable, %" PRId64 " still missing.\n"), rc->readable, rc->expectedSectors-rc->readable-rc->correctable); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) UpdateAdaptiveResults(rc->readable, rc->correctable, rc->expectedSectors-rc->readable-rc->correctable, @@ -1267,14 +1267,14 @@ static void mark_rs02_headers(read_closure *rc) while(hpos < end) { if(!GetBit(rc->map, hpos)) { SetBit(rc->map, hpos); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, hpos, Closure->greenSector); #endif rc->correctable++; } if(!GetBit(rc->map, hpos+1)) { SetBit(rc->map, hpos+1); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, hpos+1, Closure->greenSector); #endif rc->correctable++; @@ -1288,7 +1288,7 @@ static void mark_rs02_headers(read_closure *rc) *** Main routine for adaptive reading ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void insert_buttons(GtkDialog *dialog) { gtk_dialog_add_buttons(dialog, @@ -1333,7 +1333,7 @@ void fill_gap(read_closure *rc) t = g_strdup_printf(_("Filling image area [%" PRId64 "..%" PRId64 "]"), firstUnwritten, rc->intervalStart-1); clear_progress(rc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetAdaptiveReadSubtitle(t); ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1); @@ -1364,7 +1364,7 @@ void fill_gap(read_closure *rc) /* Check whether user hit the Stop button */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->guiMode) @@ -1380,7 +1380,7 @@ void fill_gap(read_closure *rc) if(j++ % 2000) { int seq = (j/2000)%10; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { g_printf("%s", anim[seq]); @@ -1390,7 +1390,7 @@ void fill_gap(read_closure *rc) /* Show progress in the spiral */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { int segment = i / rc->sectorsPerSegment; @@ -1403,7 +1403,7 @@ void fill_gap(read_closure *rc) PrintCLI(" \n"); rc->highestWrittenSector = rc->intervalStart-1; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) /* remove temporary fill markers */ { RemoveFillMarkers(); SetAdaptiveReadSubtitle(rc->subtitle); @@ -1463,7 +1463,7 @@ void ReadMediumAdaptive(gpointer data) rc->earlyTermination = TRUE; RegisterCleanup(_("Reading aborted"), cleanup, rc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "%s\n%s", _("Preparing for reading the medium image."), @@ -1528,7 +1528,7 @@ void ReadMediumAdaptive(gpointer data) /*** Initialize segment state counters (only in GUI mode) */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { //rc->sectorsPerSegment = 1 + (rc->sectors / ADAPTIVE_READ_SPIRAL_SIZE); rc->sectorsPerSegment = ((rc->expectedSectors+ADAPTIVE_READ_SPIRAL_SIZE-1) / ADAPTIVE_READ_SPIRAL_SIZE); @@ -1552,7 +1552,7 @@ reopen_image: Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno)); PrintLog(_("Creating new %s image.\n"),Closure->imageName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "%s\n%s", @@ -1574,7 +1574,7 @@ reopen_image: else { int reopen; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "%s\n%s", @@ -1616,7 +1616,7 @@ reopen_image: if(rc->readMode != IMAGE_ONLY) { PrintLog("%s", t); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadFootline(t, Closure->greenText); #endif @@ -1637,7 +1637,7 @@ reopen_image: /*** Read the medium image. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadSubtitle(rc->subtitle); #endif @@ -1665,7 +1665,7 @@ reopen_image: for(s=rc->intervalStart; s<=rc->intervalEnd; ) /* s is incremented elsewhere */ { int nsectors,cnt; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* somebody hit the Stop button */ { if(Closure->guiMode) SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); @@ -1723,7 +1723,7 @@ reread: && rc->dh->sense.sense_key && rc->dh->sense.sense_key != 3 && rc->dh->sense.sense_key != 5) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int answer; if(!Closure->guiMode) @@ -1732,7 +1732,7 @@ reread: "Use the --ignore-fatal-sense option to override."), s, GetLastSenseString(FALSE)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, _("Sector %" PRId64 ": %s\n\n" "It may not be possible to recover from this error.\n" @@ -1802,7 +1802,7 @@ reread: Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"), b, "unv", strerror(errno)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, b, Closure->yellowSector); #endif @@ -1821,7 +1821,7 @@ reread: SetBit(rc->map, b); rc->readable++; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, b, Closure->greenSector); #endif @@ -1876,7 +1876,7 @@ reread: && !GetBit(rc->map, layer_idx)) { SetBit(rc->map, layer_idx); rc->correctable++; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, layer_idx, Closure->greenSector); #endif @@ -1921,7 +1921,7 @@ reread: && !GetBit(rc->map, sector)) { SetBit(rc->map, sector); rc->correctable++; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, sector, Closure->greenSector); #endif fill_correctable_gap(rc, sector); @@ -1948,7 +1948,7 @@ reread: print_progress(rc, TRUE); if(rc->readMode != IMAGE_ONLY) { PrintLog("%s", t); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && rc->ei) SetAdaptiveReadFootline(t, Closure->foreground); #endif @@ -1964,7 +1964,7 @@ reread: PrintCLI("\n"); if(nsectors>1) PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -1972,7 +1972,7 @@ NULL, _("Sectors %" PRId64 "-%" PRId64 ": %s\n"), s, s+nsectors-1, GetLastSenseString(FALSE)); else PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -1996,7 +1996,7 @@ NULL, Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"), s, "nds", strerror(errno)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES mark_sector(rc, s+i, Closure->redSector); #endif } @@ -2093,7 +2093,7 @@ finished: /* Force output of final results */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1); mark_sector(rc, 0, NULL); @@ -2114,7 +2114,7 @@ finished: PrintLog(_("\n%s\n" "(%" PRId64 " readable, %" PRId64 " correctable, %" PRId64 " still missing).\n"), t, rc->readable, rc->correctable, rc->expectedSectors-total); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadFootline(t, Closure->foreground); #endif @@ -2129,7 +2129,7 @@ finished: { if(rc->readable == rc->expectedSectors) { char *t = _("\nGood! All sectors have been read.\n"); PrintLog("%s", t); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadFootline(t, Closure->foreground); #endif @@ -2145,7 +2145,7 @@ finished: "%2d.%1d%% of the image have been read (%" PRId64 " sectors).\n"), t, percent/10, percent%10, rc->readable); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetAdaptiveReadFootline(t, Closure->foreground); #endif @@ -2166,7 +2166,7 @@ finished: rc->earlyTermination = FALSE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES terminate: #endif cleanup((gpointer)rc); diff --git a/src/read-linear.c b/src/read-linear.c index 583fa3b..a61c6cc 100644 --- a/src/read-linear.c +++ b/src/read-linear.c @@ -57,7 +57,7 @@ static void send_eof(read_closure *rc) static void cleanup(gpointer data) { read_closure *rc = (read_closure*)data; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int full_read = FALSE; int aborted = rc->earlyTermination; int scan_mode = rc->scanMode; @@ -73,7 +73,7 @@ static void cleanup(gpointer data) in that case. */ while(renderers_left -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES && Closure->stopActions != STOP_SHUTDOWN_ALL #endif ) @@ -112,14 +112,14 @@ static void cleanup(gpointer data) /* Clean up reader thread */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(rc->image) full_read = (rc->readOK == rc->image->dh->sectors && !Closure->crcErrors); #endif UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(rc->unreportedError) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, @@ -173,7 +173,7 @@ static void cleanup(gpointer data) /* Continue with ecc file creation after read. NOTE: Images are NOT automatically augmented after a read. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->readAndCreate && Closure->guiMode && !scan_mode && !aborted) /* General prerequisites */ { if( !strncmp(Closure->methodName, "RS01", 4) /* codec prerequisites */ || (!strncmp(Closure->methodName, "RS03", 4) && Closure->eccTarget == ECC_FILE) ) @@ -211,7 +211,7 @@ static void register_reader(read_closure *rc) { if(rc->scanMode) /* Output messages differ in read and scan mode */ { RegisterCleanup(_("Scanning aborted"), cleanup, rc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), "%s\n%s", @@ -221,7 +221,7 @@ static void register_reader(read_closure *rc) } else { RegisterCleanup(_("Reading aborted"), cleanup, rc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), "%s\n%s", @@ -252,7 +252,7 @@ static void determine_mode(read_closure *rc) rc->msg = g_strdup(_("Scanning medium for read errors.")); PrintLog("%s\n", rc->msg); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(rc->eccMethod) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), @@ -267,7 +267,7 @@ static void determine_mode(read_closure *rc) rc->readMarker = 0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan); #endif @@ -277,7 +277,7 @@ static void determine_mode(read_closure *rc) /*** If no image file exists, open a new one. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES reopen_image: #endif if(!LargeStat(Closure->imageName, &image_size)) @@ -291,7 +291,7 @@ reopen_image: Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno)); PrintLog(_("Creating new %s image.\n"),Closure->imageName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(rc->eccMethod) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), @@ -305,7 +305,7 @@ reopen_image: rc->rereading = FALSE; rc->readMarker = 0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan); #endif @@ -354,11 +354,11 @@ reopen_image: if(!unknown_fingerprint && memcmp(image_fp, medium_fp, 16)) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif Stop(_("Image file does not match the optical disc.")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { int answer = ConfirmImageDeletion(Closure->imageName); @@ -388,18 +388,18 @@ reopen_image: { PrintLog(_("Completing image %s. Continuing with sector %" PRId64 ".\n"), Closure->imageName, rc->readMarker); rc->firstSector = rc->readMarker; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->additionalSpiralColor = 0; /* blue */ #endif } else { PrintLog(_("Completing image %s. Only missing sectors will be read.\n"), Closure->imageName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->additionalSpiralColor = 3; /* dark green*/ #endif } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), "%s\n%s",rc->msg,rc->image->dh->mediumDescr); @@ -463,7 +463,7 @@ static void prepare_crc_cache(read_closure *rc) // FIXME: reuse CrcBuf and write respective message -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), "%s\n%s", @@ -474,7 +474,7 @@ static void prepare_crc_cache(read_closure *rc) if(rc->eccMethod->getCrcBuf) { Closure->crcBuf = rc->eccMethod->getCrcBuf(rc->image); Closure->crcBuf->crcCached = TRUE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) RedrawReadLinearWindow(); #endif @@ -493,7 +493,7 @@ static void prepare_crc_cache(read_closure *rc) rc->eccMethod->resetCksums(rc->image); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), "%s\n%s", rc->msg, rc->image->dh->mediumDescr); @@ -516,7 +516,7 @@ static void prepare_crc_cache(read_closure *rc) static void prepare_timer(read_closure *rc) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && Closure->spinupDelay) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, _("Waiting %d seconds for drive to spin up...\n"), Closure->spinupDelay); @@ -524,7 +524,7 @@ static void prepare_timer(read_closure *rc) SpinupDevice(rc->image->dh); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && Closure->spinupDelay) SwitchAndSetFootline(Closure->readLinearNotebook, 0, Closure->readLinearFootline, "ignore"); #endif @@ -542,7 +542,7 @@ static void prepare_timer(read_closure *rc) static void show_progress(read_closure *rc) { int percent; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && rc->lastErrorsPrinted != Closure->readErrors) { SetLabelText(GTK_LABEL(Closure->readLinearErrors), _("Unreadable / skipped sectors: %" PRId64 ""), Closure->readErrors); @@ -555,7 +555,7 @@ static void show_progress(read_closure *rc) if(rc->lastPercent != percent) { gulong ignore; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int color; if(Closure->guiMode) @@ -564,7 +564,7 @@ static void show_progress(read_closure *rc) if(rc->readOK <= rc->lastReadOK) /* nothing read since last sample? */ { rc->speed = 0.0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->readErrors - rc->previousReadErrors > 0) color = 2; else if(Closure->crcErrors - rc->previousCRCErrors > 0) @@ -585,7 +585,7 @@ static void show_progress(read_closure *rc) double elapsed = g_timer_elapsed(rc->speedTimer, &ignore); double kb_sec = kb_read / elapsed; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->readErrors - rc->previousReadErrors > 0) color = 2; else if(Closure->crcErrors - rc->previousCRCErrors > 0) @@ -596,7 +596,7 @@ static void show_progress(read_closure *rc) if(rc->firstSpeedValue) { rc->speed = kb_sec / rc->image->dh->singleRate; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { AddCurveValues(rc, rc->lastPercent, color, rc->maxC2); AddCurveValues(rc, percent, color, rc->maxC2); @@ -624,7 +624,7 @@ static void show_progress(read_closure *rc) cut_peaks=3; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) AddCurveValues(rc, percent, color, rc->maxC2); #endif @@ -777,7 +777,7 @@ update_mutex: *** The reader part ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void insert_buttons(GtkDialog *dialog) { gtk_dialog_add_buttons(dialog, @@ -888,7 +888,7 @@ void ReadMediumLinear(gpointer data) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, _("Aborted by user request! %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."), Closure->redMarkup, rc->readOK,Closure->readErrors); @@ -901,7 +901,7 @@ void ReadMediumLinear(gpointer data) /*** See if user wants to limit the read range. */ GetReadingRange(rc->image->dh->sectors, &rc->firstSector, &rc->lastSector); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(rc->firstSector > 0) /* Mark skipped sectors */ Closure->additionalSpiralColor = 0; /* blue */ #endif @@ -969,7 +969,7 @@ next_reading_pass: break; } Closure->sectorSkip = 0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) MarkExistingSectors(); #endif @@ -989,7 +989,7 @@ next_reading_pass: while(rc->readPos<=rc->lastSector) { int cluster_mask = rc->image->dh->clusterSize-1; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* somebody hit the Stop button */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ @@ -1102,7 +1102,7 @@ reread: if(status && !Closure->ignoreFatalSense && rc->image->dh->sense.sense_key && rc->image->dh->sense.sense_key != 3 && rc->image->dh->sense.sense_key != 5) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int answer; if(!Closure->guiMode) @@ -1111,7 +1111,7 @@ reread: "Use the --ignore-fatal-sense option to override."), rc->readPos, GetLastSenseString(FALSE)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, _("Sector %" PRId64 ": %s\n\n" "It may not be possible to recover from this error.\n" @@ -1272,7 +1272,7 @@ reread: { int i; PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -1305,7 +1305,7 @@ NULL, } else { PrintCLIorLabel( -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Closure->status, #else NULL, @@ -1332,7 +1332,7 @@ step_counter: to checksum means we have ecc data - we can fix the image using ecc rather than by re-reading it. */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ChangeSpiralCursor(Closure->readLinearSpiral, -1); /* switch cursor off */ #endif @@ -1345,7 +1345,7 @@ step_counter: && rc->pass < Closure->readingPasses) { int renderers_left = TRUE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(Closure->readLinearHeadline), _("Trying to complete image, reading pass %d of %d.\n%s"), @@ -1435,7 +1435,7 @@ step_counter: } PrintLog("\n%s\n",t); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(rc->scanMode) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, "%s%s",_("Scanning finished: "),t); @@ -1451,7 +1451,7 @@ step_counter: if(rc->image->dh->mainType == CD && tao_tail && tao_tail == Closure->readErrors && !Closure->noTruncate) { int answer; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, _("%d sectors missing at the end of the disc.\n" diff --git a/src/rs01-common.c b/src/rs01-common.c index ae548d4..fd72203 100644 --- a/src/rs01-common.c +++ b/src/rs01-common.c @@ -207,7 +207,7 @@ void RS01ReadSector(Image *image, unsigned char *buf, gint64 s) void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, int mode) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl = NULL; #endif unsigned char buf[2048]; @@ -216,7 +216,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in int crcidx = 0; struct MD5Context image_md5; gint64 s, first_missing, last_missing; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES gint64 prev_missing = 0; gint64 prev_crc_errors = 0; #endif @@ -225,7 +225,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in /* Extract widget list from method */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(method->widgetList) wl = (RS01Widgets*)method->widgetList; #endif @@ -263,7 +263,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in /* Check for user interruption */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { image->sectorsMissing += image->sectorSize - s; if(crcbuf) g_free(crcbuf); @@ -361,7 +361,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in MD5Update(&image_md5, buf, n); /* update image md5sum */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && mode & PRINT_MODE) percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/image->sectorSize; else @@ -370,7 +370,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in if(last_percent != percent) { PrintProgress(msg,percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && mode & CREATE_CRC) SetProgress(wl->encPBar1, percent, 100); diff --git a/src/rs01-create.c b/src/rs01-create.c index 9585375..ede42f5 100644 --- a/src/rs01-create.c +++ b/src/rs01-create.c @@ -97,7 +97,7 @@ static int calculate_redundancy(char *image_name) *** Remove the image file ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES static void unlink_image(GtkWidget *label) #else static void unlink_image(void *label) @@ -106,7 +106,7 @@ static void unlink_image(void *label) if(LargeUnlink(Closure->imageName)) { PrintLog(_("\nImage file %s deleted.\n"),Closure->imageName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(label), _("\nImage file %s deleted.\n"), Closure->imageName); @@ -114,7 +114,7 @@ static void unlink_image(void *label) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintLog("\n"); @@ -135,7 +135,7 @@ static void unlink_image(void *label) typedef struct { Method *self; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl; #endif GaloisTables *gt; @@ -153,7 +153,7 @@ static void ecc_cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ec->earlyTermination) SetLabelText(GTK_LABEL(ec->wl->encFootline), @@ -176,14 +176,14 @@ static void ecc_cleanup(gpointer data) if(Closure->enableCurveSwitch) { Closure->enableCurveSwitch = FALSE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01ShowCurveButton(ec->self); #endif } g_free(ec); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -197,7 +197,7 @@ enum { NORMAL, HIGH, GENERIC }; void RS01Create(void) { Method *self = FindMethod("RS01"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl = (RS01Widgets*)self->widgetList; #endif GaloisTables *gt; @@ -224,7 +224,7 @@ void RS01Create(void) /*** Register the cleanup procedure for GUI mode */ ec->self = self; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES ec->wl = wl; #endif ec->earlyTermination = TRUE; @@ -255,7 +255,7 @@ void RS01Create(void) nroots, ((double)nroots*100.0)/(double)ndata); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->encHeadline), _("Creating the error correction file.\n%s"), ec->msg); @@ -269,7 +269,7 @@ void RS01Create(void) { if(ConfirmEccDeletion(Closure->eccName)) LargeUnlink(Closure->eccName); -#ifndef CLI /* ConfirmEccDeletion always return true if CLI */ +#ifndef WITH_CLI_ONLY_YES /* ConfirmEccDeletion always return true if CLI */ else { SetLabelText(GTK_LABEL(ec->wl->encFootline), _("Aborted to keep existing ecc file."), @@ -311,7 +311,7 @@ void RS01Create(void) int percent, last_percent = 0; char *msg = _("Writing sector checksums: %3d%%"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->encLabel1), _("1. Writing image sector checksums:")); @@ -346,7 +346,7 @@ void RS01Create(void) if(last_percent != percent) { PrintProgress(msg,percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(wl->encPBar1, percent, 100); #endif @@ -363,7 +363,7 @@ void RS01Create(void) Checksums are only computed locally and not provided in the cache. */ else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->encLabel1), _("1. Calculating image sector checksums:")); @@ -380,7 +380,7 @@ void RS01Create(void) LargeUnlink(Closure->eccName); /* Do not leave a CRC-only .ecc file behind */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ @@ -393,7 +393,7 @@ void RS01Create(void) else #endif { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(wl->encPBar1, 100, 100); #endif @@ -405,7 +405,7 @@ void RS01Create(void) PrintTimeToLog(ec->timer, "for CRC writing/generation.\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetProgress(wl->encPBar1, 100, 100); ShowWidget(wl->encPBar2); @@ -531,7 +531,7 @@ void RS01Create(void) { int offset = 0; unsigned char *par_idx = ec->parity; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->encFootline), @@ -611,7 +611,7 @@ void RS01Create(void) percent = (1000*progress)/max_percent; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(wl->encPBar2, percent, 1000); else @@ -629,7 +629,7 @@ void RS01Create(void) { int offset = 0; unsigned char *par_idx = ec->parity; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->encFootline), @@ -741,7 +741,7 @@ void RS01Create(void) percent = (1000*progress)/max_percent; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(wl->encPBar2, percent, 1000); else @@ -762,7 +762,7 @@ void RS01Create(void) { int offset = 0; unsigned char *par_idx = ec->parity; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->encFootline), @@ -1041,7 +1041,7 @@ void RS01Create(void) percent = (1000*progress)/max_percent; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(wl->encPBar2, percent, 1000); else @@ -1087,7 +1087,7 @@ void RS01Create(void) "Make sure to keep this file on a reliable medium.\n"), Closure->eccName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetProgress(wl->encPBar2, 100, 100); @@ -1103,7 +1103,7 @@ void RS01Create(void) if(Closure->unlinkImage) { if(ec->image) CloseImage(ec->image); ec->image = NULL; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES unlink_image(Closure->guiMode ? wl->encFootline2 : NULL); #else unlink_image(NULL); @@ -1114,7 +1114,7 @@ void RS01Create(void) ec->earlyTermination = FALSE; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES terminate: #endif ecc_cleanup((gpointer)ec); diff --git a/src/rs01-fix.c b/src/rs01-fix.c index 3da6744..1356a73 100644 --- a/src/rs01-fix.c +++ b/src/rs01-fix.c @@ -55,7 +55,7 @@ static void read_crc(LargeFile *ecc, guint32 *buf, int first_sector, int n_secto typedef struct { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl; #endif GaloisTables *gt; @@ -73,7 +73,7 @@ static void fix_cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(fc->earlyTermination) SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -101,7 +101,7 @@ static void fix_cleanup(gpointer data) g_free(fc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -113,7 +113,7 @@ static void fix_cleanup(gpointer data) void RS01Fix(Image *image) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Method *method = FindMethod("RS01"); RS01Widgets *wl = (RS01Widgets*)method->widgetList; #endif @@ -141,7 +141,7 @@ void RS01Fix(Image *image) /*** Register the cleanup procedure for GUI mode */ fc->image = image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES fc->wl = wl; #endif fc->earlyTermination = TRUE; @@ -155,7 +155,7 @@ void RS01Fix(Image *image) eh->eccBytes, ((double)eh->eccBytes*100.0)/(double)eh->dataBytes); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->fixHeadline), _("Repairing the image.\n%s"),fc->msg); @@ -213,7 +213,7 @@ void RS01Fix(Image *image) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(fc->wl->fixNotebook, 1, fc->wl->fixFootline, _("Aborted by user request!"), @@ -230,7 +230,7 @@ void RS01Fix(Image *image) Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(diff>2 && Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, trans, @@ -257,7 +257,7 @@ void RS01Fix(Image *image) #endif if(diff>2 && -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES !Closure->guiMode) #else 1) @@ -281,7 +281,7 @@ void RS01Fix(Image *image) if(image->sectorSize == image->expectedSectors && image->inLast > eh->inLast) { int difference = image->inLast - eh->inLast; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, _("The image file is %d bytes longer than noted\n" @@ -300,7 +300,7 @@ void RS01Fix(Image *image) } #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode && !Closure->truncate) #else if(!Closure->truncate) @@ -326,7 +326,7 @@ void RS01Fix(Image *image) "Consider completing it with another reading pass before going on.\n")); if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(fc->wl->fixNotebook, 1, fc->wl->fixFootline, _("Aborted by user request!"), @@ -346,7 +346,7 @@ void RS01Fix(Image *image) eh->fpSector); if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(fc->wl->fixNotebook, 1, fc->wl->fixFootline, _("Aborted by user request!"), @@ -399,7 +399,7 @@ void RS01Fix(Image *image) for(si=0; sistopActions) /* User hit the Stop button */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -473,7 +473,7 @@ void RS01Fix(Image *image) if(erasure_count>nroots) /* uncorrectable */ { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { PrintCLI(_("* %3d unrepairable sectors: "), erasure_count); @@ -785,7 +785,7 @@ skip: if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { RS01AddFixValues(wl, percent, local_plot_max); @@ -811,7 +811,7 @@ skip: if(corrected > 0) PrintLog(_("Repaired sectors: %" PRId64 " \n"),corrected); if(uncorrected > 0) { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, _("Image sectors could not be fully restored " @@ -833,7 +833,7 @@ skip: PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), (double)damaged_sec/(double)damaged_ecc,worst_ecc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && t) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, "%s %s", _("Repair results:"), t); diff --git a/src/rs01-includes.h b/src/rs01-includes.h index 58777c0..6f51ef5 100644 --- a/src/rs01-includes.h +++ b/src/rs01-includes.h @@ -23,7 +23,7 @@ #ifndef RS01INCLUDES_H #define RS01INCLUDES_H -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* Data structs from rs01-window.c */ typedef struct @@ -107,7 +107,7 @@ typedef struct { struct MD5Context md5ctxt; /* Complete image checksum */ } RS01CksumClosure; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* * These are exported via the Method struct */ @@ -159,7 +159,7 @@ void RS01Create(void); void RS01Fix(Image*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* rs01-window.c */ void RS01AddFixValues(RS01Widgets*, int, int); diff --git a/src/rs01-verify.c b/src/rs01-verify.c index d7dd9b2..356dc1c 100644 --- a/src/rs01-verify.c +++ b/src/rs01-verify.c @@ -24,7 +24,7 @@ #include "rs01-includes.h" -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /*** *** Reset the verify output window @@ -356,7 +356,7 @@ static void cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) AllowActions(TRUE); #endif @@ -364,7 +364,7 @@ static void cleanup(gpointer data) if(vc->image) CloseImage(vc->image); g_free(vc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -373,12 +373,12 @@ static void cleanup(gpointer data) void RS01Verify(Image *image) { verify_closure *vc = g_malloc0(sizeof(verify_closure)); Method *self = FindMethod("RS01"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS01Widgets *wl = (RS01Widgets*)self->widgetList; #endif char idigest[33],edigest[33]; gint64 excess_sectors = 0; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES char *ecc_advice = NULL; #endif @@ -399,7 +399,7 @@ void RS01Verify(Image *image) /*** Examine the .iso file */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpHeadline), "%s\n%s", _("Comparing image and error correction files."), @@ -407,7 +407,7 @@ void RS01Verify(Image *image) #endif vc->image = image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(image && image->eccFile) { if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "0"); @@ -423,7 +423,7 @@ void RS01Verify(Image *image) if(!image || !image->file) { PrintLog(_("not present\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL); #endif @@ -432,7 +432,7 @@ void RS01Verify(Image *image) if(image->inLast == 2048) { PrintLog(_("present, contains %" PRId64 " medium sectors.\n"), image->sectorSize); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize); #endif @@ -440,7 +440,7 @@ void RS01Verify(Image *image) else { PrintLog(_("present, contains %" PRId64 " medium sectors and %d bytes.\n"), image->sectorSize-1, image->inLast); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " sectors + %d bytes"), image->sectorSize-1, image->inLast); @@ -450,7 +450,7 @@ void RS01Verify(Image *image) if(!Closure->quickVerify) RS01ScanImage(self, image, NULL, PRINT_MODE); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->cmpImageResult), @@ -469,7 +469,7 @@ void RS01Verify(Image *image) { diff = image->expectedSectors - image->sectorSize; PrintLog(_("* truncated image : %" PRId64 " sectors too short\n"), diff); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " (%" PRId64 " sectors too short)"), @@ -484,7 +484,7 @@ void RS01Verify(Image *image) /*** Show summary of image read */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(image->crcErrors) SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), @@ -497,7 +497,7 @@ void RS01Verify(Image *image) if(excess_sectors) { PrintLog(_("* image too long : %" PRId64 " excess sectors\n"), excess_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " (%" PRId64 " excess sectors)"), @@ -519,7 +519,7 @@ void RS01Verify(Image *image) if(!image->crcErrors) { PrintLog(_("- good image : all sectors present\n" "- image md5sum : %s\n"),idigest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpImageResult),_("Good image."), Closure->greenMarkup); SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest); @@ -530,7 +530,7 @@ void RS01Verify(Image *image) { PrintLog(_("* suspicious image : all sectors present, but %" PRId64 " CRC errors\n" "- image md5sum : %s\n"),image->crcErrors,idigest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpImageResult), _("Image complete, but contains checksum errors!"), Closure->redMarkup); SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest); @@ -543,7 +543,7 @@ void RS01Verify(Image *image) PrintLog(_("* BAD image : %" PRId64 " sectors missing\n"), image->sectorsMissing); else PrintLog(_("* BAD image : %" PRId64 " sectors missing, %" PRId64 " CRC errors\n"), image->sectorsMissing, image->crcErrors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpImageResult), _("Bad image."), Closure->redMarkup); @@ -554,7 +554,7 @@ void RS01Verify(Image *image) /*** The .ecc file */ process_ecc: -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpHeadline), "%s\n%s", _("Comparing image and error correction files."), @@ -565,7 +565,7 @@ process_ecc: if(!image) { PrintLog(_("not present\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpEccNotebook, 0, wl->cmpEccEmptyMsg,_("No error correction file present.")); @@ -595,7 +595,7 @@ process_ecc: PrintLog(_("unusable\n")); break; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpEccNotebook, 0, wl->cmpEccEmptyMsg,_("No error correction file present.")); @@ -625,7 +625,7 @@ process_ecc: PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SwitchAndSetFootline(wl->cmpEccNotebook, 1, wl->cmpEccCreatedBy, @@ -639,7 +639,7 @@ process_ecc: PrintLog(format, _("created by dvdisaster"), major, minor, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpEccNotebook, 1, wl->cmpEccCreatedBy, format, "dvdisaster", @@ -649,7 +649,7 @@ process_ecc: } else { PrintLog(_("created by dvdisaster-0.41.x.\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpEccNotebook, 1, wl->cmpEccCreatedBy, "dvdisaster-0.41.x"); @@ -663,7 +663,7 @@ process_ecc: PrintLog(_("- method : %4s, %d roots, %4.1f%% redundancy.\n"), method, eh->eccBytes, ((double)eh->eccBytes*100.0)/(double)eh->dataBytes); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), method, eh->eccBytes, @@ -676,7 +676,7 @@ process_ecc: { PrintLog(_("- requires : dvdisaster-%d.%d (good)\n"), eh->neededVersion/10000, (eh->neededVersion%10000)/100); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", eh->neededVersion/10000, @@ -690,7 +690,7 @@ process_ecc: eh->neededVersion/10000, (eh->neededVersion%10000)/100); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", @@ -712,7 +712,7 @@ process_ecc: if(!image->file) { if(!ecc_in_last) { PrintLog(_("- medium sectors : %" PRId64 "\n"), image->expectedSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors); #endif @@ -720,7 +720,7 @@ process_ecc: else { PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes\n"), image->expectedSectors-1, ecc_in_last); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), _("%" PRId64 " sectors + %d bytes"), @@ -735,7 +735,7 @@ process_ecc: && (!ecc_in_last || image->inLast == eh->inLast)) { if(!ecc_in_last) { PrintLog(_("- medium sectors : %" PRId64 " (good)\n"), image->expectedSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors); #endif @@ -743,7 +743,7 @@ process_ecc: else { PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes (good)\n"), image->expectedSectors-1, ecc_in_last); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), _("%" PRId64 " sectors + %d bytes"), @@ -756,7 +756,7 @@ process_ecc: { /* TAO case (1 or 2 sectors more than expected) */ if(image->sectorSize > image->expectedSectors && image->sectorSize - image->expectedSectors <= 2) { PrintLog(_("* medium sectors : %" PRId64 " (BAD, perhaps TAO/DAO mismatch)\n"), image->expectedSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(!ecc_in_last) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", @@ -769,7 +769,7 @@ process_ecc: else /* more than 2 Sectors difference */ { if(!ecc_in_last) { PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"), image->expectedSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", Closure->redMarkup, image->expectedSectors); @@ -781,7 +781,7 @@ process_ecc: else /* byte size difference */ { PrintLog(_("* medium sectors : %" PRId64 " sectors + %d bytes (BAD)\n"), image->expectedSectors-1, ecc_in_last); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), _("%" PRId64 " sectors + %d bytes"), @@ -803,7 +803,7 @@ process_ecc: { int n = !memcmp(eh->mediumSum, image->mediumSum, 16); if(n) PrintLog(_("- image md5sum : %s (good)\n"),edigest); else PrintLog(_("* image md5sum : %s (BAD)\n"),edigest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(n) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest); else @@ -815,7 +815,7 @@ process_ecc: } else { PrintLog(_("- image md5sum : %s\n"),edigest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest); #endif @@ -825,7 +825,7 @@ process_ecc: if(image && image->file) { if(image->fpState != FP_PRESENT) { PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("missing sector prevents calculation"), Closure->redMarkup); #endif @@ -835,7 +835,7 @@ process_ecc: if(memcmp(image->imageFP, eh->mediumFP, 16)) { PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("mismatch"), Closure->redMarkup); @@ -847,7 +847,7 @@ process_ecc: } else { PrintLog(_("- fingerprint match: good\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good")); #endif @@ -867,14 +867,14 @@ process_ecc: if(ecc_expected == ecc_blocks) { PrintLog(_("- ecc blocks : %" PRId64 " (good)\n"),ecc_blocks); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "%" PRId64 "", ecc_blocks); #endif } else { PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),ecc_blocks,ecc_expected); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccBlocks), _("%" PRId64 " (bad, expected %" PRId64 ")"),Closure->redMarkup,ecc_blocks,ecc_expected); #endif @@ -899,17 +899,17 @@ process_ecc: percent = (100*count)/image->eccFile->size; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif PrintProgress(_("- ecc md5sum : %3d%%"),percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent); #endif last_percent = percent; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->cmpEccResult), @@ -924,7 +924,7 @@ process_ecc: if(memcmp(eh->eccSum, digest, 16)) { PrintLog(_("* ecc md5sum : BAD, ecc file may be damaged!\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), _("bad"), Closure->redMarkup); if(!ecc_advice) @@ -934,7 +934,7 @@ process_ecc: } else { PrintLog(_("- ecc md5sum : %s (good)\n"),edigest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%s", edigest); #endif @@ -943,7 +943,7 @@ process_ecc: skip_ecc: PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ecc_advice) { SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice); diff --git a/src/rs02-common.c b/src/rs02-common.c index eda2b63..c1a10df 100644 --- a/src/rs02-common.c +++ b/src/rs02-common.c @@ -432,7 +432,7 @@ RS02Layout *CalcRS02Layout(Image *image) /* See if user wants to pick a certain redundancy */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode && Closure->redundancy) #else if(Closure->redundancy) diff --git a/src/rs02-create.c b/src/rs02-create.c index 2cf994f..3b35418 100644 --- a/src/rs02-create.c +++ b/src/rs02-create.c @@ -31,7 +31,7 @@ typedef struct { Image *image; Method *self; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl; #endif RS02Layout *lay; @@ -56,7 +56,7 @@ static void ecc_cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ec->earlyTermination && ec->wl) SetLabelText(GTK_LABEL(ec->wl->encFootline), @@ -92,7 +92,7 @@ static void ecc_cleanup(gpointer data) g_free(ec); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -108,7 +108,7 @@ static void ecc_cleanup(gpointer data) static void abort_encoding(ecc_closure *ec, int truncate) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl = ec->wl; #endif @@ -116,14 +116,14 @@ static void abort_encoding(ecc_closure *ec, int truncate) { if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors))) Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions == STOP_CURRENT_ACTION) SetLabelText(GTK_LABEL(wl->encFootline), _("Aborted by user request! (partial ecc data removed from image)"), Closure->redMarkup); #endif } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { if(Closure->stopActions == STOP_CURRENT_ACTION) SetLabelText(GTK_LABEL(wl->encFootline), @@ -149,14 +149,14 @@ static void remove_old_ecc(ecc_closure *ec) guint64 data_bytes; int answer; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->confirmDeletion || !Closure->guiMode) #endif answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, _("Image \"%s\" already contains error correction information.\n" "Truncating image to data part (%" PRId64 " sectors).\n"), Closure->imageName, data_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else answer = TRUE; #endif @@ -213,7 +213,7 @@ static void check_image(ecc_closure *ec) { unsigned char buf[2048]; int expected,n,err; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ abort_encoding(ec, FALSE); #endif @@ -256,7 +256,7 @@ static void check_image(ecc_closure *ec) if(last_percent != percent) { PrintProgress(_("Preparing image (checksums, adding space): %3d%%") ,percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar1, percent, 100); #endif @@ -308,7 +308,7 @@ static void expand_image(ecc_closure *ec) { unsigned char buf[2048]; int n; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ abort_encoding(ec, TRUE); #endif @@ -326,7 +326,7 @@ static void expand_image(ecc_closure *ec) PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%") ,percent); else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar1, percent, 100); #endif @@ -340,7 +340,7 @@ static void expand_image(ecc_closure *ec) else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), 100); PrintProgress("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar1, 100, 100); #endif @@ -495,7 +495,7 @@ static gint32 *enc_alpha_to; /*** Show the second progress bar */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { ShowWidget(ec->wl->encPBar2); ShowWidget(ec->wl->encLabel2); @@ -607,7 +607,7 @@ static gint32 *enc_alpha_to; { int offset = 0; unsigned char *par_idx = ec->parity; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ abort_encoding(ec, TRUE); #endif @@ -997,7 +997,7 @@ static gint32 *enc_alpha_to; percent = (1000*progress)/max_percent; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar2, percent, 1000); else @@ -1060,7 +1060,7 @@ static gint32 *enc_alpha_to; void RS02Create(void) { Method *self = FindMethod("RS02"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl = (RS02Widgets*)self->widgetList; #endif Image *image = NULL; @@ -1090,13 +1090,13 @@ void RS02Create(void) ec->image = image; ec->self = self; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES ec->wl = wl; #endif ec->eh = g_malloc0(sizeof(EccHeader)); ec->timer = g_timer_new(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) /* Preliminary fill text for the head line */ SetLabelText(GTK_LABEL(wl->encHeadline), _("Augmenting the image with error correction data.\n%s"), @@ -1113,7 +1113,7 @@ void RS02Create(void) /*** Announce what we are going to do */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) /* Preliminary fill text for the head line */ { ec->msg = g_strdup_printf(_("Encoding with Method RS02: %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."), lay->dataSectors/512, lay->eccSectors/512, lay->nroots, lay->redundancy); @@ -1180,7 +1180,7 @@ void RS02Create(void) (lay->dataSectors + lay->eccSectors)/512, lay->dataSectors+lay->eccSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetProgress(wl->encPBar2, 100, 100); diff --git a/src/rs02-fix.c b/src/rs02-fix.c index be0ca3e..525fae4 100644 --- a/src/rs02-fix.c +++ b/src/rs02-fix.c @@ -32,7 +32,7 @@ typedef struct { Image *image; EccHeader *eh; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl; #endif RS02Layout *lay; @@ -49,7 +49,7 @@ static void fix_cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(fc->earlyTermination) SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -77,7 +77,7 @@ static void fix_cleanup(gpointer data) g_free(fc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -111,7 +111,7 @@ static void expand_image(fix_closure *fc, gint64 new_size) percent = (100*sectors) / new_sectors; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ; else @@ -121,7 +121,7 @@ static void expand_image(fix_closure *fc, gint64 new_size) } } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ; else @@ -141,7 +141,7 @@ static void expand_image(fix_closure *fc, gint64 new_size) void RS02Fix(Image *image) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Method *self = FindMethod("RS02"); RS02Widgets *wl = (RS02Widgets*)self->widgetList; #endif @@ -183,7 +183,7 @@ void RS02Fix(Image *image) /*** Register the cleanup procedure for GUI mode */ fc->image = image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES fc->wl = wl; #endif fc->earlyTermination = TRUE; @@ -191,7 +191,7 @@ void RS02Fix(Image *image) /*** Open the image file */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->fixHeadline), _("Repairing the image.\n%s"), @@ -219,7 +219,7 @@ void RS02Fix(Image *image) /*** Announce what we going to do */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { char *msg = g_strdup_printf(_("Image contains error correction data: Method RS02, %d roots, %4.1f%% redundancy."), eh->eccBytes, @@ -254,7 +254,7 @@ void RS02Fix(Image *image) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(fc->wl->fixNotebook, 1, fc->wl->fixFootline, _("Aborted by user request!"), @@ -268,7 +268,7 @@ void RS02Fix(Image *image) Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(diff>2 && Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, trans, @@ -291,7 +291,7 @@ void RS02Fix(Image *image) } #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(diff>2 && !Closure->guiMode) #else if(diff>2) @@ -364,7 +364,7 @@ void RS02Fix(Image *image) /* See if user hit the Stop button */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -493,7 +493,7 @@ void RS02Fix(Image *image) if(erasure_count>lay->nroots) /* uncorrectable */ { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { PrintCLI(_("* Ecc block %" PRId64 ": %3d unrepairable sectors: "), s, erasure_count); @@ -821,7 +821,7 @@ skip: if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { RS02AddFixValues(wl, percent, local_plot_max); @@ -852,7 +852,7 @@ skip: corrected, data_corr, ecc_corr); if(uncorrected > 0) { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, _("Image sectors could not be fully restored " @@ -874,7 +874,7 @@ skip: PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), (double)damaged_sectors/(double)damaged_eccsecs,worst_ecc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && t) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, "%s %s", _("Repair results:"), t); diff --git a/src/rs02-includes.h b/src/rs02-includes.h index e36a82d..f7344a6 100644 --- a/src/rs02-includes.h +++ b/src/rs02-includes.h @@ -23,7 +23,7 @@ #ifndef RS02INCLUDES_H #define RS02INCLUDES_H -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* Data structs from rs02-window.c */ typedef struct @@ -122,7 +122,7 @@ typedef struct * These are exported via the Method struct */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void CreateRS02EncWindow(Method*, GtkWidget*); void CreateRS02FixWindow(Method*, GtkWidget*); void CreateRS02PrefsPage(Method*, GtkWidget*); @@ -188,7 +188,7 @@ void RS02Fix(Image*); int RS02Recognize(Image*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* rs02-window.c */ void RS02AddFixValues(RS02Widgets*, int, int); diff --git a/src/rs02-recognize.c b/src/rs02-recognize.c index 69025ef..a42399a 100644 --- a/src/rs02-recognize.c +++ b/src/rs02-recognize.c @@ -29,7 +29,7 @@ *** Recognize RS02 error correction data in the image ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* * Dialog components for disabling RS02 search @@ -249,7 +249,7 @@ int RS02Recognize(Image *image) while(pos > 0) { int result; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) goto bail_out; #endif @@ -272,7 +272,7 @@ int RS02Recognize(Image *image) read_count++; if(!answered_continue && read_count > 5) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, _("Faster medium initialization\n\n" @@ -304,7 +304,7 @@ int RS02Recognize(Image *image) header_modulo >>= 1; } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES bail_out: #endif FreeBitmap(try_next_header); diff --git a/src/rs02-verify.c b/src/rs02-verify.c index 3b8cac7..3d3677d 100644 --- a/src/rs02-verify.c +++ b/src/rs02-verify.c @@ -28,7 +28,7 @@ *** Reset the verify output window ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void ResetRS02VerifyWindow(Method *self) { RS02Widgets *wl = (RS02Widgets*)self->widgetList; @@ -344,7 +344,7 @@ typedef struct { Image *image; EccHeader *eh; RS02Layout *lay; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS02Widgets *wl; #endif Bitmap *map; @@ -358,7 +358,7 @@ static void cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) AllowActions(TRUE); #endif @@ -371,7 +371,7 @@ static void cleanup(gpointer data) g_free(cc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -515,7 +515,7 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected) PrintLog(_("- prognosis : %" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)\n"), recoverable, expected, percentage/10, percentage%10); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Name), ""); SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Msg), ""); @@ -548,7 +548,7 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected) void RS02Verify(Image *image) { verify_closure *cc = g_malloc0(sizeof(verify_closure)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Method *self = FindMethod("RS02"); RS02Widgets *wl = self->widgetList; #endif @@ -574,7 +574,7 @@ void RS02Verify(Image *image) gint64 hdr_missing, hdr_crc_errors; gint64 hdr_ok,hdr_pos,hdr_correctable; gint64 ecc_sector,expected_sectors; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int ecc_md5_failure = FALSE; #endif int ecc_slice; @@ -583,7 +583,7 @@ void RS02Verify(Image *image) char method[5]; char *img_advice = NULL; char *ecc_advice = NULL; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int try_it; #endif int unrecoverable_sectors = 0; @@ -591,7 +591,7 @@ void RS02Verify(Image *image) /*** Prepare for early termination */ RegisterCleanup(_("Check aborted"), cleanup, cc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES cc->wl = wl; #endif @@ -609,7 +609,7 @@ void RS02Verify(Image *image) /*** Print information on image size */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpHeadline), "%s\n%s", _("Checking the image file."), @@ -619,7 +619,7 @@ void RS02Verify(Image *image) PrintLog("\n%s: ",Closure->imageName); PrintLog(_("present, contains %" PRId64 " medium sectors.\n"),image->sectorSize); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(expected_sectors == image->sectorSize) { SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize); @@ -689,7 +689,7 @@ void RS02Verify(Image *image) hdr_pos = (lay->protectedSectors + lay->headerModulo - 1) & ~(lay->headerModulo-1); else hdr_pos += lay->headerModulo; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(!hdr_crc_errors && !hdr_missing) SetLabelText(GTK_LABEL(wl->cmpEccHeaders), _("complete")); @@ -734,7 +734,7 @@ void RS02Verify(Image *image) /* Check for user interruption */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->cmpImageResult), @@ -820,7 +820,7 @@ void RS02Verify(Image *image) } } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/expected_sectors; else @@ -829,7 +829,7 @@ void RS02Verify(Image *image) if(last_percent != percent) { PrintProgress(_("- testing sectors : %3d%%") ,percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { add_verify_values(self, percent, new_missing, new_crc_errors); if(data_missing || data_crc_errors) @@ -853,7 +853,7 @@ void RS02Verify(Image *image) /* Complete damage summary */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(data_missing || data_crc_errors) SetLabelText(GTK_LABEL(wl->cmpDataSection), @@ -907,7 +907,7 @@ void RS02Verify(Image *image) PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(!data_missing && !data_crc_errors) SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete")); @@ -957,7 +957,7 @@ continue_with_ecc: PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SwitchAndSetFootline(wl->cmpEccNotebook, 1, wl->cmpEccCreatedBy, @@ -972,7 +972,7 @@ continue_with_ecc: PrintLog(format, _("created by dvdisaster"), major, minor, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpEccNotebook, 1, wl->cmpEccCreatedBy, @@ -989,7 +989,7 @@ continue_with_ecc: method, eh->eccBytes, ((double)eh->eccBytes*100.0)/(double)eh->dataBytes); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), method, eh->eccBytes, @@ -1004,7 +1004,7 @@ continue_with_ecc: (eh->neededVersion%10000)/100); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", eh->neededVersion/10000, @@ -1019,7 +1019,7 @@ continue_with_ecc: (eh->neededVersion%10000)/100); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", @@ -1043,7 +1043,7 @@ continue_with_ecc: { PrintLog(_("- medium sectors : %" PRId64 " / %" PRId64 " (good)\n"), expected_sectors, lay->dataSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 " / %" PRId64 "", expected_sectors, lay->dataSectors); @@ -1055,7 +1055,7 @@ continue_with_ecc: expected_sectors); else PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"),expected_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", Closure->redMarkup, expected_sectors); @@ -1078,7 +1078,7 @@ continue_with_ecc: if(n) PrintLog(_("- data md5sum : %s (good)\n"),hdr_digest); else PrintLog(_("* data md5sum : %s (BAD)\n"),hdr_digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(n) SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", hdr_digest); else @@ -1091,7 +1091,7 @@ continue_with_ecc: else { PrintLog(_("- data md5sum : %s\n"), "-"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", "-"); #endif @@ -1104,14 +1104,14 @@ continue_with_ecc: if(!crc_missing) { if(!memcmp(eh->crcSum, cc->crcSum, 16)) { PrintLog(_("- crc md5sum : %s (good)\n"),digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", digest); #endif } else { PrintLog(_("* crc md5sum : %s (BAD)\n"),digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", Closure->redMarkup, digest); } @@ -1122,7 +1122,7 @@ continue_with_ecc: else { PrintLog(_("- crc md5sum : %s\n"), "-"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", "-"); #endif @@ -1135,14 +1135,14 @@ continue_with_ecc: if(!ecc_missing) { if(!memcmp(eh->eccSum, ecc_sum, 16)) { PrintLog(_("- ecc md5sum : %s (good)\n"),digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", digest); #endif } else { PrintLog(_("* ecc md5sum : %s (BAD)\n"),digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", Closure->redMarkup, digest); } @@ -1153,7 +1153,7 @@ continue_with_ecc: else { PrintLog(_("- ecc md5sum : %s\n"), "-"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", "-"); #endif @@ -1162,12 +1162,12 @@ continue_with_ecc: /*** Print final results */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES try_it = #endif prognosis(cc, total_missing + data_crc_errors - hdr_correctable, expected_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ecc_advice) { SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice); diff --git a/src/rs03-create.c b/src/rs03-create.c index befa1d9..17375de 100644 --- a/src/rs03-create.c +++ b/src/rs03-create.c @@ -67,7 +67,7 @@ typedef struct { Method *self; Image *image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl; #endif RS03Layout *lay; @@ -147,7 +147,7 @@ static void ecc_cleanup(gpointer data) } } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ec->earlyTermination) SetLabelText(GTK_LABEL(ec->wl->encFootline), @@ -229,7 +229,7 @@ static void ecc_cleanup(gpointer data) if(ec->encoderData) g_free(ec->encoderData); g_free(ec); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -245,7 +245,7 @@ static void ecc_cleanup(gpointer data) static void abort_encoding(ecc_closure *ec, int truncate) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl = ec->wl; #endif @@ -255,14 +255,14 @@ static void abort_encoding(ecc_closure *ec, int truncate) else if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors))) Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->encFootline), _("Aborted by user request! (partial ecc data removed from image)"), Closure->redMarkup); #endif } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->encFootline), @@ -291,7 +291,7 @@ static void remove_old_ecc(ecc_closure *ec) { if(ConfirmEccDeletion(Closure->eccName)) LargeUnlink(Closure->eccName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else { SetLabelText(GTK_LABEL(ec->wl->encFootline), _("Aborted to keep existing ecc file."), @@ -311,14 +311,14 @@ static void remove_old_ecc(ecc_closure *ec) guint64 data_bytes; int answer; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->confirmDeletion || !Closure->guiMode) #endif answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, _("Image \"%s\" already contains error correction information.\n" "Truncating image to data part (%" PRId64 " sectors).\n"), Closure->imageName, data_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES else answer = TRUE; #endif @@ -514,7 +514,7 @@ static void expand_image(ecc_closure *ec) { unsigned char dead_sector[2048]; int n; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ abort_encoding(ec, TRUE); #endif @@ -531,7 +531,7 @@ static void expand_image(ecc_closure *ec) if(last_percent != percent) { PrintProgress(_(progress_msg), percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar1, percent, 100); #endif @@ -543,7 +543,7 @@ static void expand_image(ecc_closure *ec) PrintProgress(_(progress_msg), 100); PrintProgress("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetProgress(ec->wl->encPBar1, 100, 100); #endif @@ -629,7 +629,7 @@ static void read_next_chunk(ecc_closure *ec, guint64 chunk) guint64 page_offset; #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* User hit the Stop button */ { ec->abortImmediately = TRUE; abort_encoding(ec, TRUE); @@ -860,7 +860,7 @@ static gpointer io_thread(ecc_closure *ec) for(chunk=0; chunksectorsPerLayer; chunk+=ec->chunkSize) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int cpu_bound = 0; #endif @@ -917,7 +917,7 @@ static gpointer io_thread(ecc_closure *ec) /* Wait until the encoders have finished */ g_mutex_lock(ec->lock); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES cpu_bound = ec->buffersToEncode; #endif while(ec->buffersToEncode) @@ -930,7 +930,7 @@ static gpointer io_thread(ecc_closure *ec) verbose("IO: chunk %d finished\n", ec->ioChunk); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(cpu_bound) { SetLabelText(GTK_LABEL(ec->wl->encBottleneck), _("CPU bound")); @@ -1137,7 +1137,7 @@ static gpointer encoder_thread(ecc_closure *ec) { ec->lastPercent = percent; g_mutex_unlock(ec->lock); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { gdouble elapsed; gulong ignore; @@ -1178,14 +1178,14 @@ static void create_reed_solomon(ecc_closure *ec) { int nroots = ec->lay->nroots; int ndata = ec->lay->ndata; int i; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES char *alg="none"; char *iostrat="none"; #endif /*** Show the second progress bar */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { ShowWidget(ec->wl->encPBar2); ShowWidget(ec->wl->encLabel2); @@ -1289,7 +1289,7 @@ static void create_reed_solomon(ecc_closure *ec) void RS03Create(void) { Method *method = FindMethod("RS03"); Image *image = NULL; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl = (RS03Widgets*)method->widgetList; #endif RS03Layout *lay; @@ -1301,14 +1301,14 @@ void RS03Create(void) /*** Register the cleanup procedure for GUI mode */ ec->self = method; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES ec->wl = wl; #endif ec->earlyTermination = TRUE; RegisterCleanup(_("Error correction data creation aborted"), ecc_cleanup, ec); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) /* Preliminary fill text for the head line */ SetLabelText(GTK_LABEL(wl->encHeadline), _("Augmenting the image with error correction data.\n%s"), @@ -1359,7 +1359,7 @@ void RS03Create(void) /*** Announce what we are going to do */ ecc_sectors = lay->nroots*lay->sectorsPerLayer; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) /* Preliminary fill text for the head line */ { ec->msg = g_strdup_printf(_("Encoding with Method RS03: %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."), lay->dataSectors/512, ecc_sectors/512, lay->nroots, lay->redundancy); @@ -1458,7 +1458,7 @@ void RS03Create(void) mbs = ((double)lay->ndata*lay->sectorsPerLayer)/(512.0*elapsed); PrintLog(_("Avg performance: %5.2fs (%5.2fMiB/s) total\n"), elapsed, mbs); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->encPerformance), _("%5.2fMiB/s average"), mbs); SetLabelText(GTK_LABEL(ec->wl->encBottleneck), @@ -1467,7 +1467,7 @@ void RS03Create(void) } #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetProgress(wl->encPBar2, 100, 100); diff --git a/src/rs03-fix.c b/src/rs03-fix.c index 43dacd3..848ba07 100644 --- a/src/rs03-fix.c +++ b/src/rs03-fix.c @@ -31,7 +31,7 @@ typedef struct { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl; #endif RS03Layout *lay; @@ -49,7 +49,7 @@ static void fix_cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(fc->earlyTermination) SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -76,7 +76,7 @@ static void fix_cleanup(gpointer data) g_free(fc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -114,7 +114,7 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size) percent = (100*sectors) / new_sectors; if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ; else @@ -124,7 +124,7 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size) } } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ; else @@ -141,7 +141,7 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size) void RS03Fix(Image *image) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES Method *self = FindMethod("RS03"); RS03Widgets *wl = (RS03Widgets*)self->widgetList; #endif @@ -175,14 +175,14 @@ void RS03Fix(Image *image) gint64 damaged_eccsecs=0; gint64 expected_sectors; char *t=NULL; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES char *msg; #endif /*** Register the cleanup procedure for GUI mode */ fc->image = image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES fc->wl = wl; #endif fc->earlyTermination = TRUE; @@ -194,7 +194,7 @@ void RS03Fix(Image *image) /*** Open the image file */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->fixHeadline), _("Repairing the image.\n%s"), @@ -237,7 +237,7 @@ void RS03Fix(Image *image) /*** Announce what we are going to do */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(eh->methodFlags[0] & MFLAG_ECC_FILE) msg = g_strdup_printf(_("Error correction file using Method RS03, %d roots, %4.1f%% redundancy."), @@ -264,7 +264,7 @@ void RS03Fix(Image *image) { int difference = image->inLast - eh->inLast; guint64 expected_image_size = 2048*(expected_sectors-1)+eh->inLast; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, _("The image file is %d bytes longer than noted\n" @@ -283,7 +283,7 @@ void RS03Fix(Image *image) } #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode && !Closure->truncate) #else if(!Closure->truncate) @@ -321,7 +321,7 @@ void RS03Fix(Image *image) if(!answer) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES SwitchAndSetFootline(fc->wl->fixNotebook, 1, fc->wl->fixFootline, _("Aborted by user request!"), @@ -337,7 +337,7 @@ void RS03Fix(Image *image) Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(diff>2 && Closure->guiMode) { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, trans, @@ -362,7 +362,7 @@ void RS03Fix(Image *image) } #endif -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(diff>2 && !Closure->guiMode) #else if(diff>2) @@ -421,7 +421,7 @@ void RS03Fix(Image *image) /* See if user hit the Stop button */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SwitchAndSetFootline(fc->wl->fixNotebook, 1, @@ -551,7 +551,7 @@ void RS03Fix(Image *image) if(erasure_count>lay->nroots) /* uncorrectable */ { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(!Closure->guiMode) #endif { int sep_printed = 0; @@ -913,7 +913,7 @@ skip: if(last_percent != percent) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { RS03AddFixValues(wl, percent, local_plot_max); @@ -942,7 +942,7 @@ skip: corrected, data_corr, ecc_corr); if(uncorrected > 0) { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, _("Image sectors could not be fully restored " @@ -967,7 +967,7 @@ skip: PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), (double)damaged_sectors/(double)damaged_eccsecs,worst_ecc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode && t) SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, "%s %s", _("Repair results:"), t); diff --git a/src/rs03-includes.h b/src/rs03-includes.h index 9d6a50e..78af5dd 100644 --- a/src/rs03-includes.h +++ b/src/rs03-includes.h @@ -23,7 +23,7 @@ #ifndef RS03INCLUDES_H #define RS03INCLUDES_H -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* Data structs from rs03-window.c */ typedef struct @@ -133,7 +133,7 @@ typedef struct * These are exported via the Method struct */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void CreateRS03EncWindow(Method*, GtkWidget*); void CreateRS03FixWindow(Method*, GtkWidget*); void CreateRS03PrefsPage(Method*, GtkWidget*); @@ -200,7 +200,7 @@ void RS03Fix(Image*); int RS03RecognizeFile(LargeFile*, EccHeader**); int RS03RecognizeImage(Image*); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES /* rs03-window.c */ void RS03AddFixValues(RS03Widgets*, int, int); @@ -217,7 +217,7 @@ void RS03Verify(Image*); /* temporary single threaded versions */ void RS03SCreate(void); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void CreateRS03SEncWindow(Method*, GtkWidget*); void ResetRS03SEncWindow(Method*); #endif diff --git a/src/rs03-verify.c b/src/rs03-verify.c index 42e0370..d4ea4a5 100644 --- a/src/rs03-verify.c +++ b/src/rs03-verify.c @@ -35,7 +35,7 @@ /*** *** Reset the verify output window ***/ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES void ResetRS03VerifyWindow(Method *self) { RS03Widgets *wl = (RS03Widgets*)self->widgetList; @@ -376,7 +376,7 @@ typedef struct { Image *image; EccHeader *eh; RS03Layout *lay; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl; #endif CrcBuf *crcBuf; @@ -393,7 +393,7 @@ static void cleanup(gpointer data) UnregisterCleanup(); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) AllowActions(TRUE); #endif @@ -414,7 +414,7 @@ static void cleanup(gpointer data) g_free(vc); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) g_thread_exit(0); #endif @@ -460,7 +460,7 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected) PrintLog(_("- prognosis : %" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)\n"), recoverable, expected, percentage/10, percentage%10); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(vc->wl->cmpImageErasure), _("Erasure counts:")); SetLabelText(GTK_LABEL(vc->wl->cmpImagePrognosis), _("Prognosis:")); @@ -497,7 +497,7 @@ static int check_syndromes(verify_closure *vc) int bad_counted; int layer,i,j; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpHeadline), "%s\n%s", _("Checking the image and error correction files."), @@ -515,7 +515,7 @@ static int check_syndromes(verify_closure *vc) for(j=0; jeccBlock[j]); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), _("Out of memory; try reducing sector prefetch!"), @@ -541,7 +541,7 @@ static int check_syndromes(verify_closure *vc) /* Check for user interruption */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), @@ -603,7 +603,7 @@ static int check_syndromes(verify_closure *vc) if(!ecc_bad) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), _("%d%% tested"), @@ -614,7 +614,7 @@ static int check_syndromes(verify_closure *vc) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), _("%" PRId64 " good, %" PRId64 " bad; %d%% tested"), @@ -630,7 +630,7 @@ static int check_syndromes(verify_closure *vc) if(!ecc_bad) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),_("pass")); #endif @@ -639,7 +639,7 @@ static int check_syndromes(verify_closure *vc) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), _("%" PRId64 " good, %" PRId64 " bad; %" PRId64 " bad sub blocks"), @@ -660,7 +660,7 @@ static int check_syndromes(verify_closure *vc) void RS03Verify(Image *image) { Method *self = FindMethod("RS03"); verify_closure *vc = g_malloc0(sizeof(verify_closure)); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES RS03Widgets *wl = self->widgetList; #endif EccHeader *eh = NULL; @@ -683,12 +683,12 @@ void RS03Verify(Image *image) char *unstable=""; char method[5]; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES char *img_advice = NULL; char *ecc_advice = NULL; #endif char *version; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES int syn_error = 0; int try_it; #endif @@ -699,7 +699,7 @@ void RS03Verify(Image *image) RegisterCleanup(_("Check aborted"), cleanup, vc); vc->image = image; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES vc->wl = wl; #endif @@ -722,7 +722,7 @@ void RS03Verify(Image *image) else /* may only happen when ecc file is present */ { PrintLog("\n%s not present.\n", Closure->imageName); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL); #endif @@ -730,7 +730,7 @@ void RS03Verify(Image *image) if(eh->methodFlags[0] & MFLAG_ECC_FILE) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpHeadline), "%s\n%s", _("Checking the image and error correction files."), @@ -741,7 +741,7 @@ void RS03Verify(Image *image) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpHeadline), "%s\n%s", _("Checking the image file."), @@ -774,7 +774,7 @@ void RS03Verify(Image *image) else msg = g_strdup_printf(_("Ecc file is %" PRId64 " sectors longer than expected."), eccfile_sectors - expected_eccfile_sectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) ecc_advice = g_strdup_printf("%s", Closure->redMarkup, msg); #endif @@ -791,7 +791,7 @@ void RS03Verify(Image *image) PrintLog(_("- type : Error correction file\n")); else PrintLog(_("- type : Augmented image\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(eh->methodFlags[0] & MFLAG_ECC_FILE) SetLabelText(GTK_LABEL(wl->cmpEccType), _("Error correction file")); @@ -807,7 +807,7 @@ void RS03Verify(Image *image) method, eh->eccBytes, ((double)eh->eccBytes*100.0)/(double)eh->dataBytes); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), method, eh->eccBytes, @@ -830,7 +830,7 @@ void RS03Verify(Image *image) PrintLog(format, _("- created by : dvdisaster"), major, minor, micro, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format, "dvdisaster", major, minor, micro, unstable); @@ -842,7 +842,7 @@ void RS03Verify(Image *image) PrintLog(format, _("- created by : dvdisaster"), major, minor, unstable); PrintLog("\n"); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format, "dvdisaster", major, minor, unstable); @@ -863,7 +863,7 @@ void RS03Verify(Image *image) if(Closure->version >= eh->neededVersion) { PrintLog(_("- requires : dvdisaster-%s\n"), version); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%s", version); #endif @@ -874,7 +874,7 @@ void RS03Verify(Image *image) "* : Please visit http://www.dvdisaster.org for an upgrade.\n"), version); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%s", @@ -897,7 +897,7 @@ void RS03Verify(Image *image) PrintLog(_("- data md5sum : %s\n"),hdr_digest); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccDataCrcVal), "%s", hdr_digest); #endif @@ -909,7 +909,7 @@ void RS03Verify(Image *image) { if(image->fpState != FP_PRESENT) { PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("missing sector prevents calculation"), Closure->redMarkup); #endif @@ -919,7 +919,7 @@ void RS03Verify(Image *image) if(memcmp(image->imageFP, eh->mediumFP, 16)) { PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("mismatch"), Closure->redMarkup); @@ -931,7 +931,7 @@ void RS03Verify(Image *image) } else { PrintLog(_("- fingerprint match: good\n")); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good")); #endif @@ -942,7 +942,7 @@ void RS03Verify(Image *image) /* print advice collected from above tests */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(ecc_advice) { SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice); @@ -985,7 +985,7 @@ void RS03Verify(Image *image) if(expected_image_sectors == image->sectorSize && matching_byte_size) { if(lay->target == ECC_FILE) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(image->inLast == 2048) SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " in image; %" PRId64 " in ecc file"), @@ -1004,7 +1004,7 @@ void RS03Verify(Image *image) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " total / %" PRId64 " data"), image->sectorSize, lay->dataSectors); @@ -1024,7 +1024,7 @@ void RS03Verify(Image *image) expected_size = g_strdup_printf("%lld", (long long int)expected_image_sectors); else expected_size = g_strdup_printf("%lld sectors + %d bytes", (long long int)expected_image_sectors-1, eh->inLast); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%s (%s expected)"), Closure->redMarkup, image_size, expected_size); @@ -1089,7 +1089,7 @@ void RS03Verify(Image *image) /* Check for user interruption */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ SetLabelText(GTK_LABEL(wl->cmpImageResult), @@ -1211,7 +1211,7 @@ void RS03Verify(Image *image) if(!defective) SetBit(vc->map, s); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { /* data part / spiral animation */ percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/virtual_expected; @@ -1226,7 +1226,7 @@ void RS03Verify(Image *image) if(last_percent != percent) /* Update sector results */ { PrintProgress(_("- testing sectors : %3d%%") ,percent); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(lay->target == ECC_IMAGE) { add_verify_values(self, percent, new_missing, new_crc_errors); @@ -1265,7 +1265,7 @@ void RS03Verify(Image *image) if(lay->target == ECC_FILE && s == lay->dataSectors-1) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { /* flush/complete spiral */ add_verify_values(self, VERIFY_IMAGE_SEGMENTS, new_missing, new_crc_errors); @@ -1283,7 +1283,7 @@ void RS03Verify(Image *image) /* Complete damage summary */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(data_missing || data_crc_errors) SetLabelText(GTK_LABEL(wl->cmpDataSection), @@ -1334,7 +1334,7 @@ void RS03Verify(Image *image) PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing); } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(!data_missing && !data_crc_errors) SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete")); @@ -1348,7 +1348,7 @@ void RS03Verify(Image *image) /*** Test error syndromes */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { SetLabelText(GTK_LABEL(wl->cmpEccSynLabel), _("Ecc block test:")); SetLabelText(GTK_LABEL(wl->cmpEccSyndromes), ""); @@ -1356,7 +1356,7 @@ void RS03Verify(Image *image) #endif if(0&&total_missing + data_crc_errors != 0) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(GTK_LABEL(wl->cmpEccSyndromes), _("Skipped; not useful on known defective image"), @@ -1367,7 +1367,7 @@ void RS03Verify(Image *image) } else { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES syn_error = #endif check_syndromes(vc); @@ -1375,7 +1375,7 @@ void RS03Verify(Image *image) /*** Print image advice */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(img_advice) @@ -1397,12 +1397,12 @@ void RS03Verify(Image *image) /*** Print final results */ -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES try_it = #endif prognosis(vc, total_missing+data_crc_errors, lay->totalSectors); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) { if(total_missing || data_crc_errors) { if(try_it) SetLabelText(GTK_LABEL(wl->cmpImageResult), diff --git a/src/scsi-layer.c b/src/scsi-layer.c index b1db2b1..4605e0f 100644 --- a/src/scsi-layer.c +++ b/src/scsi-layer.c @@ -2206,7 +2206,7 @@ int TestUnitReady(DeviceHandle *dh) if(SendPacket(dh, cmd, 6, NULL, 0, &dh->sense, DATA_NONE) != -1) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(Closure->status, ""); #endif @@ -2227,7 +2227,7 @@ int TestUnitReady(DeviceHandle *dh) { PrintCLIorLabel(STATUS_LABEL_OR_NULL, _("Waiting 10 seconds for drive: %d\n"),9-i); -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) return FALSE; #endif @@ -2240,7 +2240,7 @@ int TestUnitReady(DeviceHandle *dh) break; /* Something is wrong with the drive */ } -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->guiMode) SetLabelText(Closure->status, ""); #endif @@ -2496,7 +2496,7 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors) if(status) /* current try was unsuccessful */ { int last_key, last_asc, last_ascq; -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) /* user break */ return status; #endif diff --git a/src/udf.c b/src/udf.c index 48a60c9..a72fdcd 100644 --- a/src/udf.c +++ b/src/udf.c @@ -365,7 +365,7 @@ static IsoInfo* examine_iso(Image *image) for(sector=16; sector<32; sector++) { -#ifndef CLI +#ifndef WITH_CLI_ONLY_YES if(Closure->stopActions) continue; #endif