chore: better use of configure features

This commit is contained in:
Stéphane Lesimple
2021-01-17 11:34:37 +01:00
parent c72b85bb9a
commit 9e5ba80e29
39 changed files with 550 additions and 525 deletions

View File

@@ -19,7 +19,7 @@ jobs:
msystem: MINGW32 msystem: MINGW32
grep: 386 grep: 386
- ui: cli - ui: cli
clionly: 1 clionly: --with-cli-only
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
@@ -37,9 +37,7 @@ jobs:
shell: bash shell: bash
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: configure - name: configure
env: run: ./configure ${{ matrix.clionly }}
CLI_ONLY: ${{ matrix.clionly }}
run: ./configure
- name: make - name: make
run: nproc && make -j$(nproc) run: nproc && make -j$(nproc)
- name: check executable - name: check executable
@@ -80,7 +78,7 @@ jobs:
- name: install prerequisites - name: install prerequisites
run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man
- name: configure - name: configure
run: env CLI_ONLY=1 ./configure run: ./configure --with-cli-only
- name: make - name: make
run: nproc && make -j$(nproc) && make static && mv -f dvdisaster-static dvdisaster run: nproc && make -j$(nproc) && make static && mv -f dvdisaster-static dvdisaster
- name: check executable - name: check executable

View File

@@ -89,7 +89,7 @@ jobs:
shell: bash shell: bash
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: configure - name: configure
run: env CLI_ONLY=1 ./configure run: ./configure --with-cli-only
- name: make - name: make
run: nproc && make -j$(nproc) run: nproc && make -j$(nproc)
- name: check executable - name: check executable
@@ -125,7 +125,7 @@ jobs:
shell: bash shell: bash
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: configure - name: configure
run: env CLI_ONLY=1 ./configure run: ./configure --with-cli-only
- name: make - name: make
run: nproc && make -j$(nproc) run: nproc && make -j$(nproc)
- name: check executable - name: check executable
@@ -153,7 +153,7 @@ jobs:
- name: install prerequisites - name: install prerequisites
run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man jq run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man jq
- name: configure - name: configure
run: env CLI_ONLY=1 ./configure run: ./configure --with-cli-only
- name: make - name: make
run: nproc && make -j$(nproc) run: nproc && make -j$(nproc)
- name: check executability - name: check executability

View File

@@ -130,7 +130,7 @@ user@host> ./configure
If you want to build a CLI-only version, which doesn't depend If you want to build a CLI-only version, which doesn't depend
on the gtk2 libraries, you can run instead: 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. The script will possibly print some errors about missing libraries.
Type "configure --help" to learn about pointing configure Type "configure --help" to learn about pointing configure

View File

@@ -5,8 +5,9 @@
all: all:
@echo @echo
@echo "Please run \`./configure' first." @echo "Please run \`./configure' first."
@echo "To build a CLI-only version," @echo
@echo "run \`CLI_ONLY=1 ./configure' instead." @echo "To build a CLI-only version, run `./configure --with-cli-only'."
@echo
@echo "Note that dvdisaster requires GNU make to build." @echo "Note that dvdisaster requires GNU make to build."
@echo "Under non-Linux systems, it might be known as \`gmake'." @echo "Under non-Linux systems, it might be known as \`gmake'."
@echo @echo

View File

@@ -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 - 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 - 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 - 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) - Added pre-defined sizes for BD-R Triple Layer (100GB), BD-R Quadruple Layer (128GB)

58
configure vendored
View File

@@ -4,26 +4,10 @@
BASH_BASED_CONFIGURE=./scripts/bash-based-configure BASH_BASED_CONFIGURE=./scripts/bash-based-configure
BASH_BASED_CONFIGURE_OPTS="--buildtmp=$(pwd)/build $@" 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" 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" 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 CFG_USE_CYGWIN="no" # do not change
if test -e $BASH_BASED_CONFIGURE; then if test -e $BASH_BASED_CONFIGURE; then
@@ -37,8 +21,8 @@ fi
# Set the package name and version # Set the package name and version
PACKAGE dvdisaster 0.79.6 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. # Check for some essential tools.
@@ -60,12 +44,22 @@ GET_LOCALEDIR
GET_BUILDROOT GET_BUILDROOT
GET_BUILDTMP 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 # Look for required libraries
PRINT_MESSAGE "\nLooking for includes and libraries:" PRINT_MESSAGE "\nLooking for includes and libraries:"
REQUIRE_GLIB2 2 32 0 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 REQUIRE_GTK2 2 6 0 WITH_THREADS
fi fi
echo echo
@@ -129,7 +123,7 @@ if ! EXECUTE_PROGRAM "xgettext --help" xgettext \
cfg_force_with_nls=no cfg_force_with_nls=no
fi 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 if ! EXECUTE_PROGRAM "gdk-pixbuf-csource --help" gdk_pixbuf_csource ; then
echo "* gdk-pixbuf not installed" echo "* gdk-pixbuf not installed"
echo "* or path to gdk-pixbuf-csource is missing." 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):" PRINT_MESSAGE "\nDebugging options (do not use in production system):"
WITH_OPTION memdebug no "[no | yes]" 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 test "$cfg_with_efence" == "yes"; then
if ! CHECK_LIBRARY efence malloc efence; then if ! CHECK_LIBRARY efence malloc efence; then
@@ -172,7 +184,7 @@ cfiles="src/method-link.c"
ofiles="$BUILDTMP/method-link.o" ofiles="$BUILDTMP/method-link.o"
for cfile in src/*.c; do 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 grep -q 'DVDISASTER_GUI_FILE' "$cfile" && continue
fi fi
cfile_prefix=`echo $cfile | sed -e 's/\.c//'` cfile_prefix=`echo $cfile | sed -e 's/\.c//'`
@@ -184,7 +196,7 @@ done
echo echo
echo -e "\nCFG_CFILES = $cfiles" >> Makefile.config echo -e "\nCFG_CFILES = $cfiles" >> Makefile.config
echo "CFG_OFILES = $ofiles" >> 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 echo "ICONS = src/inlined-icons.h" >> Makefile.config
fi fi

View File

@@ -470,7 +470,7 @@ function PACKAGE()
echo "CFG_VERSION = $VERSION" >> Makefile.config 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() function DEFINE_STRING()
{ {
@@ -483,6 +483,19 @@ function DEFINE_STRING()
CFG_OTHER_OPTIONS="$CFG_OTHER_OPTIONS -D$1=\\\"$2\\\"" 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 # Add CFG_$1 = $2 to makefile
function DEFINE_VAR() function DEFINE_VAR()

View File

@@ -2,7 +2,7 @@
build=$(grep BUILDNUM $1 2>/dev/null | cut -d\ -f3) build=$(grep BUILDNUM $1 2>/dev/null | cut -d\ -f3)
build=$((build+1)) build=$((build+1))
cat >$1 <<EOF cat >$1 <<EOF
#ifdef CLI #ifdef WITH_CLI_ONLY_YES
#define FLAVOR NOGUI #define FLAVOR NOGUI
#else #else
#define FLAVOR GUI #define FLAVOR GUI

View File

@@ -137,7 +137,7 @@ find_dotfile:
* Update color string for the <span color="#f00baa">...</span> string * Update color string for the <span color="#f00baa">...</span> string
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void UpdateMarkup(char **string, GdkColor *color) void UpdateMarkup(char **string, GdkColor *color)
{ int hexval; { int hexval;
@@ -339,7 +339,7 @@ void ReadDotfile()
if(!strcmp(symbol, "verbose")) { Closure->verbose = atoi(value); continue; } if(!strcmp(symbol, "verbose")) { Closure->verbose = atoi(value); continue; }
if(!strcmp(symbol, "welcome-msg")) { Closure->welcomeMessage = 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); if(!strcmp(symbol, "positive-text")) { get_color(Closure->greenText, value);
UpdateMarkup(&Closure->greenMarkup, Closure->greenText); UpdateMarkup(&Closure->greenMarkup, Closure->greenText);
continue; continue;
@@ -445,7 +445,7 @@ static void update_dotfile()
g_fprintf(dotfile, "verbose: %d\n", Closure->verbose); g_fprintf(dotfile, "verbose: %d\n", Closure->verbose);
g_fprintf(dotfile, "welcome-msg: %d\n\n", Closure->welcomeMessage); 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, "positive-text", Closure->greenText);
save_colors(dotfile, "negative-text", Closure->redText); save_colors(dotfile, "negative-text", Closure->redText);
save_colors(dotfile, "bar-color", Closure->barColor); save_colors(dotfile, "bar-color", Closure->barColor);
@@ -566,7 +566,7 @@ void InitClosure()
Closure->bdSize3 = Closure->savedBDSize3 = BDXL_TL_SIZE; Closure->bdSize3 = Closure->savedBDSize3 = BDXL_TL_SIZE;
Closure->bdSize4 = Closure->savedBDSize4 = BDXL_QL_SIZE; Closure->bdSize4 = Closure->savedBDSize4 = BDXL_QL_SIZE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->logString = g_string_sized_new(1024); Closure->logString = g_string_sized_new(1024);
Closure->logLock = g_malloc0(sizeof(GMutex)); Closure->logLock = g_malloc0(sizeof(GMutex));
g_mutex_init(Closure->logLock); g_mutex_init(Closure->logLock);
@@ -633,7 +633,7 @@ void cond_free_ptr_array(GPtrArray *a)
void FreeClosure() void FreeClosure()
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
#endif #endif
/* in CLI-only mode, always update dotfile */ /* in CLI-only mode, always update dotfile */
@@ -664,7 +664,7 @@ void FreeClosure()
cond_free(Closure->dDumpDir); cond_free(Closure->dDumpDir);
cond_free(Closure->dDumpPrefix); cond_free(Closure->dDumpPrefix);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->prefsContext) if(Closure->prefsContext)
FreePreferences(Closure->prefsContext); FreePreferences(Closure->prefsContext);

View File

@@ -260,7 +260,7 @@ int CheckForMissingSectors(unsigned char *buf, guint64 sector,
*** Dialogue for indicating problem with the missing sector *** Dialogue for indicating problem with the missing sector
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void insert_buttons(GtkDialog *dialog) static void insert_buttons(GtkDialog *dialog)
{ {
gtk_dialog_add_buttons(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) void ExplainMissingSector(unsigned char *buf, guint64 sector, int error, int source_type, int *number)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int answer; int answer;
#endif #endif
guint64 recorded_number; 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. */ /* 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) if(!Closure->guiMode && !Closure->verbose && *number > 0)
#else #else
if(!Closure->verbose && *number > 0) 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); vol_label = get_volume_label(buf);
if(vol_label) if(vol_label)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
label_msg = g_strdup_printf(_("\n\nThe label of the original (defective) medium was:\n%s\n\n"), vol_label); label_msg = g_strdup_printf(_("\n\nThe label of the original (defective) medium was:\n%s\n\n"), vol_label);
else 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" "repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n"); "error correction data for it. Sorry for the bad news.\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintLogWithAsterisks(msg,sector, recorded_number, label_msg); PrintLogWithAsterisks(msg,sector, recorded_number, label_msg);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector, recorded_number, label_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" "repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n"); "error correction data for it. Sorry for the bad news.\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintLogWithAsterisks(msg,sector, label_msg); PrintLogWithAsterisks(msg,sector, label_msg);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector, label_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" "repaired by dvdisaster. Also it will not be possible to create\n"
"error correction data for it. Sorry for the bad news.\n"); "error correction data for it. Sorry for the bad news.\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintLogWithAsterisks(msg, sector); PrintLogWithAsterisks(msg, sector);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector); 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" "in the ecc file are missing and its error correction\n"
"capacity will be reduced.\n"); "capacity will be reduced.\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintLogWithAsterisks(msg, sector); PrintLogWithAsterisks(msg, sector);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg, { answer = ModalDialog(GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, insert_buttons, msg,
sector); sector);

View File

@@ -114,7 +114,7 @@ typedef enum
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ int mode = MODE_NONE; { int mode = MODE_NONE;
int sequence = MODE_NONE; int sequence = MODE_NONE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int devices_queried = FALSE; int devices_queried = FALSE;
#endif #endif
char *debug_arg = NULL; char *debug_arg = NULL;
@@ -763,7 +763,7 @@ int main(int argc, char *argv[])
if(!Closure->device && mode == MODE_SEQUENCE if(!Closure->device && mode == MODE_SEQUENCE
&& (sequence & (1<<MODE_READ | 1<<MODE_SCAN))) && (sequence & (1<<MODE_READ | 1<<MODE_SCAN)))
{ Closure->device = DefaultDevice(); { Closure->device = DefaultDevice();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
devices_queried = TRUE; devices_queried = TRUE;
#endif #endif
} }
@@ -920,7 +920,7 @@ int main(int argc, char *argv[])
/*** If no mode was selected, print the help screen. */ /*** If no mode was selected, print the help screen. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(mode == MODE_HELP) if(mode == MODE_HELP)
#else #else
if(mode == MODE_HELP || mode == MODE_NONE) if(mode == MODE_HELP || mode == MODE_NONE)
@@ -1019,7 +1019,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* If no mode was selected at the command line, /* If no mode was selected at the command line,
start the graphical user interface. */ start the graphical user interface. */

View File

@@ -53,7 +53,7 @@
#include <glib.h> #include <glib.h>
#include <glib/gprintf.h> #include <glib/gprintf.h>
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
#include <gtk/gtk.h> #include <gtk/gtk.h>
#endif #endif
@@ -86,13 +86,14 @@
Note that these functions are even required when Note that these functions are even required when
WITH_NLS_NO is set! */ WITH_NLS_NO is set! */
#ifdef DEBUG_PRINTF_FORMAT #ifndef WITH_DEBUG_PRINTF_FORMAT_YES
/* disable sgettext() calls so that the compiler can analyze printf format strings */ #define _(string) sgettext(string)
#define _(string) string #define _utf(string) sgettext_utf8(string)
#define _utf(string) string
#else #else
#define _(string) sgettext(string) /* disable sgettext() calls so that the compiler
#define _utf(string) sgettext_utf8(string) can analyze printf format strings */
#define _(string) string
#define _utf(string) string
#endif #endif
/* File permissions for images */ /* File permissions for images */
@@ -109,7 +110,7 @@
#define round(x) rint(x) #define round(x) rint(x)
#endif #endif
#ifdef CLI #ifdef WITH_CLI_ONLY_YES
#define STATUS_LABEL_OR_NULL NULL #define STATUS_LABEL_OR_NULL NULL
#else #else
#define STATUS_LABEL_OR_NULL Closure->status #define STATUS_LABEL_OR_NULL Closure->status
@@ -310,7 +311,7 @@ typedef struct _GlobalClosure
struct _CrcBuf *crcBuf; /* crcBuf of last image read */ struct _CrcBuf *crcBuf; /* crcBuf of last image read */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** GUI-related things */ /*** GUI-related things */
int guiMode; /* TRUE if GUI is active */ int guiMode; /* TRUE if GUI is active */
@@ -318,7 +319,7 @@ typedef struct _GlobalClosure
#endif #endif
int noMissingWarnings; /* suppress warnings about inconsistent missing sectors */ int noMissingWarnings; /* suppress warnings about inconsistent missing sectors */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
GtkWidget *logWidget; /* Dialog for the log display */ GtkWidget *logWidget; /* Dialog for the log display */
GtkScrolledWindow *logScroll; /* and its scrolled window */ GtkScrolledWindow *logScroll; /* and its scrolled window */
GtkTextBuffer *logBuffer; /* Text buffer for the log output */ GtkTextBuffer *logBuffer; /* Text buffer for the log output */
@@ -401,7 +402,7 @@ typedef struct _GlobalClosure
GtkWidget *readLinearFootlineBox; GtkWidget *readLinearFootlineBox;
#endif #endif
gint64 crcErrors, readErrors; /* these are passed between threads and must therefore be global */ 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 */ /*** Widgets for the adaptive reading action */
@@ -549,7 +550,7 @@ int ProbeCacheLineSize();
void InitClosure(void); void InitClosure(void);
void LocalizedFileDefaults(void); void LocalizedFileDefaults(void);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void UpdateMarkup(char**, GdkColor*); void UpdateMarkup(char**, GdkColor*);
void DefaultColors(void); void DefaultColors(void);
#endif #endif
@@ -624,7 +625,7 @@ int CrcBufValid(CrcBuf*, struct _Image*, EccHeader*);
void PrintCrcBuf(CrcBuf*); void PrintCrcBuf(CrcBuf*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** curve.c *** curve.c
***/ ***/
@@ -735,7 +736,7 @@ void PrintEccHeader(EccHeader*);
*** fix-window.c *** fix-window.c
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void CreateFixWindow(GtkWidget*); void CreateFixWindow(GtkWidget*);
#endif #endif
@@ -795,7 +796,7 @@ void FreeGaloisTables(GaloisTables*);
ReedSolomonTables *CreateReedSolomonTables(GaloisTables*, gint32, gint32, int); ReedSolomonTables *CreateReedSolomonTables(GaloisTables*, gint32, gint32, int);
void FreeReedSolomonTables(ReedSolomonTables*); void FreeReedSolomonTables(ReedSolomonTables*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** help-dialogs.c *** help-dialogs.c
***/ ***/
@@ -1073,7 +1074,7 @@ int forget(void*);
void check_memleaks(void); void check_memleaks(void);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** menubar.c *** menubar.c
***/ ***/
@@ -1109,7 +1110,7 @@ typedef struct _Method
void (*updateCksums)(Image*, gint64, unsigned char*);/* checksum while reading an image */ void (*updateCksums)(Image*, gint64, unsigned char*);/* checksum while reading an image */
int (*finalizeCksums)(Image*); int (*finalizeCksums)(Image*);
void *ckSumClosure; /* working closure for above */ void *ckSumClosure; /* working closure for above */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void (*createVerifyWindow)(struct _Method*, GtkWidget*); void (*createVerifyWindow)(struct _Method*, GtkWidget*);
void (*createCreateWindow)(struct _Method*, GtkWidget*); void (*createCreateWindow)(struct _Method*, GtkWidget*);
void (*createFixWindow)(struct _Method*, GtkWidget*); void (*createFixWindow)(struct _Method*, GtkWidget*);
@@ -1121,7 +1122,7 @@ typedef struct _Method
void (*readPreferences)(struct _Method*); void (*readPreferences)(struct _Method*);
#endif #endif
void (*destroy)(struct _Method*); void (*destroy)(struct _Method*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int tabWindowIndex; /* our position in the (invisible) notebook */ int tabWindowIndex; /* our position in the (invisible) notebook */
void *widgetList; /* linkage to window system */ void *widgetList; /* linkage to window system */
#endif #endif
@@ -1155,7 +1156,7 @@ void Verbose(char*, ...) PRINTF_FORMAT(1);
void PrintTimeToLog(GTimer*, char*, ...) PRINTF_FORMAT(2); void PrintTimeToLog(GTimer*, char*, ...) PRINTF_FORMAT(2);
void PrintProgress(char*, ...) PRINTF_FORMAT(1); void PrintProgress(char*, ...) PRINTF_FORMAT(1);
void ClearProgress(void); void ClearProgress(void);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void PrintCLIorLabel(GtkLabel*, char*, ...) PRINTF_FORMAT(2); void PrintCLIorLabel(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
#else #else
void PrintCLIorLabel(void*, char*, ...) PRINTF_FORMAT(2); void PrintCLIorLabel(void*, char*, ...) PRINTF_FORMAT(2);
@@ -1169,7 +1170,7 @@ void UnregisterCleanup(void);
GThread* CreateGThread(GThreadFunc, gpointer); GThread* CreateGThread(GThreadFunc, gpointer);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void ShowWidget(GtkWidget*); void ShowWidget(GtkWidget*);
void AllowActions(gboolean); void AllowActions(gboolean);
@@ -1186,7 +1187,7 @@ int ModalWarning(char*, ...) PRINTF_FORMAT(1);
#define ModalWarningOrCLI(a,b,c,d,...) ModalWarning(d,__VA_ARGS__) #define ModalWarningOrCLI(a,b,c,d,...) ModalWarning(d,__VA_ARGS__)
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void SetText(PangoLayout*, char*, int*, int*); void SetText(PangoLayout*, char*, int*, int*);
void SwitchAndSetFootline(GtkWidget*, int, GtkWidget*, char*, ...) PRINTF_FORMAT(4); void SwitchAndSetFootline(GtkWidget*, int, GtkWidget*, char*, ...) PRINTF_FORMAT(4);
@@ -1200,7 +1201,7 @@ void LockLabelSize(GtkLabel*, char*, ...) PRINTF_FORMAT(2);
int ConfirmImageDeletion(char *); int ConfirmImageDeletion(char *);
int ConfirmEccDeletion(char *); int ConfirmEccDeletion(char *);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** preferences.c *** preferences.c
***/ ***/
@@ -1270,7 +1271,7 @@ void ReadDefectiveSectorFile(DefectiveSectorHeader *, struct _RawBuffer*, char*)
void ReadMediumLinear(gpointer); void ReadMediumLinear(gpointer);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** read-linear-window.c *** read-linear-window.c
***/ ***/
@@ -1292,7 +1293,7 @@ void GetReadingRange(gint64, gint64*, gint64*);
void ReadMediumAdaptive(gpointer); void ReadMediumAdaptive(gpointer);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** read-adaptive-window.c *** read-adaptive-window.c
***/ ***/
@@ -1473,7 +1474,7 @@ void *PrepareIterativeSmartLEC(RawBuffer*);
void SmartLECIteration(void*, char*); void SmartLECIteration(void*, char*);
void EndIterativeSmartLEC(void*); void EndIterativeSmartLEC(void*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** spiral.c *** spiral.c
***/ ***/

View File

@@ -53,7 +53,7 @@ void register_rs01(void)
method->finalizeCksums = RS01FinalizeCksums; method->finalizeCksums = RS01FinalizeCksums;
method->expectedImageSize = RS01ExpectedImageSize; method->expectedImageSize = RS01ExpectedImageSize;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** Linkage to rs01-window.c */ /*** Linkage to rs01-window.c */
method->createCreateWindow = CreateRS01EWindow; method->createCreateWindow = CreateRS01EWindow;
@@ -80,13 +80,13 @@ void register_rs01(void)
static void destroy(Method *method) static void destroy(Method *method)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = (RS01Widgets*)method->widgetList; RS01Widgets *wl = (RS01Widgets*)method->widgetList;
#endif #endif
g_free(method->ckSumClosure); g_free(method->ckSumClosure);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(wl) if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve); { if(wl->fixCurve) FreeCurve(wl->fixCurve);

View File

@@ -54,7 +54,7 @@ void register_rs02(void)
method->finalizeCksums = RS02FinalizeCksums; method->finalizeCksums = RS02FinalizeCksums;
method->expectedImageSize = RS02ExpectedImageSize; method->expectedImageSize = RS02ExpectedImageSize;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** Linkage to rs02-window.c */ /*** Linkage to rs02-window.c */
method->createCreateWindow = CreateRS02EncWindow; method->createCreateWindow = CreateRS02EncWindow;
@@ -82,7 +82,7 @@ void register_rs02(void)
static void destroy(Method *method) static void destroy(Method *method)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = (RS02Widgets*)method->widgetList; RS02Widgets *wl = (RS02Widgets*)method->widgetList;
#endif #endif
RS02CksumClosure *csc = (RS02CksumClosure*)method->ckSumClosure; RS02CksumClosure *csc = (RS02CksumClosure*)method->ckSumClosure;
@@ -91,7 +91,7 @@ static void destroy(Method *method)
g_free(csc->lay); g_free(csc->lay);
g_free(method->ckSumClosure); g_free(method->ckSumClosure);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(wl) if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve); { if(wl->fixCurve) FreeCurve(wl->fixCurve);

View File

@@ -55,7 +55,7 @@ void register_rs03(void)
method->recognizeEccFile = RS03RecognizeFile; method->recognizeEccFile = RS03RecognizeFile;
method->recognizeEccImage = RS03RecognizeImage; method->recognizeEccImage = RS03RecognizeImage;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** Linkage to rs03-window.c */ /*** Linkage to rs03-window.c */
method->createCreateWindow = CreateRS03EncWindow; method->createCreateWindow = CreateRS03EncWindow;
@@ -83,7 +83,7 @@ void register_rs03(void)
static void destroy(Method *method) static void destroy(Method *method)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = (RS03Widgets*)method->widgetList; RS03Widgets *wl = (RS03Widgets*)method->widgetList;
#endif #endif
RS03CksumClosure *csc = (RS03CksumClosure*)method->ckSumClosure; RS03CksumClosure *csc = (RS03CksumClosure*)method->ckSumClosure;
@@ -92,7 +92,7 @@ static void destroy(Method *method)
g_free(csc->lay); g_free(csc->lay);
g_free(method->ckSumClosure); g_free(method->ckSumClosure);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(wl) if(wl)
{ if(wl->fixCurve) FreeCurve(wl->fixCurve); { if(wl->fixCurve) FreeCurve(wl->fixCurve);

View File

@@ -148,7 +148,7 @@ int ReportImageEccInconsistencies(Image *image)
if(!image || image->type == IMAGE_NONE) if(!image || image->type == IMAGE_NONE)
{ if(image) CloseImage(image); { if(image) CloseImage(image);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ CreateMessage(_("Image file %s not present or permission denied.\n"), GTK_MESSAGE_ERROR, Closure->imageName); { CreateMessage(_("Image file %s not present or permission denied.\n"), GTK_MESSAGE_ERROR, Closure->imageName);
return TRUE; return TRUE;
@@ -163,7 +163,7 @@ int ReportImageEccInconsistencies(Image *image)
if(image->eccFile && !image->eccFileMethod) if(image->eccFile && !image->eccFileMethod)
{ CloseImage(image); { CloseImage(image);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ CreateMessage(_("\nError correction file type unknown.\n"), GTK_MESSAGE_ERROR); { CreateMessage(_("\nError correction file type unknown.\n"), GTK_MESSAGE_ERROR);
return TRUE; return TRUE;
@@ -178,7 +178,7 @@ int ReportImageEccInconsistencies(Image *image)
if(!image->eccFile && image->eccFileState == ECCFILE_NOPERM) if(!image->eccFile && image->eccFileState == ECCFILE_NOPERM)
{ CloseImage(image); { CloseImage(image);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ CreateMessage(_("\nPermission denied on ecc file (perhaps not writeable?).\n"), { CreateMessage(_("\nPermission denied on ecc file (perhaps not writeable?).\n"),
GTK_MESSAGE_ERROR); GTK_MESSAGE_ERROR);
@@ -195,7 +195,7 @@ int ReportImageEccInconsistencies(Image *image)
if(!image->eccFile && !image->eccMethod) if(!image->eccFile && !image->eccMethod)
{ CloseImage(image); { CloseImage(image);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ CreateMessage(_("\nNo error correction file present.\n" { CreateMessage(_("\nNo error correction file present.\n"
"No error correction data recognized in image.\n"), GTK_MESSAGE_ERROR); "No error correction data recognized in image.\n"), GTK_MESSAGE_ERROR);

View File

@@ -211,7 +211,7 @@ ssize_t LargeRead(LargeFile *lf, void *buf, size_t count)
* Writing large files * Writing large files
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void insert_buttons(GtkDialog *dialog) static void insert_buttons(GtkDialog *dialog)
{ {
gtk_dialog_add_buttons(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 */ /* Simply fail when going out of space in command line mode */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ while(count) { while(count)
@@ -243,7 +243,7 @@ static ssize_t xwrite(int fdes, void *buf_base, size_t count)
return total; return total;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* Give the user a chance to free more space in GUI mode. /* Give the user a chance to free more space in GUI mode.
When running out of space, the last write() may complete When running out of space, the last write() may complete
with n<count but no error condition, so we try writing with n<count but no error condition, so we try writing

View File

@@ -25,7 +25,7 @@
#include "scsi-layer.h" #include "scsi-layer.h"
#include "udf.h" #include "udf.h"
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* /*
* Local data * Local data
*/ */
@@ -85,21 +85,21 @@ static void print_tab(char *label, int tab_width)
void PrintMediumInfo(void *mi_ptr) void PrintMediumInfo(void *mi_ptr)
{ Image *image; { Image *image;
DeviceHandle *dh; DeviceHandle *dh;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
medium_info *mi=(medium_info*)mi_ptr; medium_info *mi=(medium_info*)mi_ptr;
#endif #endif
char *disc_status; char *disc_status;
char *sess_status; char *sess_status;
int tab_width=30; int tab_width=30;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!mi) /* create dummy medium_info in CLI mode so that PrintCLIorLabel() won't crash */ if(!mi) /* create dummy medium_info in CLI mode so that PrintCLIorLabel() won't crash */
{ mi=alloca(sizeof(medium_info)); { mi=alloca(sizeof(medium_info));
memset(mi, 0, sizeof(medium_info)); memset(mi, 0, sizeof(medium_info));
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
print_defaults(mi); print_defaults(mi);
#endif #endif
@@ -125,7 +125,7 @@ void PrintMediumInfo(void *mi_ptr)
print_tab("Medium type:",tab_width); print_tab("Medium type:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->physicalType, mi->physicalType,
#else #else
NULL, NULL,
@@ -133,7 +133,7 @@ NULL,
"%s\n", dh->typeDescr); "%s\n", dh->typeDescr);
print_tab("Book type:",tab_width); print_tab("Book type:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->bookType, mi->bookType,
#else #else
NULL, NULL,
@@ -141,7 +141,7 @@ NULL,
"%s\n", dh->bookDescr); "%s\n", dh->bookDescr);
print_tab("Manuf.-ID:",tab_width); print_tab("Manuf.-ID:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->manufID, mi->manufID,
#else #else
NULL, NULL,
@@ -149,7 +149,7 @@ NULL,
"%s\n", dh->manuID); "%s\n", dh->manuID);
print_tab("Drive profile:",tab_width); print_tab("Drive profile:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->profileDescr, mi->profileDescr,
#else #else
NULL, NULL,
@@ -172,7 +172,7 @@ NULL,
print_tab("Disc status:",tab_width); print_tab("Disc status:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->discStatus, mi->discStatus,
#else #else
NULL, NULL,
@@ -184,7 +184,7 @@ NULL,
print_tab("Used sectors:",tab_width); print_tab("Used sectors:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->usedCapacity1, mi->usedCapacity1,
#else #else
NULL, NULL,
@@ -193,7 +193,7 @@ NULL,
dh->readCapacity+1, (dh->readCapacity+1)>>9); dh->readCapacity+1, (dh->readCapacity+1)>>9);
print_tab(" ",tab_width); print_tab(" ",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->usedCapacity2, mi->usedCapacity2,
#else #else
NULL, NULL,
@@ -203,7 +203,7 @@ NULL,
print_tab("Blank capacity:",tab_width); print_tab("Blank capacity:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->blankCapacity, mi->blankCapacity,
#else #else
NULL, NULL,
@@ -225,7 +225,7 @@ NULL,
print_tab("Medium label:",tab_width); print_tab("Medium label:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->isoLabel, mi->isoLabel,
#else #else
NULL, NULL,
@@ -233,7 +233,7 @@ NULL,
"%s\n", image->isoInfo->volumeLabel); "%s\n", image->isoInfo->volumeLabel);
print_tab("File system size:",tab_width); print_tab("File system size:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->isoSize, mi->isoSize,
#else #else
NULL, NULL,
@@ -242,7 +242,7 @@ NULL,
image->isoInfo->volumeSize, (gint64)image->isoInfo->volumeSize>>9); image->isoInfo->volumeSize, (gint64)image->isoInfo->volumeSize>>9);
print_tab("Creation time:",tab_width); print_tab("Creation time:",tab_width);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mi->isoTime, mi->isoTime,
#else #else
NULL, NULL,
@@ -271,7 +271,7 @@ NULL,
memcpy(method, eh->method, 4); memcpy(method, eh->method, 4);
method[4] = 0; method[4] = 0;
print_tab("Error correction data:",tab_width); print_tab("Error correction data:",tab_width);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccState, _("%s, %d roots, %4.1f%% redundancy.\n"), PrintCLIorLabel(mi->eccState, _("%s, %d roots, %4.1f%% redundancy.\n"),
#else #else
PrintCLIorLabel(NULL, _("%s, %d roots, %4.1f%% redundancy.\n"), PrintCLIorLabel(NULL, _("%s, %d roots, %4.1f%% redundancy.\n"),
@@ -279,7 +279,7 @@ NULL,
method, eh->eccBytes, method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes); ((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
print_tab("Augmented image size:",tab_width); print_tab("Augmented image size:",tab_width);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccSize, _("%" PRIu64 " sectors (%" PRId64 " MiB)\n"), PrintCLIorLabel(mi->eccSize, _("%" PRIu64 " sectors (%" PRId64 " MiB)\n"),
#else #else
PrintCLIorLabel(NULL, _("%" PRId64 " sectors (%" PRId64 " MiB)\n"), PrintCLIorLabel(NULL, _("%" PRId64 " sectors (%" PRId64 " MiB)\n"),
@@ -289,13 +289,13 @@ NULL,
print_tab("dvdisaster version:", tab_width); print_tab("dvdisaster version:", tab_width);
if(micro) if(micro)
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccVersion, "%d.%d.%d", major, minor, micro); PrintCLIorLabel(mi->eccVersion, "%d.%d.%d", major, minor, micro);
#else #else
PrintCLIorLabel(NULL, "%d.%d.%d", major, minor, micro); PrintCLIorLabel(NULL, "%d.%d.%d", major, minor, micro);
#endif #endif
else else
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
PrintCLIorLabel(mi->eccVersion, "%d.%d", major, minor); PrintCLIorLabel(mi->eccVersion, "%d.%d", major, minor);
#else #else
PrintCLIorLabel(NULL, "%d.%d", major, minor); PrintCLIorLabel(NULL, "%d.%d", major, minor);
@@ -310,7 +310,7 @@ NULL,
/*** /***
*** GUI callbacks *** GUI callbacks
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* /*
* Callback for drive selection * Callback for drive selection

View File

@@ -58,7 +58,7 @@ char *sgettext(char *msgid)
char *sgettext_utf8(char *msgid) char *sgettext_utf8(char *msgid)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static gchar ringbuf[20][1024]; static gchar ringbuf[20][1024];
static int ringptr; static int ringptr;
#endif #endif
@@ -80,7 +80,7 @@ char *sgettext_utf8(char *msgid)
/*** If we are running the GUI, convert to UTF8 for Gtk+ */ /*** If we are running the GUI, convert to UTF8 for Gtk+ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ char *msg_utf8 = g_locale_to_utf8(msgval, -1, NULL, NULL, NULL); { 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. * Append message to the log window.
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
#define MAX_LOG_WIN_SIZE 10240 #define MAX_LOG_WIN_SIZE 10240
@@ -241,7 +241,7 @@ void PrintCLI(char *format, ...)
va_end(argp); va_end(argp);
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(Closure->verbose) { if(Closure->verbose)
{ va_start(argp, format); { va_start(argp, format);
@@ -271,7 +271,7 @@ void PrintProgress(char *format, ...)
va_list argp; va_list argp;
int n; int n;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
return; return;
#endif #endif
@@ -338,7 +338,7 @@ void PrintLog(char *format, ...)
va_start(argp, format); va_start(argp, format);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
log_window_vprintf(format, argp); log_window_vprintf(format, argp);
else else
@@ -389,7 +389,7 @@ void PrintLogWithAsterisks(char *format, ...)
va_start(argp, format); va_start(argp, format);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
log_window_vprintf(new_format, argp); log_window_vprintf(new_format, argp);
else else
@@ -423,7 +423,7 @@ void Verbose(char *format, ...)
va_start(argp, format); va_start(argp, format);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
log_window_vprintf(format, argp); log_window_vprintf(format, argp);
else else
@@ -459,7 +459,7 @@ void PrintTimeToLog(GTimer *timer, char *format, ...)
tmp2 = g_strdup_printf("%02d:%02d:%04.1f %s", hours, minutes, seconds, tmp1); tmp2 = g_strdup_printf("%02d:%02d:%04.1f %s", hours, minutes, seconds, tmp1);
va_end(argp); va_end(argp);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ {
log_window_append(tmp2); log_window_append(tmp2);
@@ -480,7 +480,7 @@ void PrintTimeToLog(GTimer *timer, char *format, ...)
* or show it in the given label * or show it in the given label
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void PrintCLIorLabel(GtkLabel *label, char *format, ...) void PrintCLIorLabel(GtkLabel *label, char *format, ...)
#else #else
void PrintCLIorLabel(void *unused, char *format, ...) void PrintCLIorLabel(void *unused, char *format, ...)
@@ -495,7 +495,7 @@ void PrintCLIorLabel(void *unused, char *format, ...)
va_start(argp, format); va_start(argp, format);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ char *c,*tmp; { char *c,*tmp;
@@ -562,7 +562,7 @@ static void vlog_warning(char *format, va_list argp)
prefix[len] = 0; prefix[len] = 0;
str = g_string_sized_new(256); str = g_string_sized_new(256);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
g_string_append_printf(str,"* %s:%c", warn, Closure->guiMode ? '\n' : ' '); g_string_append_printf(str,"* %s:%c", warn, Closure->guiMode ? '\n' : ' ');
#else #else
g_string_append_printf(str,"* %s: ", warn); g_string_append_printf(str,"* %s: ", warn);
@@ -570,7 +570,7 @@ static void vlog_warning(char *format, va_list argp)
do do
{ c = strchr(line,'\n'); { c = strchr(line,'\n');
if(c) *c=0; if(c) *c=0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) g_string_append_printf(str,"* %s\n",line); if(Closure->guiMode) g_string_append_printf(str,"* %s\n",line);
else else
#endif #endif
@@ -584,7 +584,7 @@ static void vlog_warning(char *format, va_list argp)
if(Closure->logFileEnabled) if(Closure->logFileEnabled)
PrintLogFile("%s", str->str); PrintLogFile("%s", str->str);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ log_window_append(str->str); { log_window_append(str->str);
} }
@@ -637,7 +637,7 @@ void Stop(char *format, ...)
/*** CLI mode */ /*** CLI mode */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ g_printf("%s", _("\n*\n* dvdisaster - can not continue:\n*\n")); { g_printf("%s", _("\n*\n* dvdisaster - can not continue:\n*\n"));
@@ -650,7 +650,7 @@ void Stop(char *format, ...)
/*** GUI mode */ /*** GUI mode */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ char *titled,*msg,*utf_msg; { char *titled,*msg,*utf_msg;
int idx; int idx;
@@ -710,7 +710,7 @@ void Stop(char *format, ...)
/* see above: possibly unreachable in GUI mode! */ /* see above: possibly unreachable in GUI mode! */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ FreeClosure(); { FreeClosure();
@@ -782,7 +782,7 @@ void CallIdleFunc(gboolean (*idle_func)(gpointer), gpointer data)
/*** /***
*** Graphical user interface convenience *** Graphical user interface convenience
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* /*
* Show the given widget * Show the given widget
@@ -1111,7 +1111,7 @@ int ModalWarning(char *msg, ...)
vlog_warning(msg, argp); vlog_warning(msg, argp);
va_end(argp); va_end(argp);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ va_start(argp, msg); { va_start(argp, msg);
result = vmodal_dialog(mt, bt, button_fn, msg, argp); 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. * 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) void SetText(PangoLayout *layout, char *text, int *w, int *h)
{ PangoRectangle rect; { PangoRectangle rect;
char *t = g_locale_to_utf8(text, -1, NULL, NULL, NULL); char *t = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
@@ -1316,12 +1316,12 @@ static void insert_button(GtkDialog *dialog)
#endif #endif
int ConfirmImageDeletion(char *file) int ConfirmImageDeletion(char *file)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) /* Always delete it in command line mode */ if(!Closure->guiMode) /* Always delete it in command line mode */
#endif #endif
return TRUE; return TRUE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->confirmDeletion) /* I told you so... */ if(!Closure->confirmDeletion) /* I told you so... */
return TRUE; return TRUE;
@@ -1338,12 +1338,12 @@ int ConfirmImageDeletion(char *file)
int ConfirmEccDeletion(char *file) int ConfirmEccDeletion(char *file)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) /* Always delete it in command line mode */ if(!Closure->guiMode) /* Always delete it in command line mode */
#endif #endif
return TRUE; return TRUE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->confirmDeletion) /* I told you so... */ if(!Closure->confirmDeletion) /* I told you so... */
return TRUE; return TRUE;

View File

@@ -195,7 +195,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan)
if(!LargeStat(filename, &length)) if(!LargeStat(filename, &length))
{ {
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -272,7 +272,7 @@ int SaveDefectiveSector(RawBuffer *rb, int can_c2_scan)
LargeClose(file); LargeClose(file);
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -327,7 +327,7 @@ int TryDefectiveSectorCache(RawBuffer *rb, unsigned char *outbuf)
if(!status) if(!status)
{ {
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,

View File

@@ -368,7 +368,7 @@ static void cleanup(gpointer data)
} }
bail_out: bail_out:
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(rc->earlyTermination) { if(rc->earlyTermination)
SetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText); SetAdaptiveReadFootline(_("Aborted by unrecoverable error."), Closure->redText);
@@ -401,7 +401,7 @@ bail_out:
g_free(rc); g_free(rc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -490,7 +490,7 @@ static void print_progress(read_closure *rc, int immediate)
int total = rc->readable+rc->correctable; int total = rc->readable+rc->correctable;
int percent = (int)((1000LL*(long long)total)/rc->expectedSectors); int percent = (int)((1000LL*(long long)total)/rc->expectedSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
return; return;
#endif #endif
@@ -542,7 +542,7 @@ static void print_progress(read_closure *rc, int immediate)
static void clear_progress(read_closure *rc) static void clear_progress(read_closure *rc)
{ {
if(!rc->progressMsgLen || if(!rc->progressMsgLen ||
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->guiMode) Closure->guiMode)
#else #else
0) 0)
@@ -564,7 +564,7 @@ static void clear_progress(read_closure *rc)
* Sector markup in the spiral * Sector markup in the spiral
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color) static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color)
{ int segment; { int segment;
int changed = FALSE; int changed = FALSE;
@@ -654,7 +654,7 @@ static void open_and_determine_mode(read_closure *rc)
PrintLog(_("%s-type ECC found\n"), "RS01"); 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); SetAdaptiveReadMinimumPercentage((1000*(rc->eh->dataBytes-rc->eh->eccBytes))/rc->eh->dataBytes);
#endif #endif
} }
@@ -664,7 +664,7 @@ static void open_and_determine_mode(read_closure *rc)
rc->eh = rc->medium->eccHeader; rc->eh = rc->medium->eccHeader;
rc->lay = RS02LayoutFromImage(rc->medium); rc->lay = RS02LayoutFromImage(rc->medium);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadMinimumPercentage((1000*rc->lay->ndata)/255); SetAdaptiveReadMinimumPercentage((1000*rc->lay->ndata)/255);
#endif #endif
@@ -706,7 +706,7 @@ static void open_and_determine_mode(read_closure *rc)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif #endif
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -769,7 +769,7 @@ static void check_size(read_closure *rc)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif #endif
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -788,7 +788,7 @@ static void check_size(read_closure *rc)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif #endif
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -808,13 +808,13 @@ void GetReadingRange(gint64 sectors, gint64 *firstSector, gint64 *lastSector)
if(Closure->readStart || Closure->readEnd) if(Closure->readStart || Closure->readEnd)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) /* more range checks are made below */ if(!Closure->guiMode) /* more range checks are made below */
#endif #endif
{ first = Closure->readStart; { first = Closure->readStart;
last = Closure->readEnd < 0 ? sectors-1 : Closure->readEnd; last = Closure->readEnd < 0 ? sectors-1 : Closure->readEnd;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else /* be more permissive in GUI mode */ else /* be more permissive in GUI mode */
{ first = 0; { first = 0;
last = sectors-1; last = sectors-1;
@@ -861,7 +861,7 @@ static void check_ecc_fingerprint(read_closure *rc)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif #endif
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -911,11 +911,11 @@ int check_image_fingerprint(read_closure *rc)
if(memcmp(image_fp, medium_fp, 16)) if(memcmp(image_fp, medium_fp, 16))
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
Stop(_("Image file does not match the optical disc.")); Stop(_("Image file does not match the optical disc."));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ int answer = ConfirmImageDeletion(Closure->imageName); { int answer = ConfirmImageDeletion(Closure->imageName);
@@ -956,7 +956,7 @@ void check_image_size(read_closure *rc, gint64 image_file_sectors)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
#endif #endif
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -976,13 +976,13 @@ static void load_crc_buf(read_closure *rc)
{ {
switch(rc->readMode) switch(rc->readMode)
{ case ECC_IN_FILE: { case ECC_IN_FILE:
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadSubtitle(_utf("Loading CRC data.")); SetAdaptiveReadSubtitle(_utf("Loading CRC data."));
#endif #endif
rc->crcBuf = GetCRCFromRS01_obsolete(rc->ei); rc->crcBuf = GetCRCFromRS01_obsolete(rc->ei);
break; break;
case ECC_IN_IMAGE: case ECC_IN_IMAGE:
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SetAdaptiveReadSubtitle(_utf("Loading CRC data.")); SetAdaptiveReadSubtitle(_utf("Loading CRC data."));
#endif #endif
rc->crcBuf = GetCRCFromRS02_obsolete(rc->lay, rc->dh, rc->image); 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" Check them for "dead sector markers"
and for checksum failures if ecc data is present. */ and for checksum failures if ecc data is present. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadSubtitle(_("Analysing existing image file")); SetAdaptiveReadSubtitle(_("Analysing existing image file"));
#endif #endif
@@ -1025,7 +1025,7 @@ static void build_interval_from_image(read_closure *rc)
/* Check for user interruption. */ /* Check for user interruption. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); { SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
@@ -1045,7 +1045,7 @@ static void build_interval_from_image(read_closure *rc)
if(current_missing) if(current_missing)
{ int fixme=0; { int fixme=0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->redSector); mark_sector(rc, s, Closure->redSector);
#endif #endif
ExplainMissingSector(rc->buf, s, current_missing, SOURCE_IMAGE, &fixme); 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. */ make it missing due to the CRC failure. */
if(!current_missing) if(!current_missing)
{ current_missing = 1; { current_missing = 1;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->yellowSector); mark_sector(rc, s, Closure->yellowSector);
#endif #endif
} }
@@ -1084,7 +1084,7 @@ static void build_interval_from_image(read_closure *rc)
if(rc->map) if(rc->map)
SetBit(rc->map, s); SetBit(rc->map, s);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s, Closure->greenSector); mark_sector(rc, s, Closure->greenSector);
#endif #endif
@@ -1121,7 +1121,7 @@ static void build_interval_from_image(read_closure *rc)
percent = (100*s)/(rc->highestWrittenSector+1); percent = (100*s)/(rc->highestWrittenSector+1);
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintProgress(_("Analysing existing image file: %2d%%"),percent); 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, /*** Now that all readable sectors are known,
determine those which can already be corrected. */ determine those which can already be corrected. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadSubtitle(_("Determining correctable sectors")); SetAdaptiveReadSubtitle(_("Determining correctable sectors"));
#endif #endif
@@ -1186,7 +1186,7 @@ static void build_interval_from_image(read_closure *rc)
#ifdef CHECK_VISITED #ifdef CHECK_VISITED
rc->count[layer_idx]++; rc->count[layer_idx]++;
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, layer_idx, Closure->greenSector); mark_sector(rc, layer_idx, Closure->greenSector);
#endif #endif
} }
@@ -1221,7 +1221,7 @@ static void build_interval_from_image(read_closure *rc)
&& !GetBit(rc->map, sector)) && !GetBit(rc->map, sector))
{ SetBit(rc->map, sector); { SetBit(rc->map, sector);
rc->correctable++; rc->correctable++;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, sector, Closure->greenSector); mark_sector(rc, sector, Closure->greenSector);
#endif #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"), else PrintLog(_("Analysing existing image file: %" PRId64 " readable, %" PRId64 " still missing.\n"),
rc->readable, rc->expectedSectors-rc->readable-rc->correctable); rc->readable, rc->expectedSectors-rc->readable-rc->correctable);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
UpdateAdaptiveResults(rc->readable, rc->correctable, UpdateAdaptiveResults(rc->readable, rc->correctable,
rc->expectedSectors-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) while(hpos < end)
{ if(!GetBit(rc->map, hpos)) { if(!GetBit(rc->map, hpos))
{ SetBit(rc->map, hpos); { SetBit(rc->map, hpos);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, hpos, Closure->greenSector); mark_sector(rc, hpos, Closure->greenSector);
#endif #endif
rc->correctable++; rc->correctable++;
} }
if(!GetBit(rc->map, hpos+1)) if(!GetBit(rc->map, hpos+1))
{ SetBit(rc->map, hpos+1); { SetBit(rc->map, hpos+1);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, hpos+1, Closure->greenSector); mark_sector(rc, hpos+1, Closure->greenSector);
#endif #endif
rc->correctable++; rc->correctable++;
@@ -1288,7 +1288,7 @@ static void mark_rs02_headers(read_closure *rc)
*** Main routine for adaptive reading *** Main routine for adaptive reading
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void insert_buttons(GtkDialog *dialog) static void insert_buttons(GtkDialog *dialog)
{ {
gtk_dialog_add_buttons(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 "]"), t = g_strdup_printf(_("Filling image area [%" PRId64 "..%" PRId64 "]"),
firstUnwritten, rc->intervalStart-1); firstUnwritten, rc->intervalStart-1);
clear_progress(rc); clear_progress(rc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetAdaptiveReadSubtitle(t); { SetAdaptiveReadSubtitle(t);
ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1); ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
@@ -1364,7 +1364,7 @@ void fill_gap(read_closure *rc)
/* Check whether user hit the Stop button */ /* Check whether user hit the Stop button */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ {
if(Closure->guiMode) if(Closure->guiMode)
@@ -1380,7 +1380,7 @@ void fill_gap(read_closure *rc)
if(j++ % 2000) if(j++ % 2000)
{ int seq = (j/2000)%10; { int seq = (j/2000)%10;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ g_printf("%s", anim[seq]); { g_printf("%s", anim[seq]);
@@ -1390,7 +1390,7 @@ void fill_gap(read_closure *rc)
/* Show progress in the spiral */ /* Show progress in the spiral */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ int segment = i / rc->sectorsPerSegment; { int segment = i / rc->sectorsPerSegment;
@@ -1403,7 +1403,7 @@ void fill_gap(read_closure *rc)
PrintCLI(" \n"); PrintCLI(" \n");
rc->highestWrittenSector = rc->intervalStart-1; rc->highestWrittenSector = rc->intervalStart-1;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* remove temporary fill markers */ if(Closure->guiMode) /* remove temporary fill markers */
{ RemoveFillMarkers(); { RemoveFillMarkers();
SetAdaptiveReadSubtitle(rc->subtitle); SetAdaptiveReadSubtitle(rc->subtitle);
@@ -1463,7 +1463,7 @@ void ReadMediumAdaptive(gpointer data)
rc->earlyTermination = TRUE; rc->earlyTermination = TRUE;
RegisterCleanup(_("Reading aborted"), cleanup, rc); RegisterCleanup(_("Reading aborted"), cleanup, rc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), "<big>%s</big>\n<i>%s</i>",
_("Preparing for reading the medium image."), _("Preparing for reading the medium image."),
@@ -1528,7 +1528,7 @@ void ReadMediumAdaptive(gpointer data)
/*** Initialize segment state counters (only in GUI mode) */ /*** Initialize segment state counters (only in GUI mode) */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ //rc->sectorsPerSegment = 1 + (rc->sectors / ADAPTIVE_READ_SPIRAL_SIZE); { //rc->sectorsPerSegment = 1 + (rc->sectors / ADAPTIVE_READ_SPIRAL_SIZE);
rc->sectorsPerSegment = ((rc->expectedSectors+ADAPTIVE_READ_SPIRAL_SIZE-1) / 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)); Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno));
PrintLog(_("Creating new %s image.\n"),Closure->imageName); PrintLog(_("Creating new %s image.\n"),Closure->imageName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline),
"<big>%s</big>\n<i>%s</i>", "<big>%s</big>\n<i>%s</i>",
@@ -1574,7 +1574,7 @@ reopen_image:
else else
{ int reopen; { int reopen;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline), SetLabelText(GTK_LABEL(Closure->readAdaptiveHeadline),
"<big>%s</big>\n<i>%s</i>", "<big>%s</big>\n<i>%s</i>",
@@ -1616,7 +1616,7 @@ reopen_image:
if(rc->readMode != IMAGE_ONLY) if(rc->readMode != IMAGE_ONLY)
{ PrintLog("%s", t); { PrintLog("%s", t);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->greenText); SetAdaptiveReadFootline(t, Closure->greenText);
#endif #endif
@@ -1637,7 +1637,7 @@ reopen_image:
/*** Read the medium image. */ /*** Read the medium image. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadSubtitle(rc->subtitle); SetAdaptiveReadSubtitle(rc->subtitle);
#endif #endif
@@ -1665,7 +1665,7 @@ reopen_image:
for(s=rc->intervalStart; s<=rc->intervalEnd; ) /* s is incremented elsewhere */ for(s=rc->intervalStart; s<=rc->intervalEnd; ) /* s is incremented elsewhere */
{ int nsectors,cnt; { int nsectors,cnt;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* somebody hit the Stop button */ if(Closure->stopActions) /* somebody hit the Stop button */
{ if(Closure->guiMode) { if(Closure->guiMode)
SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText); SetAdaptiveReadFootline(_("Aborted by user request!"), Closure->redText);
@@ -1723,7 +1723,7 @@ reread:
&& rc->dh->sense.sense_key && rc->dh->sense.sense_key
&& rc->dh->sense.sense_key != 3 && rc->dh->sense.sense_key != 5) && rc->dh->sense.sense_key != 3 && rc->dh->sense.sense_key != 5)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int answer; int answer;
if(!Closure->guiMode) if(!Closure->guiMode)
@@ -1732,7 +1732,7 @@ reread:
"Use the --ignore-fatal-sense option to override."), "Use the --ignore-fatal-sense option to override."),
s, GetLastSenseString(FALSE)); s, GetLastSenseString(FALSE));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n" _("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\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"), Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"),
b, "unv", strerror(errno)); b, "unv", strerror(errno));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, b, Closure->yellowSector); mark_sector(rc, b, Closure->yellowSector);
#endif #endif
@@ -1821,7 +1821,7 @@ reread:
SetBit(rc->map, b); SetBit(rc->map, b);
rc->readable++; rc->readable++;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, b, Closure->greenSector); mark_sector(rc, b, Closure->greenSector);
#endif #endif
@@ -1876,7 +1876,7 @@ reread:
&& !GetBit(rc->map, layer_idx)) && !GetBit(rc->map, layer_idx))
{ SetBit(rc->map, layer_idx); { SetBit(rc->map, layer_idx);
rc->correctable++; rc->correctable++;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, layer_idx, Closure->greenSector); mark_sector(rc, layer_idx, Closure->greenSector);
#endif #endif
@@ -1921,7 +1921,7 @@ reread:
&& !GetBit(rc->map, sector)) && !GetBit(rc->map, sector))
{ SetBit(rc->map, sector); { SetBit(rc->map, sector);
rc->correctable++; rc->correctable++;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, sector, Closure->greenSector); mark_sector(rc, sector, Closure->greenSector);
#endif #endif
fill_correctable_gap(rc, sector); fill_correctable_gap(rc, sector);
@@ -1948,7 +1948,7 @@ reread:
print_progress(rc, TRUE); print_progress(rc, TRUE);
if(rc->readMode != IMAGE_ONLY) if(rc->readMode != IMAGE_ONLY)
{ PrintLog("%s", t); { PrintLog("%s", t);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && rc->ei) if(Closure->guiMode && rc->ei)
SetAdaptiveReadFootline(t, Closure->foreground); SetAdaptiveReadFootline(t, Closure->foreground);
#endif #endif
@@ -1964,7 +1964,7 @@ reread:
PrintCLI("\n"); PrintCLI("\n");
if(nsectors>1) PrintCLIorLabel( if(nsectors>1) PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -1972,7 +1972,7 @@ NULL,
_("Sectors %" PRId64 "-%" PRId64 ": %s\n"), _("Sectors %" PRId64 "-%" PRId64 ": %s\n"),
s, s+nsectors-1, GetLastSenseString(FALSE)); s, s+nsectors-1, GetLastSenseString(FALSE));
else PrintCLIorLabel( else PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -1996,7 +1996,7 @@ NULL,
Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"), Stop(_("Failed writing to sector %" PRId64 " in image [%s]: %s"),
s, "nds", strerror(errno)); s, "nds", strerror(errno));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
mark_sector(rc, s+i, Closure->redSector); mark_sector(rc, s+i, Closure->redSector);
#endif #endif
} }
@@ -2093,7 +2093,7 @@ finished:
/* Force output of final results */ /* Force output of final results */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1); { ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
mark_sector(rc, 0, NULL); mark_sector(rc, 0, NULL);
@@ -2114,7 +2114,7 @@ finished:
PrintLog(_("\n%s\n" PrintLog(_("\n%s\n"
"(%" PRId64 " readable, %" PRId64 " correctable, %" PRId64 " still missing).\n"), "(%" PRId64 " readable, %" PRId64 " correctable, %" PRId64 " still missing).\n"),
t, rc->readable, rc->correctable, rc->expectedSectors-total); t, rc->readable, rc->correctable, rc->expectedSectors-total);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground); SetAdaptiveReadFootline(t, Closure->foreground);
#endif #endif
@@ -2129,7 +2129,7 @@ finished:
{ if(rc->readable == rc->expectedSectors) { if(rc->readable == rc->expectedSectors)
{ char *t = _("\nGood! All sectors have been read.\n"); { char *t = _("\nGood! All sectors have been read.\n");
PrintLog("%s", t); PrintLog("%s", t);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground); SetAdaptiveReadFootline(t, Closure->foreground);
#endif #endif
@@ -2145,7 +2145,7 @@ finished:
"%2d.%1d%% of the image have been read (%" PRId64 " sectors).\n"), "%2d.%1d%% of the image have been read (%" PRId64 " sectors).\n"),
t, percent/10, percent%10, rc->readable); t, percent/10, percent%10, rc->readable);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground); SetAdaptiveReadFootline(t, Closure->foreground);
#endif #endif
@@ -2166,7 +2166,7 @@ finished:
rc->earlyTermination = FALSE; rc->earlyTermination = FALSE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
terminate: terminate:
#endif #endif
cleanup((gpointer)rc); cleanup((gpointer)rc);

View File

@@ -57,7 +57,7 @@ static void send_eof(read_closure *rc)
static void cleanup(gpointer data) static void cleanup(gpointer data)
{ read_closure *rc = (read_closure*)data; { read_closure *rc = (read_closure*)data;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int full_read = FALSE; int full_read = FALSE;
int aborted = rc->earlyTermination; int aborted = rc->earlyTermination;
int scan_mode = rc->scanMode; int scan_mode = rc->scanMode;
@@ -73,7 +73,7 @@ static void cleanup(gpointer data)
in that case. */ in that case. */
while(renderers_left while(renderers_left
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
&& Closure->stopActions != STOP_SHUTDOWN_ALL && Closure->stopActions != STOP_SHUTDOWN_ALL
#endif #endif
) )
@@ -112,14 +112,14 @@ static void cleanup(gpointer data)
/* Clean up reader thread */ /* Clean up reader thread */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(rc->image) if(rc->image)
full_read = (rc->readOK == rc->image->dh->sectors && !Closure->crcErrors); full_read = (rc->readOK == rc->image->dh->sectors && !Closure->crcErrors);
#endif #endif
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(rc->unreportedError) { if(rc->unreportedError)
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
@@ -173,7 +173,7 @@ static void cleanup(gpointer data)
/* Continue with ecc file creation after read. /* Continue with ecc file creation after read.
NOTE: Images are NOT automatically augmented after a 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(Closure->readAndCreate && Closure->guiMode && !scan_mode && !aborted) /* General prerequisites */
{ if( !strncmp(Closure->methodName, "RS01", 4) /* codec prerequisites */ { if( !strncmp(Closure->methodName, "RS01", 4) /* codec prerequisites */
|| (!strncmp(Closure->methodName, "RS03", 4) && Closure->eccTarget == ECC_FILE) ) || (!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 */ if(rc->scanMode) /* Output messages differ in read and scan mode */
{ RegisterCleanup(_("Scanning aborted"), cleanup, rc); { RegisterCleanup(_("Scanning aborted"), cleanup, rc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", "<big>%s</big>\n<i>%s</i>",
@@ -221,7 +221,7 @@ static void register_reader(read_closure *rc)
} }
else else
{ RegisterCleanup(_("Reading aborted"), cleanup, rc); { RegisterCleanup(_("Reading aborted"), cleanup, rc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", "<big>%s</big>\n<i>%s</i>",
@@ -252,7 +252,7 @@ static void determine_mode(read_closure *rc)
rc->msg = g_strdup(_("Scanning medium for read errors.")); rc->msg = g_strdup(_("Scanning medium for read errors."));
PrintLog("%s\n", rc->msg); PrintLog("%s\n", rc->msg);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(rc->eccMethod) { if(rc->eccMethod)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
@@ -267,7 +267,7 @@ static void determine_mode(read_closure *rc)
rc->readMarker = 0; rc->readMarker = 0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan); InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
#endif #endif
@@ -277,7 +277,7 @@ static void determine_mode(read_closure *rc)
/*** If no image file exists, open a new one. */ /*** If no image file exists, open a new one. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
reopen_image: reopen_image:
#endif #endif
if(!LargeStat(Closure->imageName, &image_size)) if(!LargeStat(Closure->imageName, &image_size))
@@ -291,7 +291,7 @@ reopen_image:
Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno)); Stop(_("Can't open %s:\n%s"),Closure->imageName,strerror(errno));
PrintLog(_("Creating new %s image.\n"),Closure->imageName); PrintLog(_("Creating new %s image.\n"),Closure->imageName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(rc->eccMethod) { if(rc->eccMethod)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
@@ -305,7 +305,7 @@ reopen_image:
rc->rereading = FALSE; rc->rereading = FALSE;
rc->readMarker = 0; rc->readMarker = 0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan); InitializeCurve(rc, rc->image->dh->maxRate, rc->image->dh->canC2Scan);
#endif #endif
@@ -354,11 +354,11 @@ reopen_image:
if(!unknown_fingerprint && memcmp(image_fp, medium_fp, 16)) if(!unknown_fingerprint && memcmp(image_fp, medium_fp, 16))
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
Stop(_("Image file does not match the optical disc.")); Stop(_("Image file does not match the optical disc."));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ int answer = ConfirmImageDeletion(Closure->imageName); { int answer = ConfirmImageDeletion(Closure->imageName);
@@ -388,18 +388,18 @@ reopen_image:
{ PrintLog(_("Completing image %s. Continuing with sector %" PRId64 ".\n"), { PrintLog(_("Completing image %s. Continuing with sector %" PRId64 ".\n"),
Closure->imageName, rc->readMarker); Closure->imageName, rc->readMarker);
rc->firstSector = rc->readMarker; rc->firstSector = rc->readMarker;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->additionalSpiralColor = 0; /* blue */ Closure->additionalSpiralColor = 0; /* blue */
#endif #endif
} }
else else
{ PrintLog(_("Completing image %s. Only missing sectors will be read.\n"), Closure->imageName); { 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*/ Closure->additionalSpiralColor = 3; /* dark green*/
#endif #endif
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>",rc->msg,rc->image->dh->mediumDescr); "<big>%s</big>\n<i>%s</i>",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 // FIXME: reuse CrcBuf and write respective message
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", "<big>%s</big>\n<i>%s</i>",
@@ -474,7 +474,7 @@ static void prepare_crc_cache(read_closure *rc)
if(rc->eccMethod->getCrcBuf) if(rc->eccMethod->getCrcBuf)
{ Closure->crcBuf = rc->eccMethod->getCrcBuf(rc->image); { Closure->crcBuf = rc->eccMethod->getCrcBuf(rc->image);
Closure->crcBuf->crcCached = TRUE; Closure->crcBuf->crcCached = TRUE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
RedrawReadLinearWindow(); RedrawReadLinearWindow();
#endif #endif
@@ -493,7 +493,7 @@ static void prepare_crc_cache(read_closure *rc)
rc->eccMethod->resetCksums(rc->image); rc->eccMethod->resetCksums(rc->image);
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
"<big>%s</big>\n<i>%s</i>", rc->msg, rc->image->dh->mediumDescr); "<big>%s</big>\n<i>%s</i>", 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) static void prepare_timer(read_closure *rc)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && Closure->spinupDelay) if(Closure->guiMode && Closure->spinupDelay)
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("Waiting %d seconds for drive to spin up...\n"), Closure->spinupDelay); _("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); SpinupDevice(rc->image->dh);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && Closure->spinupDelay) if(Closure->guiMode && Closure->spinupDelay)
SwitchAndSetFootline(Closure->readLinearNotebook, 0, Closure->readLinearFootline, "ignore"); SwitchAndSetFootline(Closure->readLinearNotebook, 0, Closure->readLinearFootline, "ignore");
#endif #endif
@@ -542,7 +542,7 @@ static void prepare_timer(read_closure *rc)
static void show_progress(read_closure *rc) static void show_progress(read_closure *rc)
{ int percent; { int percent;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && rc->lastErrorsPrinted != Closure->readErrors) if(Closure->guiMode && rc->lastErrorsPrinted != Closure->readErrors)
{ SetLabelText(GTK_LABEL(Closure->readLinearErrors), { SetLabelText(GTK_LABEL(Closure->readLinearErrors),
_("Unreadable / skipped sectors: %" PRId64 ""), Closure->readErrors); _("Unreadable / skipped sectors: %" PRId64 ""), Closure->readErrors);
@@ -555,7 +555,7 @@ static void show_progress(read_closure *rc)
if(rc->lastPercent != percent) if(rc->lastPercent != percent)
{ gulong ignore; { gulong ignore;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int color; int color;
if(Closure->guiMode) if(Closure->guiMode)
@@ -564,7 +564,7 @@ static void show_progress(read_closure *rc)
if(rc->readOK <= rc->lastReadOK) /* nothing read since last sample? */ if(rc->readOK <= rc->lastReadOK) /* nothing read since last sample? */
{ rc->speed = 0.0; { rc->speed = 0.0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->readErrors - rc->previousReadErrors > 0) if(Closure->readErrors - rc->previousReadErrors > 0)
color = 2; color = 2;
else if(Closure->crcErrors - rc->previousCRCErrors > 0) 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 elapsed = g_timer_elapsed(rc->speedTimer, &ignore);
double kb_sec = kb_read / elapsed; double kb_sec = kb_read / elapsed;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->readErrors - rc->previousReadErrors > 0) if(Closure->readErrors - rc->previousReadErrors > 0)
color = 2; color = 2;
else if(Closure->crcErrors - rc->previousCRCErrors > 0) else if(Closure->crcErrors - rc->previousCRCErrors > 0)
@@ -596,7 +596,7 @@ static void show_progress(read_closure *rc)
if(rc->firstSpeedValue) if(rc->firstSpeedValue)
{ rc->speed = kb_sec / rc->image->dh->singleRate; { rc->speed = kb_sec / rc->image->dh->singleRate;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ AddCurveValues(rc, rc->lastPercent, color, rc->maxC2); { AddCurveValues(rc, rc->lastPercent, color, rc->maxC2);
AddCurveValues(rc, percent, color, rc->maxC2); AddCurveValues(rc, percent, color, rc->maxC2);
@@ -624,7 +624,7 @@ static void show_progress(read_closure *rc)
cut_peaks=3; cut_peaks=3;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
AddCurveValues(rc, percent, color, rc->maxC2); AddCurveValues(rc, percent, color, rc->maxC2);
#endif #endif
@@ -777,7 +777,7 @@ update_mutex:
*** The reader part *** The reader part
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void insert_buttons(GtkDialog *dialog) static void insert_buttons(GtkDialog *dialog)
{ {
gtk_dialog_add_buttons(dialog, gtk_dialog_add_buttons(dialog,
@@ -888,7 +888,7 @@ void ReadMediumLinear(gpointer data)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
_("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."), _("<span %s>Aborted by user request!</span> %" PRId64 " sectors read, %" PRId64 " sectors unreadable/skipped so far."),
Closure->redMarkup, rc->readOK,Closure->readErrors); Closure->redMarkup, rc->readOK,Closure->readErrors);
@@ -901,7 +901,7 @@ void ReadMediumLinear(gpointer data)
/*** See if user wants to limit the read range. */ /*** See if user wants to limit the read range. */
GetReadingRange(rc->image->dh->sectors, &rc->firstSector, &rc->lastSector); GetReadingRange(rc->image->dh->sectors, &rc->firstSector, &rc->lastSector);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(rc->firstSector > 0) /* Mark skipped sectors */ if(rc->firstSector > 0) /* Mark skipped sectors */
Closure->additionalSpiralColor = 0; /* blue */ Closure->additionalSpiralColor = 0; /* blue */
#endif #endif
@@ -969,7 +969,7 @@ next_reading_pass:
break; break;
} }
Closure->sectorSkip = 0; Closure->sectorSkip = 0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
MarkExistingSectors(); MarkExistingSectors();
#endif #endif
@@ -989,7 +989,7 @@ next_reading_pass:
while(rc->readPos<=rc->lastSector) while(rc->readPos<=rc->lastSector)
{ int cluster_mask = rc->image->dh->clusterSize-1; { 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) /* somebody hit the Stop button */
{ {
if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
@@ -1102,7 +1102,7 @@ reread:
if(status && !Closure->ignoreFatalSense if(status && !Closure->ignoreFatalSense
&& rc->image->dh->sense.sense_key && rc->image->dh->sense.sense_key != 3 && rc->image->dh->sense.sense_key != 5) && 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; int answer;
if(!Closure->guiMode) if(!Closure->guiMode)
@@ -1111,7 +1111,7 @@ reread:
"Use the --ignore-fatal-sense option to override."), "Use the --ignore-fatal-sense option to override."),
rc->readPos, GetLastSenseString(FALSE)); rc->readPos, GetLastSenseString(FALSE));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Sector %" PRId64 ": %s\n\n" _("Sector %" PRId64 ": %s\n\n"
"It may not be possible to recover from this error.\n" "It may not be possible to recover from this error.\n"
@@ -1272,7 +1272,7 @@ reread:
{ int i; { int i;
PrintCLIorLabel( PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -1305,7 +1305,7 @@ NULL,
} }
else else
{ PrintCLIorLabel( { PrintCLIorLabel(
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Closure->status, Closure->status,
#else #else
NULL, NULL,
@@ -1332,7 +1332,7 @@ step_counter:
to checksum means we have ecc data - we can fix the image using ecc to checksum means we have ecc data - we can fix the image using ecc
rather than by re-reading it. */ rather than by re-reading it. */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
ChangeSpiralCursor(Closure->readLinearSpiral, -1); /* switch cursor off */ ChangeSpiralCursor(Closure->readLinearSpiral, -1); /* switch cursor off */
#endif #endif
@@ -1345,7 +1345,7 @@ step_counter:
&& rc->pass < Closure->readingPasses) && rc->pass < Closure->readingPasses)
{ int renderers_left = TRUE; { int renderers_left = TRUE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(Closure->readLinearHeadline), SetLabelText(GTK_LABEL(Closure->readLinearHeadline),
_("<big>Trying to complete image, reading pass %d of %d.</big>\n%s"), _("<big>Trying to complete image, reading pass %d of %d.</big>\n%s"),
@@ -1435,7 +1435,7 @@ step_counter:
} }
PrintLog("\n%s\n",t); PrintLog("\n%s\n",t);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(rc->scanMode) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline, { if(rc->scanMode) SwitchAndSetFootline(Closure->readLinearNotebook, 1, Closure->readLinearFootline,
"%s%s",_("Scanning finished: "),t); "%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) if(rc->image->dh->mainType == CD && tao_tail && tao_tail == Closure->readErrors && !Closure->noTruncate)
{ int answer; { int answer;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("%d sectors missing at the end of the disc.\n" _("%d sectors missing at the end of the disc.\n"

View File

@@ -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) void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, int mode)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = NULL; RS01Widgets *wl = NULL;
#endif #endif
unsigned char buf[2048]; unsigned char buf[2048];
@@ -216,7 +216,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
int crcidx = 0; int crcidx = 0;
struct MD5Context image_md5; struct MD5Context image_md5;
gint64 s, first_missing, last_missing; gint64 s, first_missing, last_missing;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
gint64 prev_missing = 0; gint64 prev_missing = 0;
gint64 prev_crc_errors = 0; gint64 prev_crc_errors = 0;
#endif #endif
@@ -225,7 +225,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
/* Extract widget list from method */ /* Extract widget list from method */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(method->widgetList) if(method->widgetList)
wl = (RS01Widgets*)method->widgetList; wl = (RS01Widgets*)method->widgetList;
#endif #endif
@@ -263,7 +263,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
/* Check for user interruption */ /* Check for user interruption */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ image->sectorsMissing += image->sectorSize - s; { image->sectorsMissing += image->sectorSize - s;
if(crcbuf) g_free(crcbuf); 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 */ MD5Update(&image_md5, buf, n); /* update image md5sum */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && mode & PRINT_MODE) if(Closure->guiMode && mode & PRINT_MODE)
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/image->sectorSize; percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/image->sectorSize;
else else
@@ -370,7 +370,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
if(last_percent != percent) if(last_percent != percent)
{ PrintProgress(msg,percent); { PrintProgress(msg,percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && mode & CREATE_CRC) if(Closure->guiMode && mode & CREATE_CRC)
SetProgress(wl->encPBar1, percent, 100); SetProgress(wl->encPBar1, percent, 100);

View File

@@ -97,7 +97,7 @@ static int calculate_redundancy(char *image_name)
*** Remove the image file *** Remove the image file
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
static void unlink_image(GtkWidget *label) static void unlink_image(GtkWidget *label)
#else #else
static void unlink_image(void *label) static void unlink_image(void *label)
@@ -106,7 +106,7 @@ static void unlink_image(void *label)
if(LargeUnlink(Closure->imageName)) if(LargeUnlink(Closure->imageName))
{ PrintLog(_("\nImage file %s deleted.\n"),Closure->imageName); { PrintLog(_("\nImage file %s deleted.\n"),Closure->imageName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(label), SetLabelText(GTK_LABEL(label),
_("\nImage file %s deleted.\n"), Closure->imageName); _("\nImage file %s deleted.\n"), Closure->imageName);
@@ -114,7 +114,7 @@ static void unlink_image(void *label)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintLog("\n"); PrintLog("\n");
@@ -135,7 +135,7 @@ static void unlink_image(void *label)
typedef struct typedef struct
{ Method *self; { Method *self;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl; RS01Widgets *wl;
#endif #endif
GaloisTables *gt; GaloisTables *gt;
@@ -153,7 +153,7 @@ static void ecc_cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ec->earlyTermination) { if(ec->earlyTermination)
SetLabelText(GTK_LABEL(ec->wl->encFootline), SetLabelText(GTK_LABEL(ec->wl->encFootline),
@@ -176,14 +176,14 @@ static void ecc_cleanup(gpointer data)
if(Closure->enableCurveSwitch) if(Closure->enableCurveSwitch)
{ Closure->enableCurveSwitch = FALSE; { Closure->enableCurveSwitch = FALSE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01ShowCurveButton(ec->self); RS01ShowCurveButton(ec->self);
#endif #endif
} }
g_free(ec); g_free(ec);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -197,7 +197,7 @@ enum { NORMAL, HIGH, GENERIC };
void RS01Create(void) void RS01Create(void)
{ Method *self = FindMethod("RS01"); { Method *self = FindMethod("RS01");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = (RS01Widgets*)self->widgetList; RS01Widgets *wl = (RS01Widgets*)self->widgetList;
#endif #endif
GaloisTables *gt; GaloisTables *gt;
@@ -224,7 +224,7 @@ void RS01Create(void)
/*** Register the cleanup procedure for GUI mode */ /*** Register the cleanup procedure for GUI mode */
ec->self = self; ec->self = self;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
ec->wl = wl; ec->wl = wl;
#endif #endif
ec->earlyTermination = TRUE; ec->earlyTermination = TRUE;
@@ -255,7 +255,7 @@ void RS01Create(void)
nroots, nroots,
((double)nroots*100.0)/(double)ndata); ((double)nroots*100.0)/(double)ndata);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encHeadline), SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Creating the error correction file.</big>\n<i>%s</i>"), ec->msg); _("<big>Creating the error correction file.</big>\n<i>%s</i>"), ec->msg);
@@ -269,7 +269,7 @@ void RS01Create(void)
{ {
if(ConfirmEccDeletion(Closure->eccName)) if(ConfirmEccDeletion(Closure->eccName))
LargeUnlink(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 else
{ SetLabelText(GTK_LABEL(ec->wl->encFootline), { SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted to keep existing ecc file.</span>"), _("<span %s>Aborted to keep existing ecc file.</span>"),
@@ -311,7 +311,7 @@ void RS01Create(void)
int percent, last_percent = 0; int percent, last_percent = 0;
char *msg = _("Writing sector checksums: %3d%%"); char *msg = _("Writing sector checksums: %3d%%");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encLabel1), SetLabelText(GTK_LABEL(wl->encLabel1),
_("<b>1. Writing image sector checksums:</b>")); _("<b>1. Writing image sector checksums:</b>"));
@@ -346,7 +346,7 @@ void RS01Create(void)
if(last_percent != percent) if(last_percent != percent)
{ PrintProgress(msg,percent); { PrintProgress(msg,percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(wl->encPBar1, percent, 100); SetProgress(wl->encPBar1, percent, 100);
#endif #endif
@@ -363,7 +363,7 @@ void RS01Create(void)
Checksums are only computed locally and not provided in the cache. */ Checksums are only computed locally and not provided in the cache. */
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->encLabel1), SetLabelText(GTK_LABEL(wl->encLabel1),
_("<b>1. Calculating image sector checksums:</b>")); _("<b>1. Calculating image sector checksums:</b>"));
@@ -380,7 +380,7 @@ void RS01Create(void)
LargeUnlink(Closure->eccName); /* Do not leave a CRC-only .ecc file behind */ 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)
{ {
if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
@@ -393,7 +393,7 @@ void RS01Create(void)
else else
#endif #endif
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(wl->encPBar1, 100, 100); SetProgress(wl->encPBar1, 100, 100);
#endif #endif
@@ -405,7 +405,7 @@ void RS01Create(void)
PrintTimeToLog(ec->timer, "for CRC writing/generation.\n"); PrintTimeToLog(ec->timer, "for CRC writing/generation.\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetProgress(wl->encPBar1, 100, 100); { SetProgress(wl->encPBar1, 100, 100);
ShowWidget(wl->encPBar2); ShowWidget(wl->encPBar2);
@@ -531,7 +531,7 @@ void RS01Create(void)
{ int offset = 0; { int offset = 0;
unsigned char *par_idx = ec->parity; unsigned char *par_idx = ec->parity;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
@@ -611,7 +611,7 @@ void RS01Create(void)
percent = (1000*progress)/max_percent; percent = (1000*progress)/max_percent;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000); SetProgress(wl->encPBar2, percent, 1000);
else else
@@ -629,7 +629,7 @@ void RS01Create(void)
{ int offset = 0; { int offset = 0;
unsigned char *par_idx = ec->parity; unsigned char *par_idx = ec->parity;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
@@ -741,7 +741,7 @@ void RS01Create(void)
percent = (1000*progress)/max_percent; percent = (1000*progress)/max_percent;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000); SetProgress(wl->encPBar2, percent, 1000);
else else
@@ -762,7 +762,7 @@ void RS01Create(void)
{ int offset = 0; { int offset = 0;
unsigned char *par_idx = ec->parity; unsigned char *par_idx = ec->parity;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
@@ -1041,7 +1041,7 @@ void RS01Create(void)
percent = (1000*progress)/max_percent; percent = (1000*progress)/max_percent;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(wl->encPBar2, percent, 1000); SetProgress(wl->encPBar2, percent, 1000);
else else
@@ -1087,7 +1087,7 @@ void RS01Create(void)
"Make sure to keep this file on a reliable medium.\n"), "Make sure to keep this file on a reliable medium.\n"),
Closure->eccName); Closure->eccName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100); { SetProgress(wl->encPBar2, 100, 100);
@@ -1103,7 +1103,7 @@ void RS01Create(void)
if(Closure->unlinkImage) if(Closure->unlinkImage)
{ if(ec->image) CloseImage(ec->image); { if(ec->image) CloseImage(ec->image);
ec->image = NULL; ec->image = NULL;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
unlink_image(Closure->guiMode ? wl->encFootline2 : NULL); unlink_image(Closure->guiMode ? wl->encFootline2 : NULL);
#else #else
unlink_image(NULL); unlink_image(NULL);
@@ -1114,7 +1114,7 @@ void RS01Create(void)
ec->earlyTermination = FALSE; ec->earlyTermination = FALSE;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
terminate: terminate:
#endif #endif
ecc_cleanup((gpointer)ec); ecc_cleanup((gpointer)ec);

View File

@@ -55,7 +55,7 @@ static void read_crc(LargeFile *ecc, guint32 *buf, int first_sector, int n_secto
typedef struct typedef struct
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl; RS01Widgets *wl;
#endif #endif
GaloisTables *gt; GaloisTables *gt;
@@ -73,7 +73,7 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(fc->earlyTermination) { if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -101,7 +101,7 @@ static void fix_cleanup(gpointer data)
g_free(fc); g_free(fc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -113,7 +113,7 @@ static void fix_cleanup(gpointer data)
void RS01Fix(Image *image) void RS01Fix(Image *image)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Method *method = FindMethod("RS01"); Method *method = FindMethod("RS01");
RS01Widgets *wl = (RS01Widgets*)method->widgetList; RS01Widgets *wl = (RS01Widgets*)method->widgetList;
#endif #endif
@@ -141,7 +141,7 @@ void RS01Fix(Image *image)
/*** Register the cleanup procedure for GUI mode */ /*** Register the cleanup procedure for GUI mode */
fc->image = image; fc->image = image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
fc->wl = wl; fc->wl = wl;
#endif #endif
fc->earlyTermination = TRUE; fc->earlyTermination = TRUE;
@@ -155,7 +155,7 @@ void RS01Fix(Image *image)
eh->eccBytes, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes); ((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->fixHeadline), { SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"),fc->msg); _("<big>Repairing the image.</big>\n<i>%s</i>"),fc->msg);
@@ -213,7 +213,7 @@ void RS01Fix(Image *image)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline, fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"), _("<span %s>Aborted by user request!</span>"),
@@ -230,7 +230,7 @@ void RS01Fix(Image *image)
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(diff>2 && Closure->guiMode) if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans, trans,
@@ -257,7 +257,7 @@ void RS01Fix(Image *image)
#endif #endif
if(diff>2 && if(diff>2 &&
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
!Closure->guiMode) !Closure->guiMode)
#else #else
1) 1)
@@ -281,7 +281,7 @@ void RS01Fix(Image *image)
if(image->sectorSize == image->expectedSectors && image->inLast > eh->inLast) if(image->sectorSize == image->expectedSectors && image->inLast > eh->inLast)
{ int difference = image->inLast - eh->inLast; { int difference = image->inLast - eh->inLast;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n" _("The image file is %d bytes longer than noted\n"
@@ -300,7 +300,7 @@ void RS01Fix(Image *image)
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && !Closure->truncate) if(!Closure->guiMode && !Closure->truncate)
#else #else
if(!Closure->truncate) if(!Closure->truncate)
@@ -326,7 +326,7 @@ void RS01Fix(Image *image)
"Consider completing it with another reading pass before going on.\n")); "Consider completing it with another reading pass before going on.\n"));
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline, fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"), _("<span %s>Aborted by user request!</span>"),
@@ -346,7 +346,7 @@ void RS01Fix(Image *image)
eh->fpSector); eh->fpSector);
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline, fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"), _("<span %s>Aborted by user request!</span>"),
@@ -399,7 +399,7 @@ void RS01Fix(Image *image)
for(si=0; si<s; si++) for(si=0; si<s; si++)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -473,7 +473,7 @@ void RS01Fix(Image *image)
if(erasure_count>nroots) /* uncorrectable */ if(erasure_count>nroots) /* uncorrectable */
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ PrintCLI(_("* %3d unrepairable sectors: "), erasure_count); { PrintCLI(_("* %3d unrepairable sectors: "), erasure_count);
@@ -785,7 +785,7 @@ skip:
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ {
RS01AddFixValues(wl, percent, local_plot_max); RS01AddFixValues(wl, percent, local_plot_max);
@@ -811,7 +811,7 @@ skip:
if(corrected > 0) PrintLog(_("Repaired sectors: %" PRId64 " \n"),corrected); if(corrected > 0) PrintLog(_("Repaired sectors: %" PRId64 " \n"),corrected);
if(uncorrected > 0) if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored " _("Image sectors could not be fully restored "
@@ -833,7 +833,7 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sec/(double)damaged_ecc,worst_ecc); (double)damaged_sec/(double)damaged_ecc,worst_ecc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t) if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t); "%s %s", _("Repair results:"), t);

View File

@@ -23,7 +23,7 @@
#ifndef RS01INCLUDES_H #ifndef RS01INCLUDES_H
#define RS01INCLUDES_H #define RS01INCLUDES_H
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* Data structs from rs01-window.c */ /* Data structs from rs01-window.c */
typedef struct typedef struct
@@ -107,7 +107,7 @@ typedef struct
{ struct MD5Context md5ctxt; /* Complete image checksum */ { struct MD5Context md5ctxt; /* Complete image checksum */
} RS01CksumClosure; } RS01CksumClosure;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* /*
* These are exported via the Method struct * These are exported via the Method struct
*/ */
@@ -159,7 +159,7 @@ void RS01Create(void);
void RS01Fix(Image*); void RS01Fix(Image*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* rs01-window.c */ /* rs01-window.c */
void RS01AddFixValues(RS01Widgets*, int, int); void RS01AddFixValues(RS01Widgets*, int, int);

View File

@@ -24,7 +24,7 @@
#include "rs01-includes.h" #include "rs01-includes.h"
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/*** /***
*** Reset the verify output window *** Reset the verify output window
@@ -356,7 +356,7 @@ static void cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
AllowActions(TRUE); AllowActions(TRUE);
#endif #endif
@@ -364,7 +364,7 @@ static void cleanup(gpointer data)
if(vc->image) CloseImage(vc->image); if(vc->image) CloseImage(vc->image);
g_free(vc); g_free(vc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -373,12 +373,12 @@ static void cleanup(gpointer data)
void RS01Verify(Image *image) void RS01Verify(Image *image)
{ verify_closure *vc = g_malloc0(sizeof(verify_closure)); { verify_closure *vc = g_malloc0(sizeof(verify_closure));
Method *self = FindMethod("RS01"); Method *self = FindMethod("RS01");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS01Widgets *wl = (RS01Widgets*)self->widgetList; RS01Widgets *wl = (RS01Widgets*)self->widgetList;
#endif #endif
char idigest[33],edigest[33]; char idigest[33],edigest[33];
gint64 excess_sectors = 0; gint64 excess_sectors = 0;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
char *ecc_advice = NULL; char *ecc_advice = NULL;
#endif #endif
@@ -399,7 +399,7 @@ void RS01Verify(Image *image)
/*** Examine the .iso file */ /*** Examine the .iso file */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."), _("Comparing image and error correction files."),
@@ -407,7 +407,7 @@ void RS01Verify(Image *image)
#endif #endif
vc->image = image; vc->image = image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(image && image->eccFile) if(image && image->eccFile)
{ if(Closure->guiMode) { if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "0"); SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), "0");
@@ -423,7 +423,7 @@ void RS01Verify(Image *image)
if(!image || !image->file) if(!image || !image->file)
{ PrintLog(_("not present\n")); { PrintLog(_("not present\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL); SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
#endif #endif
@@ -432,7 +432,7 @@ void RS01Verify(Image *image)
if(image->inLast == 2048) if(image->inLast == 2048)
{ PrintLog(_("present, contains %" PRId64 " medium sectors.\n"), image->sectorSize); { PrintLog(_("present, contains %" PRId64 " medium sectors.\n"), image->sectorSize);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize); SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", image->sectorSize);
#endif #endif
@@ -440,7 +440,7 @@ void RS01Verify(Image *image)
else else
{ PrintLog(_("present, contains %" PRId64 " medium sectors and %d bytes.\n"), { PrintLog(_("present, contains %" PRId64 " medium sectors and %d bytes.\n"),
image->sectorSize-1, image->inLast); image->sectorSize-1, image->inLast);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " sectors + %d bytes"), SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " sectors + %d bytes"),
image->sectorSize-1, image->inLast); image->sectorSize-1, image->inLast);
@@ -450,7 +450,7 @@ void RS01Verify(Image *image)
if(!Closure->quickVerify) if(!Closure->quickVerify)
RS01ScanImage(self, image, NULL, PRINT_MODE); RS01ScanImage(self, image, NULL, PRINT_MODE);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult), SetLabelText(GTK_LABEL(wl->cmpImageResult),
@@ -469,7 +469,7 @@ void RS01Verify(Image *image)
{ diff = image->expectedSectors - image->sectorSize; { diff = image->expectedSectors - image->sectorSize;
PrintLog(_("* truncated image : %" PRId64 " sectors too short\n"), diff); PrintLog(_("* truncated image : %" PRId64 " sectors too short\n"), diff);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"), _("<span %s>%" PRId64 " (%" PRId64 " sectors too short)</span>"),
@@ -484,7 +484,7 @@ void RS01Verify(Image *image)
/*** Show summary of image read */ /*** Show summary of image read */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(image->crcErrors) { if(image->crcErrors)
SetLabelText(GTK_LABEL(wl->cmpChkSumErrors), SetLabelText(GTK_LABEL(wl->cmpChkSumErrors),
@@ -497,7 +497,7 @@ void RS01Verify(Image *image)
if(excess_sectors) if(excess_sectors)
{ PrintLog(_("* image too long : %" PRId64 " excess sectors\n"), excess_sectors); { PrintLog(_("* image too long : %" PRId64 " excess sectors\n"), excess_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors), { SetLabelText(GTK_LABEL(wl->cmpImageSectors),
_("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"), _("<span %s>%" PRId64 " (%" PRId64 " excess sectors)</span>"),
@@ -519,7 +519,7 @@ void RS01Verify(Image *image)
if(!image->crcErrors) if(!image->crcErrors)
{ PrintLog(_("- good image : all sectors present\n" { PrintLog(_("- good image : all sectors present\n"
"- image md5sum : %s\n"),idigest); "- image md5sum : %s\n"),idigest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult),_("<span %s>Good image.</span>"), Closure->greenMarkup); { SetLabelText(GTK_LABEL(wl->cmpImageResult),_("<span %s>Good image.</span>"), Closure->greenMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest); 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" { PrintLog(_("* suspicious image : all sectors present, but %" PRId64 " CRC errors\n"
"- image md5sum : %s\n"),image->crcErrors,idigest); "- image md5sum : %s\n"),image->crcErrors,idigest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup); { SetLabelText(GTK_LABEL(wl->cmpImageResult), _("<span %s>Image complete, but contains checksum errors!</span>"), Closure->redMarkup);
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest); SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", idigest);
@@ -543,7 +543,7 @@ void RS01Verify(Image *image)
PrintLog(_("* BAD image : %" PRId64 " sectors missing\n"), image->sectorsMissing); PrintLog(_("* BAD image : %" PRId64 " sectors missing\n"), image->sectorsMissing);
else PrintLog(_("* BAD image : %" PRId64 " sectors missing, %" PRId64 " CRC errors\n"), else PrintLog(_("* BAD image : %" PRId64 " sectors missing, %" PRId64 " CRC errors\n"),
image->sectorsMissing, image->crcErrors); image->sectorsMissing, image->crcErrors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageResult), SetLabelText(GTK_LABEL(wl->cmpImageResult),
_("<span %s>Bad image.</span>"), Closure->redMarkup); _("<span %s>Bad image.</span>"), Closure->redMarkup);
@@ -554,7 +554,7 @@ void RS01Verify(Image *image)
/*** The .ecc file */ /*** The .ecc file */
process_ecc: process_ecc:
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Comparing image and error correction files."), _("Comparing image and error correction files."),
@@ -565,7 +565,7 @@ process_ecc:
if(!image) if(!image)
{ PrintLog(_("not present\n")); { PrintLog(_("not present\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0, SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present.")); wl->cmpEccEmptyMsg,_("No error correction file present."));
@@ -595,7 +595,7 @@ process_ecc:
PrintLog(_("unusable\n")); PrintLog(_("unusable\n"));
break; break;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 0, SwitchAndSetFootline(wl->cmpEccNotebook, 0,
wl->cmpEccEmptyMsg,_("No error correction file present.")); wl->cmpEccEmptyMsg,_("No error correction file present."));
@@ -625,7 +625,7 @@ process_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable); PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SwitchAndSetFootline(wl->cmpEccNotebook, 1, { SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, wl->cmpEccCreatedBy,
@@ -639,7 +639,7 @@ process_ecc:
PrintLog(format, _("created by dvdisaster"), PrintLog(format, _("created by dvdisaster"),
major, minor, unstable); major, minor, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1, SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, format, "dvdisaster", wl->cmpEccCreatedBy, format, "dvdisaster",
@@ -649,7 +649,7 @@ process_ecc:
} }
else else
{ PrintLog(_("created by dvdisaster-0.41.x.\n")); { PrintLog(_("created by dvdisaster-0.41.x.\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1, SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, "dvdisaster-0.41.x"); wl->cmpEccCreatedBy, "dvdisaster-0.41.x");
@@ -663,7 +663,7 @@ process_ecc:
PrintLog(_("- method : %4s, %d roots, %4.1f%% redundancy.\n"), PrintLog(_("- method : %4s, %d roots, %4.1f%% redundancy.\n"),
method, eh->eccBytes, method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes); ((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes, method, eh->eccBytes,
@@ -676,7 +676,7 @@ process_ecc:
{ PrintLog(_("- requires : dvdisaster-%d.%d (good)\n"), { PrintLog(_("- requires : dvdisaster-%d.%d (good)\n"),
eh->neededVersion/10000, eh->neededVersion/10000,
(eh->neededVersion%10000)/100); (eh->neededVersion%10000)/100);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d",
eh->neededVersion/10000, eh->neededVersion/10000,
@@ -690,7 +690,7 @@ process_ecc:
eh->neededVersion/10000, eh->neededVersion/10000,
(eh->neededVersion%10000)/100); (eh->neededVersion%10000)/100);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires), { SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%d.%d</span>", "<span %s>dvdisaster-%d.%d</span>",
@@ -712,7 +712,7 @@ process_ecc:
if(!image->file) if(!image->file)
{ if(!ecc_in_last) { if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 "\n"), image->expectedSectors); { PrintLog(_("- medium sectors : %" PRId64 "\n"), image->expectedSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors); SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif #endif
@@ -720,7 +720,7 @@ process_ecc:
else else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes\n"), { PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes\n"),
image->expectedSectors-1, ecc_in_last); image->expectedSectors-1, ecc_in_last);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"), _("%" PRId64 " sectors + %d bytes"),
@@ -735,7 +735,7 @@ process_ecc:
&& (!ecc_in_last || image->inLast == eh->inLast)) && (!ecc_in_last || image->inLast == eh->inLast))
{ if(!ecc_in_last) { if(!ecc_in_last)
{ PrintLog(_("- medium sectors : %" PRId64 " (good)\n"), image->expectedSectors); { PrintLog(_("- medium sectors : %" PRId64 " (good)\n"), image->expectedSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors); SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 "", image->expectedSectors);
#endif #endif
@@ -743,7 +743,7 @@ process_ecc:
else else
{ PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes (good)\n"), { PrintLog(_("- medium sectors : %" PRId64 " sectors + %d bytes (good)\n"),
image->expectedSectors-1, ecc_in_last); image->expectedSectors-1, ecc_in_last);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("%" PRId64 " sectors + %d bytes"), _("%" PRId64 " sectors + %d bytes"),
@@ -756,7 +756,7 @@ process_ecc:
{ /* TAO case (1 or 2 sectors more than expected) */ { /* TAO case (1 or 2 sectors more than expected) */
if(image->sectorSize > image->expectedSectors && image->sectorSize - image->expectedSectors <= 2) if(image->sectorSize > image->expectedSectors && image->sectorSize - image->expectedSectors <= 2)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD, perhaps TAO/DAO mismatch)\n"), image->expectedSectors); { PrintLog(_("* medium sectors : %" PRId64 " (BAD, perhaps TAO/DAO mismatch)\n"), image->expectedSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(!ecc_in_last) { if(!ecc_in_last)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>", SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
@@ -769,7 +769,7 @@ process_ecc:
else /* more than 2 Sectors difference */ else /* more than 2 Sectors difference */
{ if(!ecc_in_last) { if(!ecc_in_last)
{ PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"), image->expectedSectors); { PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"), image->expectedSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>", { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "<span %s>%" PRId64 "</span>",
Closure->redMarkup, image->expectedSectors); Closure->redMarkup, image->expectedSectors);
@@ -781,7 +781,7 @@ process_ecc:
else /* byte size difference */ else /* byte size difference */
{ PrintLog(_("* medium sectors : %" PRId64 " sectors + %d bytes (BAD)\n"), { PrintLog(_("* medium sectors : %" PRId64 " sectors + %d bytes (BAD)\n"),
image->expectedSectors-1, ecc_in_last); image->expectedSectors-1, ecc_in_last);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
_("<span %s>%" PRId64 " sectors + %d bytes</span>"), _("<span %s>%" PRId64 " sectors + %d bytes</span>"),
@@ -803,7 +803,7 @@ process_ecc:
{ int n = !memcmp(eh->mediumSum, image->mediumSum, 16); { int n = !memcmp(eh->mediumSum, image->mediumSum, 16);
if(n) PrintLog(_("- image md5sum : %s (good)\n"),edigest); if(n) PrintLog(_("- image md5sum : %s (good)\n"),edigest);
else PrintLog(_("* image md5sum : %s (BAD)\n"),edigest); else PrintLog(_("* image md5sum : %s (BAD)\n"),edigest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(n) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest); { if(n) SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
else else
@@ -815,7 +815,7 @@ process_ecc:
} }
else else
{ PrintLog(_("- image md5sum : %s\n"),edigest); { PrintLog(_("- image md5sum : %s\n"),edigest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest); SetLabelText(GTK_LABEL(wl->cmpEccImgMd5Sum), "%s", edigest);
#endif #endif
@@ -825,7 +825,7 @@ process_ecc:
if(image && image->file) if(image && image->file)
{ if(image->fpState != FP_PRESENT) { if(image->fpState != FP_PRESENT)
{ PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n")); { PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup); SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup);
#endif #endif
@@ -835,7 +835,7 @@ process_ecc:
if(memcmp(image->imageFP, eh->mediumFP, 16)) if(memcmp(image->imageFP, eh->mediumFP, 16))
{ PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n")); { PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), { SetLabelText(GTK_LABEL(wl->cmpEccFingerprint),
_("<span %s>mismatch</span>"), Closure->redMarkup); _("<span %s>mismatch</span>"), Closure->redMarkup);
@@ -847,7 +847,7 @@ process_ecc:
} }
else else
{ PrintLog(_("- fingerprint match: good\n")); { PrintLog(_("- fingerprint match: good\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good")); SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good"));
#endif #endif
@@ -867,14 +867,14 @@ process_ecc:
if(ecc_expected == ecc_blocks) if(ecc_expected == ecc_blocks)
{ PrintLog(_("- ecc blocks : %" PRId64 " (good)\n"),ecc_blocks); { PrintLog(_("- ecc blocks : %" PRId64 " (good)\n"),ecc_blocks);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "%" PRId64 "", ecc_blocks); SetLabelText(GTK_LABEL(wl->cmpEccBlocks), "%" PRId64 "", ecc_blocks);
#endif #endif
} }
else else
{ PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),ecc_blocks,ecc_expected); { PrintLog(_("* ecc blocks : %" PRId64 " (BAD, expected %" PRId64 ")\n"),ecc_blocks,ecc_expected);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccBlocks), _("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),Closure->redMarkup,ecc_blocks,ecc_expected); SetLabelText(GTK_LABEL(wl->cmpEccBlocks), _("<span %s>%" PRId64 " (bad, expected %" PRId64 ")</span>"),Closure->redMarkup,ecc_blocks,ecc_expected);
#endif #endif
@@ -899,17 +899,17 @@ process_ecc:
percent = (100*count)/image->eccFile->size; percent = (100*count)/image->eccFile->size;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
PrintProgress(_("- ecc md5sum : %3d%%"),percent); PrintProgress(_("- ecc md5sum : %3d%%"),percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent); else SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%3d%%", percent);
#endif #endif
last_percent = percent; last_percent = percent;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpEccResult), SetLabelText(GTK_LABEL(wl->cmpEccResult),
@@ -924,7 +924,7 @@ process_ecc:
if(memcmp(eh->eccSum, digest, 16)) if(memcmp(eh->eccSum, digest, 16))
{ PrintLog(_("* ecc md5sum : BAD, ecc file may be damaged!\n")); { PrintLog(_("* ecc md5sum : BAD, ecc file may be damaged!\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), _("<span %s>bad</span>"), Closure->redMarkup); { SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), _("<span %s>bad</span>"), Closure->redMarkup);
if(!ecc_advice) if(!ecc_advice)
@@ -934,7 +934,7 @@ process_ecc:
} }
else else
{ PrintLog(_("- ecc md5sum : %s (good)\n"),edigest); { PrintLog(_("- ecc md5sum : %s (good)\n"),edigest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%s", edigest); SetLabelText(GTK_LABEL(wl->cmpEccMd5Sum), "%s", edigest);
#endif #endif
@@ -943,7 +943,7 @@ process_ecc:
skip_ecc: skip_ecc:
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ecc_advice) { if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice); { SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);

View File

@@ -432,7 +432,7 @@ RS02Layout *CalcRS02Layout(Image *image)
/* See if user wants to pick a certain redundancy */ /* See if user wants to pick a certain redundancy */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && Closure->redundancy) if(!Closure->guiMode && Closure->redundancy)
#else #else
if(Closure->redundancy) if(Closure->redundancy)

View File

@@ -31,7 +31,7 @@
typedef struct typedef struct
{ Image *image; { Image *image;
Method *self; Method *self;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl; RS02Widgets *wl;
#endif #endif
RS02Layout *lay; RS02Layout *lay;
@@ -56,7 +56,7 @@ static void ecc_cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ec->earlyTermination && ec->wl) { if(ec->earlyTermination && ec->wl)
SetLabelText(GTK_LABEL(ec->wl->encFootline), SetLabelText(GTK_LABEL(ec->wl->encFootline),
@@ -92,7 +92,7 @@ static void ecc_cleanup(gpointer data)
g_free(ec); g_free(ec);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -108,7 +108,7 @@ static void ecc_cleanup(gpointer data)
static void abort_encoding(ecc_closure *ec, int truncate) static void abort_encoding(ecc_closure *ec, int truncate)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = ec->wl; RS02Widgets *wl = ec->wl;
#endif #endif
@@ -116,14 +116,14 @@ static void abort_encoding(ecc_closure *ec, int truncate)
{ if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors))) { if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors)))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions == STOP_CURRENT_ACTION) if(Closure->stopActions == STOP_CURRENT_ACTION)
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"), _("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup); Closure->redMarkup);
#endif #endif
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ if(Closure->stopActions == STOP_CURRENT_ACTION) { if(Closure->stopActions == STOP_CURRENT_ACTION)
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
@@ -149,14 +149,14 @@ static void remove_old_ecc(ecc_closure *ec)
guint64 data_bytes; guint64 data_bytes;
int answer; int answer;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->confirmDeletion || !Closure->guiMode) if(Closure->confirmDeletion || !Closure->guiMode)
#endif #endif
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image \"%s\" already contains error correction information.\n" _("Image \"%s\" already contains error correction information.\n"
"Truncating image to data part (%" PRId64 " sectors).\n"), "Truncating image to data part (%" PRId64 " sectors).\n"),
Closure->imageName, data_sectors); Closure->imageName, data_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else answer = TRUE; else answer = TRUE;
#endif #endif
@@ -213,7 +213,7 @@ static void check_image(ecc_closure *ec)
{ unsigned char buf[2048]; { unsigned char buf[2048];
int expected,n,err; int expected,n,err;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, FALSE); abort_encoding(ec, FALSE);
#endif #endif
@@ -256,7 +256,7 @@ static void check_image(ecc_closure *ec)
if(last_percent != percent) if(last_percent != percent)
{ PrintProgress(_("Preparing image (checksums, adding space): %3d%%") ,percent); { PrintProgress(_("Preparing image (checksums, adding space): %3d%%") ,percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100); SetProgress(ec->wl->encPBar1, percent, 100);
#endif #endif
@@ -308,7 +308,7 @@ static void expand_image(ecc_closure *ec)
{ unsigned char buf[2048]; { unsigned char buf[2048];
int n; int n;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE); abort_encoding(ec, TRUE);
#endif #endif
@@ -326,7 +326,7 @@ static void expand_image(ecc_closure *ec)
PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%") ,percent); PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%") ,percent);
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), percent); else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100); SetProgress(ec->wl->encPBar1, percent, 100);
#endif #endif
@@ -340,7 +340,7 @@ static void expand_image(ecc_closure *ec)
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), 100); else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), 100);
PrintProgress("\n"); PrintProgress("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, 100, 100); SetProgress(ec->wl->encPBar1, 100, 100);
#endif #endif
@@ -495,7 +495,7 @@ static gint32 *enc_alpha_to;
/*** Show the second progress bar */ /*** Show the second progress bar */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ ShowWidget(ec->wl->encPBar2); { ShowWidget(ec->wl->encPBar2);
ShowWidget(ec->wl->encLabel2); ShowWidget(ec->wl->encLabel2);
@@ -607,7 +607,7 @@ static gint32 *enc_alpha_to;
{ int offset = 0; { int offset = 0;
unsigned char *par_idx = ec->parity; unsigned char *par_idx = ec->parity;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE); abort_encoding(ec, TRUE);
#endif #endif
@@ -997,7 +997,7 @@ static gint32 *enc_alpha_to;
percent = (1000*progress)/max_percent; percent = (1000*progress)/max_percent;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar2, percent, 1000); SetProgress(ec->wl->encPBar2, percent, 1000);
else else
@@ -1060,7 +1060,7 @@ static gint32 *enc_alpha_to;
void RS02Create(void) void RS02Create(void)
{ Method *self = FindMethod("RS02"); { Method *self = FindMethod("RS02");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl = (RS02Widgets*)self->widgetList; RS02Widgets *wl = (RS02Widgets*)self->widgetList;
#endif #endif
Image *image = NULL; Image *image = NULL;
@@ -1090,13 +1090,13 @@ void RS02Create(void)
ec->image = image; ec->image = image;
ec->self = self; ec->self = self;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
ec->wl = wl; ec->wl = wl;
#endif #endif
ec->eh = g_malloc0(sizeof(EccHeader)); ec->eh = g_malloc0(sizeof(EccHeader));
ec->timer = g_timer_new(); ec->timer = g_timer_new();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */ if(Closure->guiMode) /* Preliminary fill text for the head line */
SetLabelText(GTK_LABEL(wl->encHeadline), SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"), _("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
@@ -1113,7 +1113,7 @@ void RS02Create(void)
/*** Announce what we are going to do */ /*** Announce what we are going to do */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */ 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)."), { 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); 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)/512,
lay->dataSectors+lay->eccSectors); lay->dataSectors+lay->eccSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100); { SetProgress(wl->encPBar2, 100, 100);

View File

@@ -32,7 +32,7 @@
typedef struct typedef struct
{ Image *image; { Image *image;
EccHeader *eh; EccHeader *eh;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl; RS02Widgets *wl;
#endif #endif
RS02Layout *lay; RS02Layout *lay;
@@ -49,7 +49,7 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(fc->earlyTermination) { if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -77,7 +77,7 @@ static void fix_cleanup(gpointer data)
g_free(fc); g_free(fc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -111,7 +111,7 @@ static void expand_image(fix_closure *fc, gint64 new_size)
percent = (100*sectors) / new_sectors; percent = (100*sectors) / new_sectors;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
; ;
else 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) if(Closure->guiMode)
; ;
else else
@@ -141,7 +141,7 @@ static void expand_image(fix_closure *fc, gint64 new_size)
void RS02Fix(Image *image) void RS02Fix(Image *image)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS02"); Method *self = FindMethod("RS02");
RS02Widgets *wl = (RS02Widgets*)self->widgetList; RS02Widgets *wl = (RS02Widgets*)self->widgetList;
#endif #endif
@@ -183,7 +183,7 @@ void RS02Fix(Image *image)
/*** Register the cleanup procedure for GUI mode */ /*** Register the cleanup procedure for GUI mode */
fc->image = image; fc->image = image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
fc->wl = wl; fc->wl = wl;
#endif #endif
fc->earlyTermination = TRUE; fc->earlyTermination = TRUE;
@@ -191,7 +191,7 @@ void RS02Fix(Image *image)
/*** Open the image file */ /*** Open the image file */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->fixHeadline), SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"), _("<big>Repairing the image.</big>\n<i>%s</i>"),
@@ -219,7 +219,7 @@ void RS02Fix(Image *image)
/*** Announce what we going to do */ /*** Announce what we going to do */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ char *msg = g_strdup_printf(_("Image contains error correction data: Method RS02, %d roots, %4.1f%% redundancy."), { char *msg = g_strdup_printf(_("Image contains error correction data: Method RS02, %d roots, %4.1f%% redundancy."),
eh->eccBytes, eh->eccBytes,
@@ -254,7 +254,7 @@ void RS02Fix(Image *image)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline, fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"), _("<span %s>Aborted by user request!</span>"),
@@ -268,7 +268,7 @@ void RS02Fix(Image *image)
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(diff>2 && Closure->guiMode) if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans, trans,
@@ -291,7 +291,7 @@ void RS02Fix(Image *image)
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(diff>2 && !Closure->guiMode) if(diff>2 && !Closure->guiMode)
#else #else
if(diff>2) if(diff>2)
@@ -364,7 +364,7 @@ void RS02Fix(Image *image)
/* See if user hit the Stop button */ /* See if user hit the Stop button */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -493,7 +493,7 @@ void RS02Fix(Image *image)
if(erasure_count>lay->nroots) /* uncorrectable */ if(erasure_count>lay->nroots) /* uncorrectable */
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ PrintCLI(_("* Ecc block %" PRId64 ": %3d unrepairable sectors: "), s, erasure_count); { PrintCLI(_("* Ecc block %" PRId64 ": %3d unrepairable sectors: "), s, erasure_count);
@@ -821,7 +821,7 @@ skip:
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ {
RS02AddFixValues(wl, percent, local_plot_max); RS02AddFixValues(wl, percent, local_plot_max);
@@ -852,7 +852,7 @@ skip:
corrected, data_corr, ecc_corr); corrected, data_corr, ecc_corr);
if(uncorrected > 0) if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored " _("Image sectors could not be fully restored "
@@ -874,7 +874,7 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc); (double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t) if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t); "%s %s", _("Repair results:"), t);

View File

@@ -23,7 +23,7 @@
#ifndef RS02INCLUDES_H #ifndef RS02INCLUDES_H
#define RS02INCLUDES_H #define RS02INCLUDES_H
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* Data structs from rs02-window.c */ /* Data structs from rs02-window.c */
typedef struct typedef struct
@@ -122,7 +122,7 @@ typedef struct
* These are exported via the Method struct * These are exported via the Method struct
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void CreateRS02EncWindow(Method*, GtkWidget*); void CreateRS02EncWindow(Method*, GtkWidget*);
void CreateRS02FixWindow(Method*, GtkWidget*); void CreateRS02FixWindow(Method*, GtkWidget*);
void CreateRS02PrefsPage(Method*, GtkWidget*); void CreateRS02PrefsPage(Method*, GtkWidget*);
@@ -188,7 +188,7 @@ void RS02Fix(Image*);
int RS02Recognize(Image*); int RS02Recognize(Image*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* rs02-window.c */ /* rs02-window.c */
void RS02AddFixValues(RS02Widgets*, int, int); void RS02AddFixValues(RS02Widgets*, int, int);

View File

@@ -29,7 +29,7 @@
*** Recognize RS02 error correction data in the image *** Recognize RS02 error correction data in the image
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* /*
* Dialog components for disabling RS02 search * Dialog components for disabling RS02 search
@@ -249,7 +249,7 @@ int RS02Recognize(Image *image)
while(pos > 0) while(pos > 0)
{ int result; { int result;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
goto bail_out; goto bail_out;
#endif #endif
@@ -272,7 +272,7 @@ int RS02Recognize(Image *image)
read_count++; read_count++;
if(!answered_continue && read_count > 5) if(!answered_continue && read_count > 5)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, insert_buttons,
_("Faster medium initialization\n\n" _("Faster medium initialization\n\n"
@@ -304,7 +304,7 @@ int RS02Recognize(Image *image)
header_modulo >>= 1; header_modulo >>= 1;
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
bail_out: bail_out:
#endif #endif
FreeBitmap(try_next_header); FreeBitmap(try_next_header);

View File

@@ -28,7 +28,7 @@
*** Reset the verify output window *** Reset the verify output window
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void ResetRS02VerifyWindow(Method *self) void ResetRS02VerifyWindow(Method *self)
{ RS02Widgets *wl = (RS02Widgets*)self->widgetList; { RS02Widgets *wl = (RS02Widgets*)self->widgetList;
@@ -344,7 +344,7 @@ typedef struct
{ Image *image; { Image *image;
EccHeader *eh; EccHeader *eh;
RS02Layout *lay; RS02Layout *lay;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS02Widgets *wl; RS02Widgets *wl;
#endif #endif
Bitmap *map; Bitmap *map;
@@ -358,7 +358,7 @@ static void cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
AllowActions(TRUE); AllowActions(TRUE);
#endif #endif
@@ -371,7 +371,7 @@ static void cleanup(gpointer data)
g_free(cc); g_free(cc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #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"), PrintLog(_("- prognosis : %" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)\n"),
recoverable, expected, percentage/10, percentage%10); recoverable, expected, percentage/10, percentage%10);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Name), ""); { SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Name), "");
SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Msg), ""); SetLabelText(GTK_LABEL(vc->wl->cmpEcc1Msg), "");
@@ -548,7 +548,7 @@ static int prognosis(verify_closure *vc, gint64 missing, gint64 expected)
void RS02Verify(Image *image) void RS02Verify(Image *image)
{ verify_closure *cc = g_malloc0(sizeof(verify_closure)); { verify_closure *cc = g_malloc0(sizeof(verify_closure));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS02"); Method *self = FindMethod("RS02");
RS02Widgets *wl = self->widgetList; RS02Widgets *wl = self->widgetList;
#endif #endif
@@ -574,7 +574,7 @@ void RS02Verify(Image *image)
gint64 hdr_missing, hdr_crc_errors; gint64 hdr_missing, hdr_crc_errors;
gint64 hdr_ok,hdr_pos,hdr_correctable; gint64 hdr_ok,hdr_pos,hdr_correctable;
gint64 ecc_sector,expected_sectors; gint64 ecc_sector,expected_sectors;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int ecc_md5_failure = FALSE; int ecc_md5_failure = FALSE;
#endif #endif
int ecc_slice; int ecc_slice;
@@ -583,7 +583,7 @@ void RS02Verify(Image *image)
char method[5]; char method[5];
char *img_advice = NULL; char *img_advice = NULL;
char *ecc_advice = NULL; char *ecc_advice = NULL;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int try_it; int try_it;
#endif #endif
int unrecoverable_sectors = 0; int unrecoverable_sectors = 0;
@@ -591,7 +591,7 @@ void RS02Verify(Image *image)
/*** Prepare for early termination */ /*** Prepare for early termination */
RegisterCleanup(_("Check aborted"), cleanup, cc); RegisterCleanup(_("Check aborted"), cleanup, cc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
cc->wl = wl; cc->wl = wl;
#endif #endif
@@ -609,7 +609,7 @@ void RS02Verify(Image *image)
/*** Print information on image size */ /*** Print information on image size */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Checking the image file."), _("Checking the image file."),
@@ -619,7 +619,7 @@ void RS02Verify(Image *image)
PrintLog("\n%s: ",Closure->imageName); PrintLog("\n%s: ",Closure->imageName);
PrintLog(_("present, contains %" PRId64 " medium sectors.\n"),image->sectorSize); PrintLog(_("present, contains %" PRId64 " medium sectors.\n"),image->sectorSize);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(expected_sectors == image->sectorSize) { if(expected_sectors == image->sectorSize)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors), "%" PRId64 "", 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); hdr_pos = (lay->protectedSectors + lay->headerModulo - 1) & ~(lay->headerModulo-1);
else hdr_pos += lay->headerModulo; else hdr_pos += lay->headerModulo;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(!hdr_crc_errors && !hdr_missing) { if(!hdr_crc_errors && !hdr_missing)
SetLabelText(GTK_LABEL(wl->cmpEccHeaders), _("complete")); SetLabelText(GTK_LABEL(wl->cmpEccHeaders), _("complete"));
@@ -734,7 +734,7 @@ void RS02Verify(Image *image)
/* Check for user interruption */ /* Check for user interruption */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult), SetLabelText(GTK_LABEL(wl->cmpImageResult),
@@ -820,7 +820,7 @@ void RS02Verify(Image *image)
} }
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/expected_sectors; percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/expected_sectors;
else else
@@ -829,7 +829,7 @@ void RS02Verify(Image *image)
if(last_percent != percent) if(last_percent != percent)
{ PrintProgress(_("- testing sectors : %3d%%") ,percent); { PrintProgress(_("- testing sectors : %3d%%") ,percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ add_verify_values(self, percent, new_missing, new_crc_errors); { add_verify_values(self, percent, new_missing, new_crc_errors);
if(data_missing || data_crc_errors) if(data_missing || data_crc_errors)
@@ -853,7 +853,7 @@ void RS02Verify(Image *image)
/* Complete damage summary */ /* Complete damage summary */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(data_missing || data_crc_errors) { if(data_missing || data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection), SetLabelText(GTK_LABEL(wl->cmpDataSection),
@@ -907,7 +907,7 @@ void RS02Verify(Image *image)
PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing); PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing);
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(!data_missing && !data_crc_errors) { if(!data_missing && !data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete")); SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete"));
@@ -957,7 +957,7 @@ continue_with_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable); PrintLog(format, _("created by dvdisaster"), major, minor, micro, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SwitchAndSetFootline(wl->cmpEccNotebook, 1, { SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, wl->cmpEccCreatedBy,
@@ -972,7 +972,7 @@ continue_with_ecc:
PrintLog(format, _("created by dvdisaster"), major, minor, unstable); PrintLog(format, _("created by dvdisaster"), major, minor, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpEccNotebook, 1, SwitchAndSetFootline(wl->cmpEccNotebook, 1,
wl->cmpEccCreatedBy, wl->cmpEccCreatedBy,
@@ -989,7 +989,7 @@ continue_with_ecc:
method, eh->eccBytes, method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes); ((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes, method, eh->eccBytes,
@@ -1004,7 +1004,7 @@ continue_with_ecc:
(eh->neededVersion%10000)/100); (eh->neededVersion%10000)/100);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d", SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%d.%d",
eh->neededVersion/10000, eh->neededVersion/10000,
@@ -1019,7 +1019,7 @@ continue_with_ecc:
(eh->neededVersion%10000)/100); (eh->neededVersion%10000)/100);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires), { SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%d.%d</span>", "<span %s>dvdisaster-%d.%d</span>",
@@ -1043,7 +1043,7 @@ continue_with_ecc:
{ PrintLog(_("- medium sectors : %" PRId64 " / %" PRId64 " (good)\n"), { PrintLog(_("- medium sectors : %" PRId64 " / %" PRId64 " (good)\n"),
expected_sectors, lay->dataSectors); expected_sectors, lay->dataSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 " / %" PRId64 "", SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), "%" PRId64 " / %" PRId64 "",
expected_sectors, lay->dataSectors); expected_sectors, lay->dataSectors);
@@ -1055,7 +1055,7 @@ continue_with_ecc:
expected_sectors); expected_sectors);
else PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"),expected_sectors); else PrintLog(_("* medium sectors : %" PRId64 " (BAD)\n"),expected_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors), { SetLabelText(GTK_LABEL(wl->cmpEccMediumSectors),
"<span %s>%" PRId64 "</span>", Closure->redMarkup, expected_sectors); "<span %s>%" PRId64 "</span>", Closure->redMarkup, expected_sectors);
@@ -1078,7 +1078,7 @@ continue_with_ecc:
if(n) PrintLog(_("- data md5sum : %s (good)\n"),hdr_digest); if(n) PrintLog(_("- data md5sum : %s (good)\n"),hdr_digest);
else PrintLog(_("* data md5sum : %s (BAD)\n"),hdr_digest); else PrintLog(_("* data md5sum : %s (BAD)\n"),hdr_digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(n) SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", hdr_digest); { if(n) SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", hdr_digest);
else else
@@ -1091,7 +1091,7 @@ continue_with_ecc:
else else
{ PrintLog(_("- data md5sum : %s\n"), "-"); { PrintLog(_("- data md5sum : %s\n"), "-");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", "-"); SetLabelText(GTK_LABEL(wl->cmpEcc1Msg), "%s", "-");
#endif #endif
@@ -1104,14 +1104,14 @@ continue_with_ecc:
if(!crc_missing) if(!crc_missing)
{ if(!memcmp(eh->crcSum, cc->crcSum, 16)) { if(!memcmp(eh->crcSum, cc->crcSum, 16))
{ PrintLog(_("- crc md5sum : %s (good)\n"),digest); { PrintLog(_("- crc md5sum : %s (good)\n"),digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", digest); SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", digest);
#endif #endif
} }
else else
{ PrintLog(_("* crc md5sum : %s (BAD)\n"),digest); { PrintLog(_("* crc md5sum : %s (BAD)\n"),digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "<span %s>%s</span>", Closure->redMarkup, digest); { SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "<span %s>%s</span>", Closure->redMarkup, digest);
} }
@@ -1122,7 +1122,7 @@ continue_with_ecc:
else else
{ PrintLog(_("- crc md5sum : %s\n"), "-"); { PrintLog(_("- crc md5sum : %s\n"), "-");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", "-"); SetLabelText(GTK_LABEL(wl->cmpEcc2Msg), "%s", "-");
#endif #endif
@@ -1135,14 +1135,14 @@ continue_with_ecc:
if(!ecc_missing) if(!ecc_missing)
{ if(!memcmp(eh->eccSum, ecc_sum, 16)) { if(!memcmp(eh->eccSum, ecc_sum, 16))
{ PrintLog(_("- ecc md5sum : %s (good)\n"),digest); { PrintLog(_("- ecc md5sum : %s (good)\n"),digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", digest); SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", digest);
#endif #endif
} }
else else
{ PrintLog(_("* ecc md5sum : %s (BAD)\n"),digest); { PrintLog(_("* ecc md5sum : %s (BAD)\n"),digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "<span %s>%s</span>", Closure->redMarkup, digest); { SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "<span %s>%s</span>", Closure->redMarkup, digest);
} }
@@ -1153,7 +1153,7 @@ continue_with_ecc:
else else
{ PrintLog(_("- ecc md5sum : %s\n"), "-"); { PrintLog(_("- ecc md5sum : %s\n"), "-");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", "-"); SetLabelText(GTK_LABEL(wl->cmpEcc3Msg), "%s", "-");
#endif #endif
@@ -1162,12 +1162,12 @@ continue_with_ecc:
/*** Print final results */ /*** Print final results */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
try_it = try_it =
#endif #endif
prognosis(cc, total_missing + data_crc_errors - hdr_correctable, expected_sectors); prognosis(cc, total_missing + data_crc_errors - hdr_correctable, expected_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ecc_advice) { if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice); { SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);

View File

@@ -67,7 +67,7 @@
typedef struct typedef struct
{ Method *self; { Method *self;
Image *image; Image *image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl; RS03Widgets *wl;
#endif #endif
RS03Layout *lay; RS03Layout *lay;
@@ -147,7 +147,7 @@ static void ecc_cleanup(gpointer data)
} }
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ec->earlyTermination) { if(ec->earlyTermination)
SetLabelText(GTK_LABEL(ec->wl->encFootline), SetLabelText(GTK_LABEL(ec->wl->encFootline),
@@ -229,7 +229,7 @@ static void ecc_cleanup(gpointer data)
if(ec->encoderData) g_free(ec->encoderData); if(ec->encoderData) g_free(ec->encoderData);
g_free(ec); g_free(ec);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -245,7 +245,7 @@ static void ecc_cleanup(gpointer data)
static void abort_encoding(ecc_closure *ec, int truncate) static void abort_encoding(ecc_closure *ec, int truncate)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = ec->wl; RS03Widgets *wl = ec->wl;
#endif #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))) else if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors)))
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); 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 */ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"), _("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
Closure->redMarkup); Closure->redMarkup);
#endif #endif
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->encFootline), SetLabelText(GTK_LABEL(wl->encFootline),
@@ -291,7 +291,7 @@ static void remove_old_ecc(ecc_closure *ec)
{ {
if(ConfirmEccDeletion(Closure->eccName)) if(ConfirmEccDeletion(Closure->eccName))
LargeUnlink(Closure->eccName); LargeUnlink(Closure->eccName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else else
{ SetLabelText(GTK_LABEL(ec->wl->encFootline), { SetLabelText(GTK_LABEL(ec->wl->encFootline),
_("<span %s>Aborted to keep existing ecc file.</span>"), _("<span %s>Aborted to keep existing ecc file.</span>"),
@@ -311,14 +311,14 @@ static void remove_old_ecc(ecc_closure *ec)
guint64 data_bytes; guint64 data_bytes;
int answer; int answer;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->confirmDeletion || !Closure->guiMode) if(Closure->confirmDeletion || !Closure->guiMode)
#endif #endif
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL, answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image \"%s\" already contains error correction information.\n" _("Image \"%s\" already contains error correction information.\n"
"Truncating image to data part (%" PRId64 " sectors).\n"), "Truncating image to data part (%" PRId64 " sectors).\n"),
Closure->imageName, data_sectors); Closure->imageName, data_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
else answer = TRUE; else answer = TRUE;
#endif #endif
@@ -514,7 +514,7 @@ static void expand_image(ecc_closure *ec)
{ unsigned char dead_sector[2048]; { unsigned char dead_sector[2048];
int n; int n;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
abort_encoding(ec, TRUE); abort_encoding(ec, TRUE);
#endif #endif
@@ -531,7 +531,7 @@ static void expand_image(ecc_closure *ec)
if(last_percent != percent) if(last_percent != percent)
{ PrintProgress(_(progress_msg), percent); { PrintProgress(_(progress_msg), percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, percent, 100); SetProgress(ec->wl->encPBar1, percent, 100);
#endif #endif
@@ -543,7 +543,7 @@ static void expand_image(ecc_closure *ec)
PrintProgress(_(progress_msg), 100); PrintProgress(_(progress_msg), 100);
PrintProgress("\n"); PrintProgress("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetProgress(ec->wl->encPBar1, 100, 100); SetProgress(ec->wl->encPBar1, 100, 100);
#endif #endif
@@ -629,7 +629,7 @@ static void read_next_chunk(ecc_closure *ec, guint64 chunk)
guint64 page_offset; guint64 page_offset;
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* User hit the Stop button */ if(Closure->stopActions) /* User hit the Stop button */
{ ec->abortImmediately = TRUE; { ec->abortImmediately = TRUE;
abort_encoding(ec, TRUE); abort_encoding(ec, TRUE);
@@ -860,7 +860,7 @@ static gpointer io_thread(ecc_closure *ec)
for(chunk=0; chunk<lay->sectorsPerLayer; chunk+=ec->chunkSize) for(chunk=0; chunk<lay->sectorsPerLayer; chunk+=ec->chunkSize)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int cpu_bound = 0; int cpu_bound = 0;
#endif #endif
@@ -917,7 +917,7 @@ static gpointer io_thread(ecc_closure *ec)
/* Wait until the encoders have finished */ /* Wait until the encoders have finished */
g_mutex_lock(ec->lock); g_mutex_lock(ec->lock);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
cpu_bound = ec->buffersToEncode; cpu_bound = ec->buffersToEncode;
#endif #endif
while(ec->buffersToEncode) while(ec->buffersToEncode)
@@ -930,7 +930,7 @@ static gpointer io_thread(ecc_closure *ec)
verbose("IO: chunk %d finished\n", ec->ioChunk); verbose("IO: chunk %d finished\n", ec->ioChunk);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(cpu_bound) { if(cpu_bound)
{ SetLabelText(GTK_LABEL(ec->wl->encBottleneck), _("CPU bound")); { SetLabelText(GTK_LABEL(ec->wl->encBottleneck), _("CPU bound"));
@@ -1137,7 +1137,7 @@ static gpointer encoder_thread(ecc_closure *ec)
{ {
ec->lastPercent = percent; ec->lastPercent = percent;
g_mutex_unlock(ec->lock); g_mutex_unlock(ec->lock);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ gdouble elapsed; { gdouble elapsed;
gulong ignore; gulong ignore;
@@ -1178,14 +1178,14 @@ static void create_reed_solomon(ecc_closure *ec)
{ int nroots = ec->lay->nroots; { int nroots = ec->lay->nroots;
int ndata = ec->lay->ndata; int ndata = ec->lay->ndata;
int i; int i;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
char *alg="none"; char *alg="none";
char *iostrat="none"; char *iostrat="none";
#endif #endif
/*** Show the second progress bar */ /*** Show the second progress bar */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ ShowWidget(ec->wl->encPBar2); { ShowWidget(ec->wl->encPBar2);
ShowWidget(ec->wl->encLabel2); ShowWidget(ec->wl->encLabel2);
@@ -1289,7 +1289,7 @@ static void create_reed_solomon(ecc_closure *ec)
void RS03Create(void) void RS03Create(void)
{ Method *method = FindMethod("RS03"); { Method *method = FindMethod("RS03");
Image *image = NULL; Image *image = NULL;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = (RS03Widgets*)method->widgetList; RS03Widgets *wl = (RS03Widgets*)method->widgetList;
#endif #endif
RS03Layout *lay; RS03Layout *lay;
@@ -1301,14 +1301,14 @@ void RS03Create(void)
/*** Register the cleanup procedure for GUI mode */ /*** Register the cleanup procedure for GUI mode */
ec->self = method; ec->self = method;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
ec->wl = wl; ec->wl = wl;
#endif #endif
ec->earlyTermination = TRUE; ec->earlyTermination = TRUE;
RegisterCleanup(_("Error correction data creation aborted"), ecc_cleanup, ec); 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 */ if(Closure->guiMode) /* Preliminary fill text for the head line */
SetLabelText(GTK_LABEL(wl->encHeadline), SetLabelText(GTK_LABEL(wl->encHeadline),
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"), _("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
@@ -1359,7 +1359,7 @@ void RS03Create(void)
/*** Announce what we are going to do */ /*** Announce what we are going to do */
ecc_sectors = lay->nroots*lay->sectorsPerLayer; ecc_sectors = lay->nroots*lay->sectorsPerLayer;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) /* Preliminary fill text for the head line */ 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)."), { 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); 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); mbs = ((double)lay->ndata*lay->sectorsPerLayer)/(512.0*elapsed);
PrintLog(_("Avg performance: %5.2fs (%5.2fMiB/s) total\n"), PrintLog(_("Avg performance: %5.2fs (%5.2fMiB/s) total\n"),
elapsed, mbs); elapsed, mbs);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->encPerformance), _("%5.2fMiB/s average"), mbs); { SetLabelText(GTK_LABEL(wl->encPerformance), _("%5.2fMiB/s average"), mbs);
SetLabelText(GTK_LABEL(ec->wl->encBottleneck), SetLabelText(GTK_LABEL(ec->wl->encBottleneck),
@@ -1467,7 +1467,7 @@ void RS03Create(void)
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetProgress(wl->encPBar2, 100, 100); { SetProgress(wl->encPBar2, 100, 100);

View File

@@ -31,7 +31,7 @@
typedef struct typedef struct
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl; RS03Widgets *wl;
#endif #endif
RS03Layout *lay; RS03Layout *lay;
@@ -49,7 +49,7 @@ static void fix_cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(fc->earlyTermination) { if(fc->earlyTermination)
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -76,7 +76,7 @@ static void fix_cleanup(gpointer data)
g_free(fc); g_free(fc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #endif
@@ -114,7 +114,7 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size)
percent = (100*sectors) / new_sectors; percent = (100*sectors) / new_sectors;
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
; ;
else 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) if(Closure->guiMode)
; ;
else else
@@ -141,7 +141,7 @@ static void expand_image(Image *image, EccHeader *eh, gint64 new_size)
void RS03Fix(Image *image) void RS03Fix(Image *image)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
Method *self = FindMethod("RS03"); Method *self = FindMethod("RS03");
RS03Widgets *wl = (RS03Widgets*)self->widgetList; RS03Widgets *wl = (RS03Widgets*)self->widgetList;
#endif #endif
@@ -175,14 +175,14 @@ void RS03Fix(Image *image)
gint64 damaged_eccsecs=0; gint64 damaged_eccsecs=0;
gint64 expected_sectors; gint64 expected_sectors;
char *t=NULL; char *t=NULL;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
char *msg; char *msg;
#endif #endif
/*** Register the cleanup procedure for GUI mode */ /*** Register the cleanup procedure for GUI mode */
fc->image = image; fc->image = image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
fc->wl = wl; fc->wl = wl;
#endif #endif
fc->earlyTermination = TRUE; fc->earlyTermination = TRUE;
@@ -194,7 +194,7 @@ void RS03Fix(Image *image)
/*** Open the image file */ /*** Open the image file */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->fixHeadline), SetLabelText(GTK_LABEL(wl->fixHeadline),
_("<big>Repairing the image.</big>\n<i>%s</i>"), _("<big>Repairing the image.</big>\n<i>%s</i>"),
@@ -237,7 +237,7 @@ void RS03Fix(Image *image)
/*** Announce what we are going to do */ /*** Announce what we are going to do */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(eh->methodFlags[0] & MFLAG_ECC_FILE) { if(eh->methodFlags[0] & MFLAG_ECC_FILE)
msg = g_strdup_printf(_("Error correction file using Method RS03, %d roots, %4.1f%% redundancy."), 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; { int difference = image->inLast - eh->inLast;
guint64 expected_image_size = 2048*(expected_sectors-1)+eh->inLast; guint64 expected_image_size = 2048*(expected_sectors-1)+eh->inLast;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("The image file is %d bytes longer than noted\n" _("The image file is %d bytes longer than noted\n"
@@ -283,7 +283,7 @@ void RS03Fix(Image *image)
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode && !Closure->truncate) if(!Closure->guiMode && !Closure->truncate)
#else #else
if(!Closure->truncate) if(!Closure->truncate)
@@ -321,7 +321,7 @@ void RS03Fix(Image *image)
if(!answer) if(!answer)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
fc->wl->fixFootline, fc->wl->fixFootline,
_("<span %s>Aborted by user request!</span>"), _("<span %s>Aborted by user request!</span>"),
@@ -337,7 +337,7 @@ void RS03Fix(Image *image)
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno)); Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(diff>2 && Closure->guiMode) if(diff>2 && Closure->guiMode)
{ int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL, { int answer = ModalDialog(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
trans, trans,
@@ -362,7 +362,7 @@ void RS03Fix(Image *image)
} }
#endif #endif
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(diff>2 && !Closure->guiMode) if(diff>2 && !Closure->guiMode)
#else #else
if(diff>2) if(diff>2)
@@ -421,7 +421,7 @@ void RS03Fix(Image *image)
/* See if user hit the Stop button */ /* See if user hit the Stop button */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SwitchAndSetFootline(fc->wl->fixNotebook, 1, SwitchAndSetFootline(fc->wl->fixNotebook, 1,
@@ -551,7 +551,7 @@ void RS03Fix(Image *image)
if(erasure_count>lay->nroots) /* uncorrectable */ if(erasure_count>lay->nroots) /* uncorrectable */
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(!Closure->guiMode) if(!Closure->guiMode)
#endif #endif
{ int sep_printed = 0; { int sep_printed = 0;
@@ -913,7 +913,7 @@ skip:
if(last_percent != percent) if(last_percent != percent)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ {
RS03AddFixValues(wl, percent, local_plot_max); RS03AddFixValues(wl, percent, local_plot_max);
@@ -942,7 +942,7 @@ skip:
corrected, data_corr, ecc_corr); corrected, data_corr, ecc_corr);
if(uncorrected > 0) if(uncorrected > 0)
{ PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected); { PrintLog(_("Unrepaired sectors: %" PRId64 "\n"), uncorrected);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
_("Image sectors could not be fully restored " _("Image sectors could not be fully restored "
@@ -967,7 +967,7 @@ skip:
PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"), PrintLog(_("Erasure counts per ecc block: avg = %.1f; worst = %d.\n"),
(double)damaged_sectors/(double)damaged_eccsecs,worst_ecc); (double)damaged_sectors/(double)damaged_eccsecs,worst_ecc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode && t) if(Closure->guiMode && t)
SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline, SwitchAndSetFootline(wl->fixNotebook, 1, wl->fixFootline,
"%s %s", _("Repair results:"), t); "%s %s", _("Repair results:"), t);

View File

@@ -23,7 +23,7 @@
#ifndef RS03INCLUDES_H #ifndef RS03INCLUDES_H
#define RS03INCLUDES_H #define RS03INCLUDES_H
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* Data structs from rs03-window.c */ /* Data structs from rs03-window.c */
typedef struct typedef struct
@@ -133,7 +133,7 @@ typedef struct
* These are exported via the Method struct * These are exported via the Method struct
*/ */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void CreateRS03EncWindow(Method*, GtkWidget*); void CreateRS03EncWindow(Method*, GtkWidget*);
void CreateRS03FixWindow(Method*, GtkWidget*); void CreateRS03FixWindow(Method*, GtkWidget*);
void CreateRS03PrefsPage(Method*, GtkWidget*); void CreateRS03PrefsPage(Method*, GtkWidget*);
@@ -200,7 +200,7 @@ void RS03Fix(Image*);
int RS03RecognizeFile(LargeFile*, EccHeader**); int RS03RecognizeFile(LargeFile*, EccHeader**);
int RS03RecognizeImage(Image*); int RS03RecognizeImage(Image*);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
/* rs03-window.c */ /* rs03-window.c */
void RS03AddFixValues(RS03Widgets*, int, int); void RS03AddFixValues(RS03Widgets*, int, int);
@@ -217,7 +217,7 @@ void RS03Verify(Image*);
/* temporary single threaded versions */ /* temporary single threaded versions */
void RS03SCreate(void); void RS03SCreate(void);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void CreateRS03SEncWindow(Method*, GtkWidget*); void CreateRS03SEncWindow(Method*, GtkWidget*);
void ResetRS03SEncWindow(Method*); void ResetRS03SEncWindow(Method*);
#endif #endif

View File

@@ -35,7 +35,7 @@
/*** /***
*** Reset the verify output window *** Reset the verify output window
***/ ***/
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
void ResetRS03VerifyWindow(Method *self) void ResetRS03VerifyWindow(Method *self)
{ RS03Widgets *wl = (RS03Widgets*)self->widgetList; { RS03Widgets *wl = (RS03Widgets*)self->widgetList;
@@ -376,7 +376,7 @@ typedef struct
{ Image *image; { Image *image;
EccHeader *eh; EccHeader *eh;
RS03Layout *lay; RS03Layout *lay;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl; RS03Widgets *wl;
#endif #endif
CrcBuf *crcBuf; CrcBuf *crcBuf;
@@ -393,7 +393,7 @@ static void cleanup(gpointer data)
UnregisterCleanup(); UnregisterCleanup();
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
AllowActions(TRUE); AllowActions(TRUE);
#endif #endif
@@ -414,7 +414,7 @@ static void cleanup(gpointer data)
g_free(vc); g_free(vc);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
g_thread_exit(0); g_thread_exit(0);
#endif #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"), PrintLog(_("- prognosis : %" PRId64 " of %" PRId64 " sectors recoverable (%d.%d%%)\n"),
recoverable, expected, percentage/10, percentage%10); recoverable, expected, percentage/10, percentage%10);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(vc->wl->cmpImageErasure), _("Erasure counts:")); { SetLabelText(GTK_LABEL(vc->wl->cmpImageErasure), _("Erasure counts:"));
SetLabelText(GTK_LABEL(vc->wl->cmpImagePrognosis), _("Prognosis:")); SetLabelText(GTK_LABEL(vc->wl->cmpImagePrognosis), _("Prognosis:"));
@@ -497,7 +497,7 @@ static int check_syndromes(verify_closure *vc)
int bad_counted; int bad_counted;
int layer,i,j; int layer,i,j;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(vc->wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Checking the image and error correction files."), _("Checking the image and error correction files."),
@@ -515,7 +515,7 @@ static int check_syndromes(verify_closure *vc)
for(j=0; j<i; j++) for(j=0; j<i; j++)
g_free(vc->eccBlock[j]); g_free(vc->eccBlock[j]);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),
_("<span %s>Out of memory; try reducing sector prefetch!</span>"), _("<span %s>Out of memory; try reducing sector prefetch!</span>"),
@@ -541,7 +541,7 @@ static int check_syndromes(verify_closure *vc)
/* Check for user interruption */ /* Check for user interruption */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),
@@ -603,7 +603,7 @@ static int check_syndromes(verify_closure *vc)
if(!ecc_bad) if(!ecc_bad)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),
_("%d%% tested"), _("%d%% tested"),
@@ -614,7 +614,7 @@ static int check_syndromes(verify_closure *vc)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),
_("<span %s>%" PRId64 " good, %" PRId64 " bad; %d%% tested</span>"), _("<span %s>%" PRId64 " good, %" PRId64 " bad; %d%% tested</span>"),
@@ -630,7 +630,7 @@ static int check_syndromes(verify_closure *vc)
if(!ecc_bad) if(!ecc_bad)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),_("pass")); SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),_("pass"));
#endif #endif
@@ -639,7 +639,7 @@ static int check_syndromes(verify_closure *vc)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(vc->wl->cmpEccSyndromes),
_("<span %s>%" PRId64 " good, %" PRId64 " bad; %" PRId64 " bad sub blocks</span>"), _("<span %s>%" PRId64 " good, %" PRId64 " bad; %" PRId64 " bad sub blocks</span>"),
@@ -660,7 +660,7 @@ static int check_syndromes(verify_closure *vc)
void RS03Verify(Image *image) void RS03Verify(Image *image)
{ Method *self = FindMethod("RS03"); { Method *self = FindMethod("RS03");
verify_closure *vc = g_malloc0(sizeof(verify_closure)); verify_closure *vc = g_malloc0(sizeof(verify_closure));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
RS03Widgets *wl = self->widgetList; RS03Widgets *wl = self->widgetList;
#endif #endif
EccHeader *eh = NULL; EccHeader *eh = NULL;
@@ -683,12 +683,12 @@ void RS03Verify(Image *image)
char *unstable=""; char *unstable="";
char method[5]; char method[5];
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
char *img_advice = NULL; char *img_advice = NULL;
char *ecc_advice = NULL; char *ecc_advice = NULL;
#endif #endif
char *version; char *version;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
int syn_error = 0; int syn_error = 0;
int try_it; int try_it;
#endif #endif
@@ -699,7 +699,7 @@ void RS03Verify(Image *image)
RegisterCleanup(_("Check aborted"), cleanup, vc); RegisterCleanup(_("Check aborted"), cleanup, vc);
vc->image = image; vc->image = image;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
vc->wl = wl; vc->wl = wl;
#endif #endif
@@ -722,7 +722,7 @@ void RS03Verify(Image *image)
else /* may only happen when ecc file is present */ else /* may only happen when ecc file is present */
{ PrintLog("\n%s not present.\n", Closure->imageName); { PrintLog("\n%s not present.\n", Closure->imageName);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL); SwitchAndSetFootline(wl->cmpImageNotebook, 0, NULL, NULL);
#endif #endif
@@ -730,7 +730,7 @@ void RS03Verify(Image *image)
if(eh->methodFlags[0] & MFLAG_ECC_FILE) if(eh->methodFlags[0] & MFLAG_ECC_FILE)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Checking the image and error correction files."), _("Checking the image and error correction files."),
@@ -741,7 +741,7 @@ void RS03Verify(Image *image)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>", SetLabelText(GTK_LABEL(wl->cmpHeadline), "<big>%s</big>\n<i>%s</i>",
_("Checking the image file."), _("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."), else msg = g_strdup_printf(_("Ecc file is %" PRId64 " sectors longer than expected."),
eccfile_sectors - expected_eccfile_sectors); eccfile_sectors - expected_eccfile_sectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
ecc_advice = g_strdup_printf("<span %s>%s</span>", Closure->redMarkup, msg); ecc_advice = g_strdup_printf("<span %s>%s</span>", Closure->redMarkup, msg);
#endif #endif
@@ -791,7 +791,7 @@ void RS03Verify(Image *image)
PrintLog(_("- type : Error correction file\n")); PrintLog(_("- type : Error correction file\n"));
else PrintLog(_("- type : Augmented image\n")); else PrintLog(_("- type : Augmented image\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(eh->methodFlags[0] & MFLAG_ECC_FILE) { if(eh->methodFlags[0] & MFLAG_ECC_FILE)
SetLabelText(GTK_LABEL(wl->cmpEccType), _("Error correction file")); SetLabelText(GTK_LABEL(wl->cmpEccType), _("Error correction file"));
@@ -807,7 +807,7 @@ void RS03Verify(Image *image)
method, eh->eccBytes, method, eh->eccBytes,
((double)eh->eccBytes*100.0)/(double)eh->dataBytes); ((double)eh->eccBytes*100.0)/(double)eh->dataBytes);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"), SetLabelText(GTK_LABEL(wl->cmpEccMethod), _("%4s, %d roots, %4.1f%% redundancy"),
method, eh->eccBytes, method, eh->eccBytes,
@@ -830,7 +830,7 @@ void RS03Verify(Image *image)
PrintLog(format, _("- created by : dvdisaster"), major, minor, micro, unstable); PrintLog(format, _("- created by : dvdisaster"), major, minor, micro, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format, { SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format,
"dvdisaster", major, minor, micro, unstable); "dvdisaster", major, minor, micro, unstable);
@@ -842,7 +842,7 @@ void RS03Verify(Image *image)
PrintLog(format, _("- created by : dvdisaster"), major, minor, unstable); PrintLog(format, _("- created by : dvdisaster"), major, minor, unstable);
PrintLog("\n"); PrintLog("\n");
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format, SetLabelText(GTK_LABEL(wl->cmpEccCreatedBy), format,
"dvdisaster", major, minor, unstable); "dvdisaster", major, minor, unstable);
@@ -863,7 +863,7 @@ void RS03Verify(Image *image)
if(Closure->version >= eh->neededVersion) if(Closure->version >= eh->neededVersion)
{ PrintLog(_("- requires : dvdisaster-%s\n"), version); { PrintLog(_("- requires : dvdisaster-%s\n"), version);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%s", version); SetLabelText(GTK_LABEL(wl->cmpEccRequires), "dvdisaster-%s", version);
#endif #endif
@@ -874,7 +874,7 @@ void RS03Verify(Image *image)
"* : Please visit http://www.dvdisaster.org for an upgrade.\n"), "* : Please visit http://www.dvdisaster.org for an upgrade.\n"),
version); version);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccRequires), { SetLabelText(GTK_LABEL(wl->cmpEccRequires),
"<span %s>dvdisaster-%s</span>", "<span %s>dvdisaster-%s</span>",
@@ -897,7 +897,7 @@ void RS03Verify(Image *image)
PrintLog(_("- data md5sum : %s\n"),hdr_digest); PrintLog(_("- data md5sum : %s\n"),hdr_digest);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccDataCrcVal), "%s", hdr_digest); SetLabelText(GTK_LABEL(wl->cmpEccDataCrcVal), "%s", hdr_digest);
#endif #endif
@@ -909,7 +909,7 @@ void RS03Verify(Image *image)
{ if(image->fpState != FP_PRESENT) { if(image->fpState != FP_PRESENT)
{ PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n")); { PrintLog(_("* fingerprint match: NOT POSSIBLE - related sector is missing in image!\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup); SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("<span %s>missing sector prevents calculation</span>"), Closure->redMarkup);
#endif #endif
@@ -919,7 +919,7 @@ void RS03Verify(Image *image)
if(memcmp(image->imageFP, eh->mediumFP, 16)) if(memcmp(image->imageFP, eh->mediumFP, 16))
{ PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n")); { PrintLog(_("* fingerprint match: MISMATCH - .iso and .ecc don't belong together!\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), { SetLabelText(GTK_LABEL(wl->cmpEccFingerprint),
_("<span %s>mismatch</span>"), Closure->redMarkup); _("<span %s>mismatch</span>"), Closure->redMarkup);
@@ -931,7 +931,7 @@ void RS03Verify(Image *image)
} }
else else
{ PrintLog(_("- fingerprint match: good\n")); { PrintLog(_("- fingerprint match: good\n"));
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good")); SetLabelText(GTK_LABEL(wl->cmpEccFingerprint), _("good"));
#endif #endif
@@ -942,7 +942,7 @@ void RS03Verify(Image *image)
/* print advice collected from above tests */ /* print advice collected from above tests */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(ecc_advice) { if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", 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(expected_image_sectors == image->sectorSize && matching_byte_size)
{ if(lay->target == ECC_FILE) { if(lay->target == ECC_FILE)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(image->inLast == 2048) { if(image->inLast == 2048)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " in image; %" PRId64 " in ecc file"), SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " in image; %" PRId64 " in ecc file"),
@@ -1004,7 +1004,7 @@ void RS03Verify(Image *image)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " total / %" PRId64 " data"), SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("%" PRId64 " total / %" PRId64 " data"),
image->sectorSize, lay->dataSectors); image->sectorSize, lay->dataSectors);
@@ -1024,7 +1024,7 @@ void RS03Verify(Image *image)
expected_size = g_strdup_printf("%lld", (long long int)expected_image_sectors); 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); 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) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("<span %s>%s (%s expected)</span>"), { SetLabelText(GTK_LABEL(wl->cmpImageSectors), _("<span %s>%s (%s expected)</span>"),
Closure->redMarkup, image_size, expected_size); Closure->redMarkup, image_size, expected_size);
@@ -1089,7 +1089,7 @@ void RS03Verify(Image *image)
/* Check for user interruption */ /* Check for user interruption */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
{ if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */ { if(Closure->stopActions == STOP_CURRENT_ACTION) /* suppress memleak warning when closing window */
SetLabelText(GTK_LABEL(wl->cmpImageResult), SetLabelText(GTK_LABEL(wl->cmpImageResult),
@@ -1211,7 +1211,7 @@ void RS03Verify(Image *image)
if(!defective) if(!defective)
SetBit(vc->map, s); SetBit(vc->map, s);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ /* data part / spiral animation */ { /* data part / spiral animation */
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/virtual_expected; percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/virtual_expected;
@@ -1226,7 +1226,7 @@ void RS03Verify(Image *image)
if(last_percent != percent) /* Update sector results */ if(last_percent != percent) /* Update sector results */
{ PrintProgress(_("- testing sectors : %3d%%") ,percent); { PrintProgress(_("- testing sectors : %3d%%") ,percent);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(lay->target == ECC_IMAGE) { if(lay->target == ECC_IMAGE)
{ add_verify_values(self, percent, new_missing, new_crc_errors); { 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) if(lay->target == ECC_FILE && s == lay->dataSectors-1)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ /* flush/complete spiral */ { /* flush/complete spiral */
add_verify_values(self, VERIFY_IMAGE_SEGMENTS, new_missing, new_crc_errors); add_verify_values(self, VERIFY_IMAGE_SEGMENTS, new_missing, new_crc_errors);
@@ -1283,7 +1283,7 @@ void RS03Verify(Image *image)
/* Complete damage summary */ /* Complete damage summary */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(data_missing || data_crc_errors) { if(data_missing || data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection), SetLabelText(GTK_LABEL(wl->cmpDataSection),
@@ -1334,7 +1334,7 @@ void RS03Verify(Image *image)
PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing); PrintLog(_(" ... ecc section : %" PRId64 " sectors missing\n"), ecc_missing);
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(!data_missing && !data_crc_errors) { if(!data_missing && !data_crc_errors)
SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete")); SetLabelText(GTK_LABEL(wl->cmpDataSection), _("complete"));
@@ -1348,7 +1348,7 @@ void RS03Verify(Image *image)
/*** Test error syndromes */ /*** Test error syndromes */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ SetLabelText(GTK_LABEL(wl->cmpEccSynLabel), _("Ecc block test:")); { SetLabelText(GTK_LABEL(wl->cmpEccSynLabel), _("Ecc block test:"));
SetLabelText(GTK_LABEL(wl->cmpEccSyndromes), ""); SetLabelText(GTK_LABEL(wl->cmpEccSyndromes), "");
@@ -1356,7 +1356,7 @@ void RS03Verify(Image *image)
#endif #endif
if(0&&total_missing + data_crc_errors != 0) if(0&&total_missing + data_crc_errors != 0)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(GTK_LABEL(wl->cmpEccSyndromes), SetLabelText(GTK_LABEL(wl->cmpEccSyndromes),
_("<span %s>Skipped; not useful on known defective image</span>"), _("<span %s>Skipped; not useful on known defective image</span>"),
@@ -1367,7 +1367,7 @@ void RS03Verify(Image *image)
} }
else else
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
syn_error = syn_error =
#endif #endif
check_syndromes(vc); check_syndromes(vc);
@@ -1375,7 +1375,7 @@ void RS03Verify(Image *image)
/*** Print image advice */ /*** Print image advice */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ {
if(img_advice) if(img_advice)
@@ -1397,12 +1397,12 @@ void RS03Verify(Image *image)
/*** Print final results */ /*** Print final results */
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
try_it = try_it =
#endif #endif
prognosis(vc, total_missing+data_crc_errors, lay->totalSectors); prognosis(vc, total_missing+data_crc_errors, lay->totalSectors);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
{ if(total_missing || data_crc_errors) { if(total_missing || data_crc_errors)
{ if(try_it) SetLabelText(GTK_LABEL(wl->cmpImageResult), { if(try_it) SetLabelText(GTK_LABEL(wl->cmpImageResult),

View File

@@ -2206,7 +2206,7 @@ int TestUnitReady(DeviceHandle *dh)
if(SendPacket(dh, cmd, 6, NULL, 0, &dh->sense, DATA_NONE) != -1) if(SendPacket(dh, cmd, 6, NULL, 0, &dh->sense, DATA_NONE) != -1)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(Closure->status, ""); SetLabelText(Closure->status, "");
#endif #endif
@@ -2227,7 +2227,7 @@ int TestUnitReady(DeviceHandle *dh)
{ PrintCLIorLabel(STATUS_LABEL_OR_NULL, { PrintCLIorLabel(STATUS_LABEL_OR_NULL,
_("Waiting 10 seconds for drive: %d\n"),9-i); _("Waiting 10 seconds for drive: %d\n"),9-i);
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
return FALSE; return FALSE;
#endif #endif
@@ -2240,7 +2240,7 @@ int TestUnitReady(DeviceHandle *dh)
break; /* Something is wrong with the drive */ break; /* Something is wrong with the drive */
} }
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->guiMode) if(Closure->guiMode)
SetLabelText(Closure->status, ""); SetLabelText(Closure->status, "");
#endif #endif
@@ -2496,7 +2496,7 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
if(status) /* current try was unsuccessful */ if(status) /* current try was unsuccessful */
{ int last_key, last_asc, last_ascq; { int last_key, last_asc, last_ascq;
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) /* user break */ if(Closure->stopActions) /* user break */
return status; return status;
#endif #endif

View File

@@ -365,7 +365,7 @@ static IsoInfo* examine_iso(Image *image)
for(sector=16; sector<32; sector++) for(sector=16; sector<32; sector++)
{ {
#ifndef CLI #ifndef WITH_CLI_ONLY_YES
if(Closure->stopActions) if(Closure->stopActions)
continue; continue;
#endif #endif