Apply (most) debian patches
Apply debian patch 02-encryption Apply debian patch 03-dvdrom Apply a modified version of patch 05-help-dialog Apply debian patch 08-fix-gnu-make-detection Apply debian patch 10-use-non-size-specific-icon-and-add-keywords-to-desktop-file Apply debian patch 12-fix-spelling-of-up-to Apply debian patch 13-fix-missing-language-field-in-po-files Apply a modified version of debian patch 14-make-builds-reproducible Apply debian patch 17-fix-all-but-deprecated-api-warnings Apply a modified version of debian patch 18-update-copyright-in-about-dialog Apply debian patch 19-show-text-files-with-abs-path Apply debian patch 22-fix-hurd-i386-ftbfs Apply debian patch 23-add-bdrom-support Apply debian patch 25-fix-man-pages Apply debian patch 27-allow-opening-in-browser-again Apply debian patch 28-pdftex-reproducibility Apply debian patch 29-fix-more-typos Apply debian patch 30-hurd-kfreebsd-ftbfs Apply debian patch 31-improve-hurd-and-kfreebsd-support Apply debian patch 33-honour-LDFLAGS Apply debian patch 34-gcc8-format-security.patch Apply debian patch 35-archived-homepage Apply debian patch 36-fix-parallelism
This commit is contained in:
@@ -138,7 +138,7 @@ untranslated:
|
||||
@$(MAKE) --no-print-directory -C locale check-untranslated
|
||||
|
||||
simple-md5sum: md5.c
|
||||
@$(CC) $(COPTS) $(MUDFLAP_CFLAGS) -DSIMPLE_MD5SUM md5.c $(MUDFLAP_LFLAGS) $(MUDFLAP_LIBS) -o simple-md5sum
|
||||
@$(CC) $(COPTS) $(MUDFLAP_CFLAGS) -DSIMPLE_MD5SUM md5.c $(LDFLAGS) $(MUDFLAP_LFLAGS) $(MUDFLAP_LIBS) -o simple-md5sum
|
||||
|
||||
version.tex:
|
||||
@echo "\\newcommand{\\projectversion}{$(VERSION)}" >$(SRCDIR)/documentation/config/version.tex
|
||||
@@ -239,9 +239,9 @@ install: dvdisaster manual
|
||||
install -d $(BUILDROOT)$(MANDIR)/de/man1
|
||||
cd documentation; \
|
||||
ESCAPED_DOCSUBDIR=`echo $(DOCSUBDIR) | sed -e 's/\//\\\\\//g'`; \
|
||||
sed "s/%docdir%/$$ESCAPED_DOCSUBDIR\/html/" <dvdisaster.en.1 >dvdisaster.updated; \
|
||||
sed "s/%docdir%/$$ESCAPED_DOCSUBDIR/" <dvdisaster.en.1 >dvdisaster.updated; \
|
||||
install -m 644 dvdisaster.updated $(BUILDROOT)$(MANDIR)/man1/dvdisaster.1; \
|
||||
sed "s/%docdir%/$$ESCAPED_DOCSUBDIR\/html/" <dvdisaster.de.1 >dvdisaster.updated; \
|
||||
sed "s/%docdir%/$$ESCAPED_DOCSUBDIR/" <dvdisaster.de.1 >dvdisaster.updated; \
|
||||
install -m 644 dvdisaster.updated $(BUILDROOT)$(MANDIR)/de/man1/dvdisaster.1; \
|
||||
rm dvdisaster.updated
|
||||
if echo $(WITH_OPTIONS) | grep "NLS_YES" >/dev/null; then \
|
||||
@@ -313,6 +313,7 @@ clean:
|
||||
@rm -f simple-md5sum
|
||||
@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/codec-specs clean;
|
||||
@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/user-manual clean;
|
||||
@$(MAKE) --no-print-directory -C $(SRCDIR)/locale clean;
|
||||
|
||||
BUILD=`grep BUILD $(SRCDIR)/build.h | cut -d ' ' -f 3`
|
||||
arch: archclean time-stamp
|
||||
|
||||
2
build.c
2
build.c
@@ -25,4 +25,4 @@
|
||||
/* build is incremented at each make;
|
||||
make recompile of dependent file as fast as possible */
|
||||
|
||||
int buildCount = BUILD;
|
||||
const char *const buildCount = BUILD;
|
||||
|
||||
16
cacheprobe.c
16
cacheprobe.c
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "dvdisaster.h"
|
||||
|
||||
#ifdef SYS_LINUX
|
||||
#if defined(SYS_LINUX)
|
||||
|
||||
int ProbeCacheLineSize()
|
||||
{ int cl_size = 0;
|
||||
|
||||
@@ -36,9 +37,9 @@ int ProbeCacheLineSize()
|
||||
|
||||
return cl_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYS_FREEBSD
|
||||
#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
int ProbeCacheLineSize()
|
||||
@@ -52,9 +53,9 @@ int ProbeCacheLineSize()
|
||||
|
||||
return cl_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYS_NETBSD
|
||||
#elif defined(SYS_NETBSD)
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
int ProbeCacheLineSize()
|
||||
@@ -68,13 +69,14 @@ int ProbeCacheLineSize()
|
||||
|
||||
return cl_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYS_UNKNOWN
|
||||
#else /* SYS_UNKNOWN and others. */
|
||||
|
||||
int ProbeCacheLineSize()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
13
closure.c
13
closure.c
@@ -50,7 +50,8 @@ static void get_base_dirs()
|
||||
/*** Otherwise try the installation directory.
|
||||
On Unices this is a hardcoded directory. */
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD) || defined(SYS_UNKNOWN)
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD) || defined(SYS_UNKNOWN)
|
||||
if(DirStat(BINDIR))
|
||||
Closure->binDir = g_strdup(BINDIR);
|
||||
|
||||
@@ -198,8 +199,7 @@ void ReadDotfile()
|
||||
/* Get first MAX_LINE_LEN bytes of line, discard the rest */
|
||||
|
||||
line[MAX_LINE_LEN-1] = 1;
|
||||
if (fgets(line, MAX_LINE_LEN, dotfile) == NULL)
|
||||
break;
|
||||
if (!fgets(line, MAX_LINE_LEN, dotfile)) break;
|
||||
if(!line[MAX_LINE_LEN-1]) /* line longer than buffer */
|
||||
while(!feof(dotfile) && fgetc(dotfile) != '\n')
|
||||
;
|
||||
@@ -439,7 +439,8 @@ void InitClosure()
|
||||
|
||||
/* Generate a more comprehensive version string */
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
#ifdef HAVE_64BIT
|
||||
#define BITNESS_STRING " 64bit"
|
||||
#else
|
||||
@@ -449,7 +450,7 @@ void InitClosure()
|
||||
#define BITNESS_STRING ""
|
||||
#endif
|
||||
|
||||
Closure->versionString = g_strdup_printf("dvdisaster %s build %d, %s%s",
|
||||
Closure->versionString = g_strdup_printf("dvdisaster %s build %s, %s%s",
|
||||
Closure->cookedVersion, buildCount, SYS_NAME, BITNESS_STRING);
|
||||
|
||||
/* Replace the dot with a locale-resistant separator */
|
||||
@@ -481,6 +482,7 @@ void InitClosure()
|
||||
Closure->deviceNames = g_ptr_array_new();
|
||||
Closure->deviceNodes = g_ptr_array_new();
|
||||
Closure->viewer = g_strdup("xdg-open");
|
||||
Closure->browser = g_strdup("xdg-open");
|
||||
Closure->methodList = g_ptr_array_new();
|
||||
Closure->methodName = g_strdup("RS01");
|
||||
Closure->dDumpDir = g_strdup(Closure->homeDir);
|
||||
@@ -601,6 +603,7 @@ void FreeClosure()
|
||||
cond_free(Closure->binDir);
|
||||
cond_free(Closure->docDir);
|
||||
cond_free(Closure->viewer);
|
||||
cond_free(Closure->browser);
|
||||
cond_free(Closure->errorTitle);
|
||||
cond_free(Closure->simulateCD);
|
||||
cond_free(Closure->dDumpDir);
|
||||
|
||||
@@ -6,7 +6,8 @@ Comment=Additional error protection for CD/DVD media
|
||||
Comment[cs]=Přídavná ochrana pro média CD/DVD
|
||||
Comment[de]=Zusätzliche Fehlerkorrektur für CD/DVD
|
||||
Exec=dvdisaster
|
||||
Icon=dvdisaster48.png
|
||||
Icon=dvdisaster
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Application;System;
|
||||
Keywords=CD;DVD;media;data loss;scratch;aging;error;protection;recovery;
|
||||
|
||||
@@ -44,7 +44,7 @@ correction files must be protected with an image level
|
||||
error correction layer (by using RS01,RS02 or RS03 on the medium),
|
||||
since only image level error correction avoids meta
|
||||
data sectors to become a single point of failure. See the
|
||||
discussion at \url{http://dvdisaster.net/en/qa32.html} for
|
||||
discussion at \url{https://web.archive.org/web/20180428070843/http://dvdisaster.net/en/qa32.html} for
|
||||
more information on the advantages of image level data protection
|
||||
over file level approaches.
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ the parity data portion of the image might not be written to the medium.
|
||||
Most current writing programs do however measure the .iso image by examining
|
||||
its file size, and will transfer the parity data correctly. To be sure you
|
||||
should follow the steps described under ``Testing image compatibility''
|
||||
at the dvdisaster site (\url{http://dvdisaster.net/en/howtos92.html}) once
|
||||
at the dvdisaster site (\url{https://web.archive.org/web/20180428070843/http://dvdisaster.net/en/howtos92.html}) once
|
||||
before using each version of your optical media authoring software.
|
||||
|
||||
Like the other dvdisaster codecs, RS02 is based on a RS(255,k) Reed-Solomon code
|
||||
|
||||
@@ -63,7 +63,7 @@ Carsten Gnörlich (Anschrift wie oben).
|
||||
Das Impressum gilt für die Internetpräsenz unter den Domänen<br>
|
||||
<a href="http://dvdisaster.com">dvdisaster.com</a>,
|
||||
<a href="http://dvdisaster.de">dvdisaster.de</a>,
|
||||
<a href="http://dvdisaster.net">dvdisaster.net</a>,
|
||||
<a href="https://web.archive.org/web/20180428070843/http://dvdisaster.net">dvdisaster.net</a>,
|
||||
<a href="http://dvdisaster.org">dvdisaster.org</a>.
|
||||
|
||||
<!-- Page footer -->
|
||||
|
||||
@@ -63,7 +63,7 @@ Carsten Gnörlich (see above for address).
|
||||
This notice covers the web sites under the domains<br>
|
||||
<a href="http://dvdisaster.com">dvdisaster.com</a>,
|
||||
<a href="http://dvdisaster.de">dvdisaster.de</a>,
|
||||
<a href="http://dvdisaster.net">dvdisaster.net</a>,
|
||||
<a href="https://web.archive.org/web/20180428070843/http://dvdisaster.net">dvdisaster.net</a>,
|
||||
<a href="http://dvdisaster.org">dvdisaster.org</a>.<br>
|
||||
|
||||
<!-- Page footer -->
|
||||
|
||||
@@ -272,7 +272,7 @@ media with augmented images may not play correctly on all units \\
|
||||
\end{tabular}
|
||||
|
||||
\paragraph{Further reading.} The specification for the dvdisaster codecs
|
||||
has been specified in a separate document called \href{http://dvdisaster.net/downloads/codecs.pdf}{codecs.pdf}.
|
||||
has been specified in a separate document called \href{https://web.archive.org/web/20180428070843/http://dvdisaster.net/downloads/codecs.pdf}{codecs.pdf}.
|
||||
Good knowledge in coding theory and programming is required.
|
||||
|
||||
\subsection{The linear reading strategy}
|
||||
|
||||
@@ -15,7 +15,7 @@ the \href{http://www.gnu.org/licenses/gpl-3.0.txt}{GNU General Public License v3
|
||||
|
||||
\bigskip
|
||||
|
||||
The dvdisaster developer site (\url{http://dvdisaster.net}) contains
|
||||
The dvdisaster developer site (\url{https://web.archive.org/web/20180428070843/http://dvdisaster.net}) contains
|
||||
the latest source code releases for the FreeBSD, GNU/Linux and NetBSD
|
||||
operating systems. These are mostly aimed at maintainers of binary packages for
|
||||
the beforementioned platforms. As an end user you might find it more convenient
|
||||
@@ -133,6 +133,6 @@ We cannot accept them for various reasons.
|
||||
\smallskip
|
||||
|
||||
dvdisaster releases are always published with cryptographic signatures
|
||||
and md5 checksums. See the \href{http://dvdisaster.net}{download site} for examples.
|
||||
and md5 checksums. See the \href{https://web.archive.org/web/20180428070843/http://dvdisaster.net}{download site} for examples.
|
||||
Be very cautious if signatures and checksums are missing, invalid or not
|
||||
matching those published at the sites mentioned above.
|
||||
|
||||
@@ -1822,7 +1822,7 @@ process of creating error correction files using these options. The
|
||||
first option marked green lets dvdisaster create the error correction
|
||||
file immediately after the medium has been (completely) read.
|
||||
The second option marked green deletes the image when the error correction
|
||||
file has been sucessfully created.
|
||||
file has been successfully created.
|
||||
|
||||
\bigskip
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
\fancyfoot{}
|
||||
\fancyfoot[LE,RO]{page \thepage\ of \pageref{LastPage}}
|
||||
|
||||
\pdftrailerid{dvdisaster}
|
||||
\pdfsuppressptexinfo=-1
|
||||
\begin{document}
|
||||
|
||||
\definecolor{lightorange}{RGB}{255,224,150}
|
||||
|
||||
@@ -237,6 +237,7 @@ typedef struct _GlobalClosure
|
||||
char *binDir; /* place where the binary resides */
|
||||
char *docDir; /* place where our documentation resides */
|
||||
char *viewer; /* Name of preferred PDF viewer */
|
||||
char *browser; /* Name of preferred browser */
|
||||
|
||||
GMutex progressLock; /* A mutex protected the stuff below */
|
||||
char bs[256]; /* A string of 255 backspace characters */
|
||||
@@ -477,7 +478,7 @@ void FreeBitmap(Bitmap*);
|
||||
*** build.h
|
||||
***/
|
||||
|
||||
int buildCount;
|
||||
extern const char *const buildCount;
|
||||
|
||||
/***
|
||||
*** cacheprobe.h
|
||||
@@ -1394,6 +1395,12 @@ int ProbeAltiVec(void);
|
||||
|
||||
void ShowPDF(char*);
|
||||
|
||||
/***
|
||||
*** show-html.c
|
||||
***/
|
||||
|
||||
void ShowHTML(char*);
|
||||
|
||||
/***
|
||||
*** smart-lec.c
|
||||
***/
|
||||
|
||||
@@ -424,6 +424,24 @@ char *find_file(char *file, size_t *size, char *lang)
|
||||
lang_suffix[1] = lang[1];
|
||||
}
|
||||
|
||||
/* Test for absolute path first. */
|
||||
if(*file == '/')
|
||||
{
|
||||
if(lang)
|
||||
path = g_strdup_printf("%s.%s", file, lang_suffix);
|
||||
else
|
||||
path = g_strdup(file);
|
||||
|
||||
if(LargeStat(path, &stat_size))
|
||||
{
|
||||
*size = stat_size;
|
||||
return path;
|
||||
}
|
||||
|
||||
g_free(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Try file in bin dir */
|
||||
|
||||
if(Closure->binDir)
|
||||
@@ -583,6 +601,7 @@ static gint about_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
if(!inside) return FALSE; /* Defect in certain Gtk versions? */
|
||||
if(!strcmp(label,"GPL")) ShowGPL();
|
||||
else if(!strcmp(label,"MODIFYING")) show_modifying();
|
||||
else if(strlen(label) > 4 && !strncmp(label, "http", 4)) ShowHTML(g_strdup(label));
|
||||
else ShowPDF(g_strdup(label));
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
@@ -725,7 +744,9 @@ void AboutDialog()
|
||||
|
||||
#ifdef MODIFIED_SOURCE
|
||||
AboutTextWithLink(vbox,
|
||||
_("Modified version Copyright 2017 (please fill in - [directions])\n"
|
||||
_("[Modified version]\n"
|
||||
"Copyright 2019-2020 Stephane Lesimple\n"
|
||||
"Copyright 2005-2017 Debian Optical Media Tools Team\n"
|
||||
"Copyright 2004-2017 Carsten Gnoerlich"),
|
||||
"MODIFYING");
|
||||
#else
|
||||
@@ -747,11 +768,12 @@ void AboutDialog()
|
||||
"GPL");
|
||||
|
||||
#ifdef MODIFIED_SOURCE
|
||||
AboutTextWithLink(vbox, _("\nThis program is <b>not the original</b>. It is based on the\n"
|
||||
"source code of dvdisaster, but contains third-party changes.\n\n"
|
||||
"Please do not bother the original authors of dvdisaster\n"
|
||||
"([www.dvdisaster.org]) about issues with this version.\n"),
|
||||
"http://www.dvdisaster.org");
|
||||
AboutTextWithLink(vbox, _("\nThis version is <b>not the original</b>. It has been patched\n"
|
||||
"for Debian to support DVD-ROMs (with and without encryption),"
|
||||
"and subsequently patched again to support a CLI-only build, among other things.\n\n"
|
||||
"Please do not bother the original authors of dvdisaster or the Debian maintainer\n"
|
||||
"but submit bugreports against GitHun instead.\n"),
|
||||
"https://github.com/speed47/dvdisaster");
|
||||
|
||||
#else
|
||||
lang = g_getenv("LANG");
|
||||
|
||||
@@ -30,15 +30,19 @@ locale: \$(LOCALEFILES)
|
||||
|
||||
# Create the locale files.
|
||||
|
||||
messages.pot: \$(CFILES)
|
||||
@cd ..; xgettext --no-wrap -cTRANSLATORS: -o locale/messages.pot -k_ -k_utf \$(CFILES_NP)
|
||||
|
||||
clean:
|
||||
rm -f messages.pot
|
||||
|
||||
EOF
|
||||
|
||||
for i in $prefixes; do
|
||||
cat >> Makefile <<EOF
|
||||
$i.po: \$(CFILES)
|
||||
$i.po: messages.pot
|
||||
@echo "Updating $i.po"
|
||||
@cd ..; xgettext --no-wrap -cTRANSLATORS: -o locale/messages.pot -k_ -k_utf \$(CFILES_NP)
|
||||
@msgmerge -q -U --no-wrap --no-fuzzy-matching $i.po messages.pot
|
||||
@rm -f messages.pot
|
||||
|
||||
$i/LC_MESSAGES/dvdisaster.mo: $i.po
|
||||
@echo "Updating $i.mo"
|
||||
|
||||
@@ -1901,7 +1901,7 @@ msgid "Media ejection"
|
||||
msgstr "Vysunutí disku"
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr "Po úspěšném načtení vysunout disk"
|
||||
|
||||
#: preferences.c:2092
|
||||
@@ -6646,11 +6646,11 @@ msgstr "<i>Novinky v této verzi:</i>"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster version %s build %d\n"
|
||||
#~ "dvdisaster version %s build %s\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster verze %s sestavení %d\n"
|
||||
#~ "dvdisaster verze %s sestavení %s\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid "--prefetch-sectors must be in range 32...8096"
|
||||
|
||||
@@ -1900,7 +1900,7 @@ msgid "Media ejection"
|
||||
msgstr "Datenträger auswerfen"
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr "Datenträger nach erfolgreichem Lesen auswerfen"
|
||||
|
||||
#: preferences.c:2092
|
||||
|
||||
@@ -1753,7 +1753,7 @@ msgid "Media ejection"
|
||||
msgstr ""
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr ""
|
||||
|
||||
#: preferences.c:2092
|
||||
|
||||
@@ -11,7 +11,7 @@ msgstr ""
|
||||
"PO-Revision-Date: 2010-06-09 11:13+0200\n"
|
||||
"Last-Translator: cg <cg@dvdisaster.org>\n"
|
||||
"Language-Team: Portuguese\n"
|
||||
"Language: \n"
|
||||
"Language: pt_BR\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -1841,7 +1841,7 @@ msgid "Media ejection"
|
||||
msgstr "Ejeção da mídia"
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr "Ejetar mídia após uma leitura completa"
|
||||
|
||||
#: preferences.c:2092
|
||||
@@ -6355,11 +6355,11 @@ msgstr "<i>Novidades dessa versão:</i>"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster version %s build %d\n"
|
||||
#~ "dvdisaster version %s build %s\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster, versão %s build %d\n"
|
||||
#~ "dvdisaster, versão %s build %s\n"
|
||||
|
||||
#~ msgid "--cache-size maximum is 8192MB."
|
||||
#~ msgstr "--cache-size máximo é 8192MB."
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"PO-Revision-Date: 2009-07-23 08:11+0300\n"
|
||||
"Last-Translator: Igor Gorbounov <igor.gorbounov@gmail.com>\n"
|
||||
"Language-Team: Russian\n"
|
||||
"Language: \n"
|
||||
"Language: ru\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -1843,7 +1843,7 @@ msgid "Media ejection"
|
||||
msgstr "Извлечь носитель"
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr "Извлечь носитель после успешного чтения"
|
||||
|
||||
#: preferences.c:2092
|
||||
@@ -6373,11 +6373,11 @@ msgstr "<i>Новое в этой версии:</i>"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster version %s build %d\n"
|
||||
#~ "dvdisaster version %s build %s\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "\n"
|
||||
#~ "dvdisaster версия %s сборка %d\n"
|
||||
#~ "dvdisaster версия %s сборка %s\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid "--cache-size maximum is 8192MB."
|
||||
|
||||
@@ -1758,7 +1758,7 @@ msgid "Media ejection"
|
||||
msgstr ""
|
||||
|
||||
#: preferences.c:2065 preferences.c:2066
|
||||
msgid "Eject medium after sucessful read"
|
||||
msgid "Eject medium after successful read"
|
||||
msgstr ""
|
||||
|
||||
#: preferences.c:2092
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/***
|
||||
*** Forward declarations
|
||||
***/
|
||||
@@ -415,7 +419,7 @@ void set_path(GtkWidget *entry, char *path)
|
||||
else
|
||||
{ char buf[PATH_MAX + strlen(path) + 2];
|
||||
|
||||
if (getcwd(buf, PATH_MAX) == NULL) return;
|
||||
if (!getcwd(buf, PATH_MAX)) return;
|
||||
strcat(buf,"/");
|
||||
|
||||
strcat(buf,path);
|
||||
|
||||
@@ -2062,8 +2062,8 @@ void CreatePreferencesWindow(void)
|
||||
frame = gtk_frame_new(_utf("Media ejection"));
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
lwoh = CreateLabelWithOnlineHelp(_("Eject medium after sucessful read"),
|
||||
_("Eject medium after sucessful read"));
|
||||
lwoh = CreateLabelWithOnlineHelp(_("Eject medium after successful read"),
|
||||
_("Eject medium after successful read"));
|
||||
RegisterPreferencesHelpWindow(lwoh);
|
||||
|
||||
for(i=0; i<2; i++)
|
||||
|
||||
@@ -1323,7 +1323,7 @@ if try "reading medium w/ ecc in 3 passes; 3rd pass recovers some" read_multipas
|
||||
run_regtest read_multipass_ecc_partial_success "--read-medium=3 --spinup-delay=0 -r" $TMPISO $TMPECC
|
||||
fi
|
||||
|
||||
# Do a second sucessful read attempt at an incomplete image;
|
||||
# Do a second successful read attempt at an incomplete image;
|
||||
# see whether correct results are reported when ecc data is present
|
||||
# since CRC caching is a bit complicated in this case.
|
||||
|
||||
|
||||
@@ -31,24 +31,27 @@
|
||||
|
||||
//#define VERBOSE 1
|
||||
#ifdef VERBOSE
|
||||
#define verbose(format,args...) printf(format, ## args)
|
||||
#define verbose(format,...) printf(format, __VA_ARGS__)
|
||||
#else
|
||||
#define verbose(format,args...)
|
||||
#define verbose(format,...)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifdef SYS_LINUX
|
||||
#if defined(SYS_LINUX)
|
||||
|
||||
#define MMAP_FLAGS (MAP_SHARED | MAP_POPULATE | MAP_NORESERVE)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_FREEBSD
|
||||
#elif defined(SYS_FREEBSD)
|
||||
|
||||
#define MMAP_FLAGS (MAP_SHARED | MAP_PREFAULT_READ)
|
||||
#endif
|
||||
|
||||
#ifdef SYS_NETBSD
|
||||
#else
|
||||
|
||||
/* SYS_NETBSD and others. */
|
||||
#define MMAP_FLAGS (MAP_SHARED)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -741,7 +744,7 @@ static void flush_crc(ecc_closure *ec, LargeFile *file_out)
|
||||
|
||||
/* Write out the CRC layer */
|
||||
|
||||
verbose("IO: writing CRC layer\n");
|
||||
verbose("%s", "IO: writing CRC layer\n");
|
||||
crc_sect = 2048*(ec->encoderChunk+lay->firstCrcPos);
|
||||
if(!LargeSeek(file_out, crc_sect))
|
||||
{ ec->abortImmediately = TRUE;
|
||||
@@ -762,7 +765,7 @@ static void flush_parity(ecc_closure *ec, LargeFile *file_out)
|
||||
|
||||
/* Write out the created parity. */
|
||||
|
||||
verbose("IO: writing parity...\n");
|
||||
verbose("%s", "IO: writing parity...\n");
|
||||
for(k=0; k<lay->nroots; k++)
|
||||
{ gint64 idx=0;
|
||||
|
||||
@@ -779,7 +782,7 @@ static void flush_parity(ecc_closure *ec, LargeFile *file_out)
|
||||
}
|
||||
}
|
||||
}
|
||||
verbose("IO: parity written.\n");
|
||||
verbose("%s", "IO: parity written.\n");
|
||||
}
|
||||
|
||||
static gpointer io_thread(ecc_closure *ec)
|
||||
@@ -794,7 +797,7 @@ static gpointer io_thread(ecc_closure *ec)
|
||||
int parity_available = 0;
|
||||
int i;
|
||||
|
||||
verbose("Reader thread initializing\n");
|
||||
verbose("%s", "Reader thread initializing\n");
|
||||
|
||||
/*** Allocate local parity buffer aligned at 128bit boundary */
|
||||
|
||||
@@ -865,7 +868,7 @@ static gpointer io_thread(ecc_closure *ec)
|
||||
{ read_next_chunk(ec, chunk);
|
||||
// flush_crc(ec, file_out); // FIXME
|
||||
needs_preload = 0;
|
||||
verbose("IO: first chunk loaded\n");
|
||||
verbose("%s", "IO: first chunk loaded\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -914,7 +917,7 @@ static gpointer io_thread(ecc_closure *ec)
|
||||
cpu_bound = ec->buffersToEncode;
|
||||
#endif
|
||||
while(ec->buffersToEncode)
|
||||
{ verbose("IO: Waiting for encoders to finish\n");
|
||||
{ verbose("%s", "IO: Waiting for encoders to finish\n");
|
||||
g_cond_wait(ec->ioCond, ec->lock);
|
||||
}
|
||||
g_mutex_unlock(ec->lock);
|
||||
@@ -958,7 +961,7 @@ static gpointer io_thread(ecc_closure *ec)
|
||||
ec->slicesFree = TRUE; /* we have saved the slices; go ahead */
|
||||
g_cond_broadcast(ec->ioCond);
|
||||
while(ec->buffersToEncode)
|
||||
{ verbose("IO: Waiting for encoders to finish last chunk\n");
|
||||
{ verbose("%s", "IO: Waiting for encoders to finish last chunk\n");
|
||||
g_cond_wait(ec->ioCond, ec->lock);
|
||||
}
|
||||
g_mutex_unlock(ec->lock);
|
||||
@@ -971,7 +974,7 @@ static gpointer io_thread(ecc_closure *ec)
|
||||
flush_crc(ec, file_out);
|
||||
flush_parity(ec, file_out);
|
||||
|
||||
verbose("IO: finished\n"); fflush(stdout);
|
||||
verbose("%s", "IO: finished\n"); fflush(stdout);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1160,7 +1163,7 @@ static gpointer encoder_thread(ecc_closure *ec)
|
||||
ec->buffersToEncode-=enc_size;
|
||||
if(!ec->buffersToEncode)
|
||||
{ g_cond_broadcast(ec->ioCond);
|
||||
verbose("ENC: processed last buffer; telling IO process.\n");
|
||||
verbose("%s", "ENC: processed last buffer; telling IO process.\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
g_mutex_unlock(ec->lock);
|
||||
@@ -1264,7 +1267,7 @@ static void create_reed_solomon(ecc_closure *ec)
|
||||
verbose("SCHED: joined with worker %d\n", i);
|
||||
fflush(stdout);
|
||||
}
|
||||
verbose("SCHED: scheduler finished.\n");
|
||||
verbose("%s", "SCHED: scheduler finished.\n");
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -136,6 +136,15 @@ case "$cfg_uname" in
|
||||
}
|
||||
;;
|
||||
|
||||
GNU/kFreeBSD*) cfg_system=kfreebsd
|
||||
CFG_SYS_OPTIONS="-DSYS_KFREEBSD"
|
||||
CFG_SYS_NAME="-DSYS_NAME=\\\"GNU/kFreeBSD\\\""
|
||||
CFG_EXE_SUFFIX=""
|
||||
function add_linker_flags()
|
||||
{ lflags_return="-L$1 -Wl,-rpath,$1 $2"
|
||||
}
|
||||
;;
|
||||
|
||||
NetBSD*) cfg_system=netbsd
|
||||
CFG_SYS_OPTIONS="-DSYS_NETBSD"
|
||||
CFG_SYS_NAME="-DSYS_NAME=\\\"NetBSD\\\""
|
||||
@@ -146,6 +155,15 @@ case "$cfg_uname" in
|
||||
}
|
||||
;;
|
||||
|
||||
GNU*) cfg_system=hurd
|
||||
CFG_SYS_OPTIONS="-DSYS_HURD"
|
||||
CFG_SYS_NAME="-DSYS_NAME=\\\"GNU/Hurd\\\""
|
||||
CFG_EXE_SUFFIX=""
|
||||
function add_linker_flags()
|
||||
{ lflags_return="-L$1 -Wl,-rpath,$1 $2"
|
||||
}
|
||||
;;
|
||||
|
||||
*) cfg_system=unknown-system
|
||||
CFG_SYS_OPTIONS="-DSYS_UNKNOWN"
|
||||
CFG_SYS_NAME="-DSYS_NAME=\\\"Unknown\\\""
|
||||
@@ -313,13 +331,13 @@ function REQUIRE_GMAKE()
|
||||
|
||||
echo -n "Checking for gmake: "
|
||||
|
||||
if (gmake -v | grep "GNU Make") > /dev/null 2>&1 ;
|
||||
if (gmake -v 2>&1 | grep "GNU Make") > /dev/null 2>&1 ;
|
||||
then echo "yes"
|
||||
echo "MAKE = `which gmake`" >>Makefile.config
|
||||
return 0
|
||||
fi;
|
||||
|
||||
if (make -v | grep "GNU Make") > /dev/null 2>&1 ;
|
||||
if (make -v 2>&1 | grep "GNU Make") > /dev/null 2>&1 ;
|
||||
then echo "yes"
|
||||
echo "MAKE = `which make`" >>Makefile.config
|
||||
return 0
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "scsi-layer.h"
|
||||
#include "udf.h"
|
||||
|
||||
#ifdef SYS_FREEBSD
|
||||
#if defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
|
||||
|
||||
/* SCSI wrappers for FreeBSD are still work in progress. */
|
||||
|
||||
@@ -241,4 +241,4 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* SYS_FREEBSD */
|
||||
#endif /* defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) */
|
||||
|
||||
26
scsi-layer.c
26
scsi-layer.c
@@ -31,7 +31,9 @@
|
||||
|
||||
static int query_type(DeviceHandle*, int);
|
||||
static gint64 query_size(Image*);
|
||||
#if 0
|
||||
static int query_copyright(DeviceHandle*);
|
||||
#endif
|
||||
|
||||
static int read_dvd_sector(DeviceHandle*, unsigned char*, int, int);
|
||||
static int read_cd_sector(DeviceHandle*, unsigned char*, int, int);
|
||||
@@ -908,6 +910,11 @@ static int query_dvd(DeviceHandle *dh, int probe_only)
|
||||
break;
|
||||
}
|
||||
|
||||
if(layer_type & 0x01)
|
||||
{ dh->typeDescr = g_strdup("DVD-ROM");
|
||||
break;
|
||||
}
|
||||
|
||||
if(layer_type & 0x06) /* strange thing: (re-)writeable but neither plus nor dash */
|
||||
{ dh->typeDescr = g_strdup("DVD-ROM (fake)");
|
||||
dh->subType = DVD;
|
||||
@@ -1022,7 +1029,7 @@ static int query_bd(DeviceHandle *dh, int probe_only)
|
||||
|
||||
if(!strncmp((char*)&buf[4+8], "BDO", 3))
|
||||
{ dh->typeDescr = g_strdup("BD-ROM");
|
||||
dh->subType = UNSUPPORTED;
|
||||
dh->subType = BD;
|
||||
}
|
||||
|
||||
if(!strncmp((char*)&buf[4+8], "BDW", 3))
|
||||
@@ -1644,6 +1651,7 @@ reset_mode_page:
|
||||
* Find out whether we are allowed to create an image from the DVD.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static int query_copyright(DeviceHandle *dh)
|
||||
{ Sense sense;
|
||||
AlignedBuffer *ab = CreateAlignedBuffer(2048);
|
||||
@@ -1704,6 +1712,7 @@ static int query_copyright(DeviceHandle *dh)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* See whether a sector lies within the user area.
|
||||
@@ -1996,12 +2005,13 @@ static gint64 query_size(Image *image)
|
||||
*/
|
||||
|
||||
gint64 CurrentMediumSize(int get_blank_size)
|
||||
{ Image *image;
|
||||
{
|
||||
#if defined(SYS_UNKNOWN) || defined(SYS_HURD)
|
||||
return 0;
|
||||
#else
|
||||
Image *image;
|
||||
gint64 size;
|
||||
|
||||
#ifdef SYS_UNKNOWN
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
image = OpenImageFromDevice(Closure->device);
|
||||
if(!image) return 0;
|
||||
@@ -2042,6 +2052,7 @@ gint64 CurrentMediumSize(int get_blank_size)
|
||||
CloseImage(image);
|
||||
|
||||
return size;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -2456,7 +2467,7 @@ int ReadSectors(DeviceHandle *dh, unsigned char *buf, gint64 s, int nsectors)
|
||||
if(Closure->readRaw && dh->rawBuffer)
|
||||
recommended_attempts = dh->rawBuffer->recommendedAttempts;
|
||||
|
||||
if(status) /* current try was unsucessful */
|
||||
if(status) /* current try was unsuccessful */
|
||||
{ int last_key, last_asc, last_ascq;
|
||||
|
||||
#ifndef CLI
|
||||
@@ -2704,12 +2715,13 @@ Image* OpenImageFromDevice(char *device)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(dh->mainType == DVD && query_copyright(dh))
|
||||
{ CloseImage(image);
|
||||
Stop(_("This software does not support encrypted media.\n"));
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Create the bitmap of simulated defects */
|
||||
|
||||
|
||||
17
scsi-layer.h
17
scsi-layer.h
@@ -28,7 +28,7 @@
|
||||
#include <linux/cdrom.h>
|
||||
#endif
|
||||
|
||||
#ifdef SYS_FREEBSD
|
||||
#if defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
|
||||
#include <camlib.h>
|
||||
#endif
|
||||
|
||||
@@ -49,19 +49,21 @@
|
||||
* Linux already has one
|
||||
*/
|
||||
|
||||
#ifdef SYS_LINUX
|
||||
#if defined(SYS_LINUX)
|
||||
|
||||
#define MAX_CDB_SIZE CDROM_PACKET_SIZE
|
||||
|
||||
/* Now globally defined for all OSes here */
|
||||
//typedef struct request_sense Sense;
|
||||
#endif
|
||||
|
||||
#ifdef SYS_FREEBSD
|
||||
#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
|
||||
|
||||
#define MAX_CDB_SIZE SCSI_MAX_CDBLEN
|
||||
#endif
|
||||
|
||||
#if defined(SYS_UNKNOWN) || defined(SYS_NETBSD)
|
||||
#else /* SYS_UNKNOWN and others. */
|
||||
|
||||
#define MAX_CDB_SIZE 16 /* longest possible SCSI command */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -101,8 +103,7 @@ typedef struct _DeviceHandle
|
||||
*/
|
||||
#if defined(SYS_LINUX) || defined(SYS_NETBSD)
|
||||
int fd; /* device file descriptor */
|
||||
#endif
|
||||
#ifdef SYS_FREEBSD
|
||||
#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
|
||||
struct cam_device *camdev; /* camlib device handle */
|
||||
union ccb *ccb;
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "scsi-layer.h"
|
||||
#include "udf.h"
|
||||
|
||||
#ifdef SYS_UNKNOWN
|
||||
#if defined(SYS_UNKNOWN) || defined(SYS_HURD)
|
||||
|
||||
/* Dummy routines so that we can compile on unknown architectures
|
||||
for which we don't have SCSI support yet. */
|
||||
@@ -51,4 +51,4 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* SYS_UNKNOWN */
|
||||
#endif /* defined(SYS_UNKNOWN) || defined(SYS_HURD) */
|
||||
|
||||
408
show-html.c
Normal file
408
show-html.c
Normal file
@@ -0,0 +1,408 @@
|
||||
/* dvdisaster: Additional error correction for optical media.
|
||||
* Copyright (C) 2004-2012 Carsten Gnoerlich.
|
||||
* Project home page: http://www.dvdisaster.com
|
||||
* Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
|
||||
* or direct your browser at http://www.gnu.org.
|
||||
*/
|
||||
// DVDISASTER_GUI_FILE
|
||||
|
||||
#include "dvdisaster.h"
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef SYS_MINGW
|
||||
#include "windows.h"
|
||||
#include "shellapi.h"
|
||||
#endif
|
||||
|
||||
/***
|
||||
*** Ask user to specify his browser
|
||||
***/
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
|
||||
#define SEARCH_BUTTON 1
|
||||
|
||||
typedef struct
|
||||
{ GtkWidget *dialog;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *search;
|
||||
GtkWidget *filesel;
|
||||
GtkWidget *fileok;
|
||||
GtkWidget *filecancel;
|
||||
char *url;
|
||||
} browser_dialog_info;
|
||||
|
||||
static void response_cb(GtkWidget *widget, int response, gpointer data)
|
||||
{ browser_dialog_info *bdi = (browser_dialog_info*)data;
|
||||
|
||||
switch(response)
|
||||
{ case GTK_RESPONSE_ACCEPT:
|
||||
if(Closure->browser) g_free(Closure->browser);
|
||||
Closure->browser = g_strdup(gtk_entry_get_text(GTK_ENTRY(bdi->entry)));
|
||||
ShowHTML(bdi->url);
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_REJECT:
|
||||
if(bdi->url) g_free(bdi->url);
|
||||
break;
|
||||
}
|
||||
gtk_widget_destroy(widget);
|
||||
if(bdi->filesel)
|
||||
gtk_widget_destroy(bdi->filesel);
|
||||
g_free(bdi);
|
||||
}
|
||||
|
||||
static void search_cb(GtkWidget *widget, gpointer data)
|
||||
{ browser_dialog_info *bdi = (browser_dialog_info*)data;
|
||||
|
||||
if(widget == bdi->search)
|
||||
{ bdi->filesel = gtk_file_selection_new(_utf("windowtitle|Choose a browser"));
|
||||
bdi->fileok = GTK_FILE_SELECTION(bdi->filesel)->ok_button;
|
||||
bdi->filecancel = GTK_FILE_SELECTION(bdi->filesel)->cancel_button;
|
||||
ReverseCancelOK(GTK_DIALOG(bdi->filesel));
|
||||
gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(bdi->filesel));
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(bdi->filesel)->ok_button), "clicked",
|
||||
G_CALLBACK(search_cb), bdi);
|
||||
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(bdi->filesel)->cancel_button), "clicked",
|
||||
G_CALLBACK(search_cb), bdi);
|
||||
|
||||
gtk_widget_show(bdi->filesel);
|
||||
}
|
||||
|
||||
if(widget == bdi->fileok)
|
||||
{
|
||||
if(Closure->browser) g_free(Closure->browser);
|
||||
Closure->browser = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(bdi->filesel)));
|
||||
ShowHTML(bdi->url);
|
||||
gtk_widget_destroy(bdi->filesel);
|
||||
gtk_widget_destroy(bdi->dialog);
|
||||
g_free(bdi);
|
||||
return;
|
||||
}
|
||||
|
||||
if(widget == bdi->filecancel)
|
||||
{ gtk_widget_destroy(bdi->filesel);
|
||||
bdi->filesel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void browser_dialog(char *url)
|
||||
{ GtkWidget *dialog, *vbox, *hbox, *label, *entry, *button;
|
||||
browser_dialog_info *bdi = g_malloc0(sizeof(browser_dialog_info));
|
||||
|
||||
/* Create the dialog */
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(_utf("windowtitle|Browser required"),
|
||||
Closure->window, GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
|
||||
bdi->dialog = dialog;
|
||||
if(url)
|
||||
{ bdi->url = g_strdup(url);
|
||||
}
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
|
||||
|
||||
/* Insert the contents */
|
||||
|
||||
label = gtk_label_new(NULL);
|
||||
gtk_label_set_markup(GTK_LABEL(label), _utf("<b>Could not find a suitable browser.</b>\n\n"
|
||||
"Which browser would you like to use\n"
|
||||
"for reading the online documentation?\n\n"
|
||||
"Please enter its name (e.g. mozilla) or\n"
|
||||
"use the \"Search\" button for a file dialog.\n")),
|
||||
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 10);
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 10);
|
||||
|
||||
bdi->entry = entry = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 10);
|
||||
|
||||
bdi->search = button = gtk_button_new_with_label(_utf("Search"));
|
||||
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(search_cb), bdi);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 10);
|
||||
|
||||
/* Show it */
|
||||
|
||||
g_signal_connect(dialog, "response", G_CALLBACK(response_cb), bdi);
|
||||
|
||||
gtk_widget_show_all(dialog);
|
||||
}
|
||||
#endif /* SYS_ unix-like */
|
||||
|
||||
/***
|
||||
*** Show the manual in an external browser
|
||||
***/
|
||||
|
||||
/*
|
||||
* Check the child processes exit status
|
||||
* to find whether the browser could be invoked.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ pid_t pid;
|
||||
char *url;
|
||||
GtkWidget *msg;
|
||||
int seconds;
|
||||
} browser_info;
|
||||
|
||||
|
||||
static void msg_destroy_cb(GtkWidget *widget, gpointer data)
|
||||
{ browser_info *bi = (browser_info*)data;
|
||||
|
||||
bi->msg = NULL;
|
||||
}
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
|
||||
/*
|
||||
* The following list of browsers and html wrappers
|
||||
* will be tried one at a time until one entry succeeds by:
|
||||
* - returning zero
|
||||
* - not returning within 60 seconds
|
||||
*/
|
||||
|
||||
static int browser_index;
|
||||
static void try_browser(browser_info*);
|
||||
|
||||
static char *browsers[] =
|
||||
{ "user-selection",
|
||||
"xdg-open",
|
||||
"gnome-open",
|
||||
"htmlview",
|
||||
"firefox",
|
||||
"mozilla",
|
||||
"konqueror",
|
||||
"epiphany",
|
||||
"opera",
|
||||
"/Applications/Safari.app/Contents/MacOS/Safari", /* better way to do this? */
|
||||
NULL
|
||||
};
|
||||
|
||||
static gboolean browser_timeout_func(gpointer data)
|
||||
{ browser_info *bi = (browser_info*)data;
|
||||
int status;
|
||||
|
||||
waitpid(bi->pid, &status, WNOHANG);
|
||||
|
||||
/* At least mozilla returns random values under FreeBSD on success,
|
||||
so we can't rely on the return value exept our own 110 one. */
|
||||
|
||||
if(WIFEXITED(status))
|
||||
{
|
||||
switch(WEXITSTATUS(status))
|
||||
{ case 110: /* browser did not execute */
|
||||
browser_index++;
|
||||
if(!browsers[browser_index]) /* all browsers from the list failed */
|
||||
{ browser_dialog(bi->url);
|
||||
|
||||
if(bi->msg)
|
||||
gtk_widget_destroy(bi->msg);
|
||||
if(bi->url)
|
||||
g_free(bi->url);
|
||||
g_free(bi);
|
||||
}
|
||||
else /* try next browser from list */
|
||||
{ bi->seconds = 0;
|
||||
try_browser(bi);
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case 0: /* browser assumed to be successful */
|
||||
default:
|
||||
if(bi->msg)
|
||||
gtk_widget_destroy(bi->msg);
|
||||
if(bi->url)
|
||||
g_free(bi->url);
|
||||
g_free(bi);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bi->seconds++;
|
||||
if(bi->seconds == 10 && bi->msg)
|
||||
{ gtk_widget_destroy(bi->msg);
|
||||
bi->msg = NULL;
|
||||
}
|
||||
|
||||
return bi->seconds > 60 ? FALSE : TRUE;
|
||||
}
|
||||
#endif /* SYS_ unix-like */
|
||||
|
||||
#ifdef SYS_MINGW
|
||||
static gboolean browser_timeout_func(gpointer data)
|
||||
{ browser_info *bi = (browser_info*)data;
|
||||
|
||||
bi->seconds++;
|
||||
|
||||
if(bi->seconds >= 10)
|
||||
{ if(bi->msg)
|
||||
{ gtk_widget_destroy(bi->msg);
|
||||
bi->msg = NULL;
|
||||
}
|
||||
if(bi->url) g_free(bi->url);
|
||||
g_free(bi);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* SYS_MINGW */
|
||||
|
||||
/*
|
||||
* Invoke the browser
|
||||
*/
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
static void try_browser(browser_info *bi)
|
||||
{ pid_t pid;
|
||||
|
||||
bi->pid = pid = fork();
|
||||
|
||||
if(pid == -1)
|
||||
{ printf("fork failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* make the parent remember and wait() for the browser */
|
||||
|
||||
if(pid > 0)
|
||||
{ g_timeout_add(1000, browser_timeout_func, (gpointer)bi);
|
||||
|
||||
if(browser_index)
|
||||
{ g_free(Closure->browser);
|
||||
Closure->browser = g_strdup(browsers[browser_index]);
|
||||
}
|
||||
}
|
||||
|
||||
/* try calling the browser */
|
||||
|
||||
if(pid == 0)
|
||||
{ char *argv[10];
|
||||
int argc = 0;
|
||||
|
||||
argv[argc++] = browser_index ? browsers[browser_index] : Closure->browser;
|
||||
argv[argc++] = bi->url;
|
||||
argv[argc++] = NULL;
|
||||
execvp(argv[0], argv);
|
||||
|
||||
_exit(110); /* couldn't execute */
|
||||
}
|
||||
}
|
||||
#endif /* SYS_ unix-like */
|
||||
|
||||
|
||||
void ShowHTML(char *target)
|
||||
{ browser_info *bi = g_malloc0(sizeof(browser_info));
|
||||
guint64 ignore;
|
||||
const char *lang;
|
||||
char *path = NULL;
|
||||
int http_url;
|
||||
|
||||
/* If no target is given, select between translations of the manual. */
|
||||
|
||||
if(!target) target = g_strdup("index.html");
|
||||
|
||||
http_url = strlen(target) > 4 && !strncmp(target, "http", 4);
|
||||
|
||||
if(!http_url && !strchr(target, '/')) /* create full path */
|
||||
{
|
||||
if(!Closure->docDir)
|
||||
{
|
||||
CreateMessage(_("Documentation not installed."), GTK_MESSAGE_ERROR);
|
||||
g_free(bi);
|
||||
return;
|
||||
}
|
||||
|
||||
lang = g_getenv("LANG");
|
||||
|
||||
if(lang)
|
||||
{ if(!strncmp(lang, "ru", 2))
|
||||
#ifdef SYS_MINGW
|
||||
path = g_strdup_printf("%s\\ru\\%s",Closure->docDir,target);
|
||||
#else
|
||||
path = g_strdup_printf("%s/ru/%s",Closure->docDir,target);
|
||||
#endif
|
||||
else if(!strncmp(lang, "de", 2))
|
||||
#ifdef SYS_MINGW
|
||||
path = g_strdup_printf("%s\\de\\%s",Closure->docDir,target);
|
||||
#else
|
||||
path = g_strdup_printf("%s/de/%s",Closure->docDir,target);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(!path)
|
||||
{
|
||||
#ifdef SYS_MINGW
|
||||
path = g_strdup_printf("%s\\en\\%s",Closure->docDir,target);
|
||||
#else
|
||||
path = g_strdup_printf("%s/en/%s",Closure->docDir,target);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SYS_MINGW
|
||||
if(!LargeStat(path, &ignore))
|
||||
{
|
||||
g_free(path); /* the local dir is Windows specific */
|
||||
path = g_strdup_printf("%s\\local\\%s",Closure->docDir,target);
|
||||
}
|
||||
#endif
|
||||
g_free(target);
|
||||
bi->url = path;
|
||||
}
|
||||
else bi->url = target;
|
||||
|
||||
if(!http_url && !LargeStat(bi->url, &ignore))
|
||||
{
|
||||
CreateMessage(_("Documentation file\n%s\nnot found.\n"), GTK_MESSAGE_ERROR, bi->url);
|
||||
g_free(bi);
|
||||
g_free(bi->url);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Lock the help button and show a message for 10 seconds. */
|
||||
|
||||
TimedInsensitive(Closure->helpButton, 10000);
|
||||
bi->msg = CreateMessage(_("Please hang on until the browser comes up!"), GTK_MESSAGE_INFO);
|
||||
g_signal_connect(G_OBJECT(bi->msg), "destroy", G_CALLBACK(msg_destroy_cb), bi);
|
||||
|
||||
#ifdef SYS_MINGW
|
||||
/* Okay, Billy wins big time here ;-) */
|
||||
|
||||
ShellExecute(NULL, "open", bi->url, NULL, NULL, SW_SHOWNORMAL);
|
||||
g_timeout_add(1000, browser_timeout_func, (gpointer)bi);
|
||||
#endif
|
||||
|
||||
#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
|
||||
defined(SYS_NETBSD) || defined(SYS_HURD)
|
||||
/* Try the first browser */
|
||||
|
||||
browser_index = 0;
|
||||
try_browser(bi);
|
||||
#endif
|
||||
}
|
||||
12
smart-lec.c
12
smart-lec.c
@@ -27,9 +27,9 @@
|
||||
|
||||
#define VERBOSE 1
|
||||
#ifdef VERBOSE
|
||||
#define verbose(format,args...) printf(format, ## args)
|
||||
#define verbose(format,...) printf(format, __VA_ARGS__)
|
||||
#else
|
||||
#define verbose(format,args...)
|
||||
#define verbose(format,...)
|
||||
#endif
|
||||
|
||||
/***
|
||||
@@ -432,7 +432,7 @@ static void update_pq_state(sh_context *shc)
|
||||
static void print_pq_state(sh_context *shc)
|
||||
{ int i;
|
||||
|
||||
verbose("PQ states: \n");
|
||||
verbose("%s", "PQ states: \n");
|
||||
|
||||
for(i=0; i<N_P_VECTORS; i++)
|
||||
{ if(shc->pState[i] == 1)
|
||||
@@ -1354,7 +1354,7 @@ static void swap_p_for_new_improvement(sh_context *shc)
|
||||
count++;
|
||||
|
||||
if(count < 2)
|
||||
{ verbose(" pruned");
|
||||
{ verbose("%s", " pruned");
|
||||
goto decrement;
|
||||
}
|
||||
|
||||
@@ -1417,7 +1417,7 @@ decrement:
|
||||
if(index >= n_q) break;
|
||||
selection[index]=0;
|
||||
|
||||
verbose("\n");
|
||||
verbose("%s", "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1609,7 +1609,7 @@ static int smart_lec_iteration(sh_context *shc, char *message)
|
||||
shc->bestBonus = 0;
|
||||
shc->bestMalus = 100000;
|
||||
memcpy(shc->bestFrame, rb->recovered, rb->sampleSize);
|
||||
sprintf(shc->msg, "smart_lec: no further improvment");
|
||||
sprintf(shc->msg, "smart_lec: no further improvement");
|
||||
|
||||
update_pq_state(shc);
|
||||
print_pq_state(shc);
|
||||
|
||||
Reference in New Issue
Block a user