xsane package is retired on branch c10s for BAKERY-412
This commit is contained in:
parent
750f845c2c
commit
3f00fe1d0b
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,8 +0,0 @@
|
||||
xsane-0.997.tar.gz
|
||||
xsane-0.997-5-autoconf.patch.bz2
|
||||
/xsane-0.998.tar.gz
|
||||
/xsane-0.998-1-autoconf.patch.bz2
|
||||
/xsane-256x256.png
|
||||
/xsane-0.999-1-autoconf.patch.bz2
|
||||
/xsane-0.999.tar.gz
|
||||
/xsane-0.999-7-autoconf.patch.bz2
|
1
dead.package
Normal file
1
dead.package
Normal file
@ -0,0 +1 @@
|
||||
xsane package is retired on branch c10s for BAKERY-412
|
3
sources
3
sources
@ -1,3 +0,0 @@
|
||||
bd62603e67d7472b93cee42f57ae14b8 xsane-256x256.png
|
||||
9927f21e1ab6ba96315e7f0e30746deb xsane-0.999.tar.gz
|
||||
546080267e72a0e4fa2e4e9a61de64cd xsane-0.999-7-autoconf.patch.bz2
|
@ -1,101 +0,0 @@
|
||||
From 6dee7eadd1b7352ec503ea04fa1639d4a93f370b Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 11:18:31 +0200
|
||||
Subject: [PATCH] patch: close-fds
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 4fdedd3a8b66fb42b2d4dde62df28c78571c1c5d
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:15:58 2010 +0100
|
||||
|
||||
don't leak file descriptors to help browser process (#455450)
|
||||
---
|
||||
src/xsane.c | 43 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 43 insertions(+)
|
||||
|
||||
diff --git a/src/xsane.c b/src/xsane.c
|
||||
index 775610e..1c5d61d 100644
|
||||
--- a/src/xsane.c
|
||||
+++ b/src/xsane.c
|
||||
@@ -48,6 +48,8 @@
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
struct option long_options[] =
|
||||
@@ -3684,6 +3686,41 @@ static void xsane_show_gpl(GtkWidget *widget, gpointer data)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
+static void xsane_close_fds_for_exec(signed int first_fd_to_leave_open, ...)
|
||||
+{
|
||||
+ int open_max;
|
||||
+ signed int i;
|
||||
+
|
||||
+ va_list ap;
|
||||
+ unsigned char *close_fds;
|
||||
+
|
||||
+ open_max = (int) sysconf (_SC_OPEN_MAX);
|
||||
+
|
||||
+ close_fds = malloc (open_max);
|
||||
+
|
||||
+ memset (close_fds, 1, open_max);
|
||||
+
|
||||
+ va_start (ap, first_fd_to_leave_open);
|
||||
+
|
||||
+ for (i = first_fd_to_leave_open; i >= 0; i = va_arg (ap, signed int)) {
|
||||
+ if (i < open_max)
|
||||
+ close_fds[i] = 0;
|
||||
+ }
|
||||
+
|
||||
+ va_end (ap);
|
||||
+
|
||||
+ DBG(DBG_info, "closing unneeded file descriptors\n");
|
||||
+
|
||||
+ for (i = 0; i < open_max; i++) {
|
||||
+ if (close_fds[i])
|
||||
+ close (i);
|
||||
+ }
|
||||
+
|
||||
+ free (close_fds);
|
||||
+}
|
||||
+
|
||||
+/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
+
|
||||
static void xsane_show_doc_via_nsr(GtkWidget *widget, gpointer data) /* show via netscape remote */
|
||||
{
|
||||
char *name = (char *) data;
|
||||
@@ -3736,6 +3773,8 @@ static void xsane_show_doc_via_nsr(GtkWidget *widget, gpointer data) /* show via
|
||||
ipc_file = fdopen(xsane.ipc_pipefd[1], "w");
|
||||
}
|
||||
|
||||
+ xsane_close_fds_for_exec (1, 2, xsane.ipc_pipefd[1], -1);
|
||||
+
|
||||
DBG(DBG_info, "trying to change user id for new subprocess:\n");
|
||||
DBG(DBG_info, "old effective uid = %d\n", (int) geteuid());
|
||||
setuid(getuid());
|
||||
@@ -3778,6 +3817,8 @@ static void xsane_show_doc_via_nsr(GtkWidget *widget, gpointer data) /* show via
|
||||
ipc_file = fdopen(xsane.ipc_pipefd[1], "w");
|
||||
}
|
||||
|
||||
+ xsane_close_fds_for_exec (1, 2, xsane.ipc_pipefd[1], -1);
|
||||
+
|
||||
DBG(DBG_info, "trying to change user id for new subprocess:\n");
|
||||
DBG(DBG_info, "old effective uid = %d\n", (int) geteuid());
|
||||
setuid(getuid());
|
||||
@@ -3899,6 +3940,8 @@ static void xsane_show_doc(GtkWidget *widget, gpointer data)
|
||||
ipc_file = fdopen(xsane.ipc_pipefd[1], "w");
|
||||
}
|
||||
|
||||
+ xsane_close_fds_for_exec (1, 2, xsane.ipc_pipefd[1], -1);
|
||||
+
|
||||
DBG(DBG_info, "trying to change user id for new subprocess:\n");
|
||||
DBG(DBG_info, "old effective uid = %d\n", (int) geteuid());
|
||||
setuid(getuid());
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 813d7063e3d265ba7e625766a040b8ba9bb130a9 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 11:18:00 +0200
|
||||
Subject: [PATCH] patch: xdg-open
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 55380b90cece459e20d14e6da552abcf5ca54621
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:14:17 2010 +0100
|
||||
|
||||
use "xdg-open" instead of "netscape" to launch help browser
|
||||
---
|
||||
src/xsane.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/xsane.h b/src/xsane.h
|
||||
index cf6111f..3d8caaa 100644
|
||||
--- a/src/xsane.h
|
||||
+++ b/src/xsane.h
|
||||
@@ -251,7 +251,7 @@
|
||||
# elif defined(HAVE_OS2_H)
|
||||
# define DEFAULT_BROWSER "netscape"
|
||||
# else
|
||||
-# define DEFAULT_BROWSER "netscape"
|
||||
+# define DEFAULT_BROWSER "xdg-open"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,94 +0,0 @@
|
||||
From 7018206ea45db2e8bdfeb67d33f3387c9678a407 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 11:19:16 +0200
|
||||
Subject: [PATCH] patch: no-eula
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit d13f1ccfdf4c150cab91105e9b8542ecbb048a9b
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:20:52 2010 +0100
|
||||
|
||||
don't show EULA, mention bugzilla in about dialog (#504344)
|
||||
---
|
||||
src/xsane-text.h | 2 ++
|
||||
src/xsane.c | 16 ++++++----------
|
||||
src/xsane.h | 3 +++
|
||||
3 files changed, 11 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/xsane-text.h b/src/xsane-text.h
|
||||
index fc6bbeb..ee4a222 100644
|
||||
--- a/src/xsane-text.h
|
||||
+++ b/src/xsane-text.h
|
||||
@@ -230,6 +230,8 @@
|
||||
"This program is distributed in the hope that it will be useful, but\n" \
|
||||
"WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n")
|
||||
+#define TEXT_MODIFIED_BLURB _("This package is modified from the original version.\n" \
|
||||
+ "Please contact your vendor or report problems at")
|
||||
#define TEXT_EMAIL_ADR _("E-mail:")
|
||||
#define TEXT_HOMEPAGE _("Homepage:")
|
||||
#define TEXT_FILE _("File:")
|
||||
diff --git a/src/xsane.c b/src/xsane.c
|
||||
index 1c5d61d..8b24b0c 100644
|
||||
--- a/src/xsane.c
|
||||
+++ b/src/xsane.c
|
||||
@@ -3533,10 +3533,13 @@ static void xsane_about_dialog(GtkWidget *widget, gpointer data)
|
||||
snprintf(buf, sizeof(buf), "XSane %s %s\n"
|
||||
"%s %s\n"
|
||||
"\n"
|
||||
+ "%s\n%s"
|
||||
+ "\n\n"
|
||||
"%s %s\n"
|
||||
"%s %s\n",
|
||||
TEXT_VERSION, XSANE_VERSION,
|
||||
XSANE_COPYRIGHT_SIGN, XSANE_COPYRIGHT_TXT,
|
||||
+ TEXT_MODIFIED_BLURB, XSANE_BUGTRACKER_URL,
|
||||
TEXT_HOMEPAGE, XSANE_HOMEPAGE,
|
||||
TEXT_EMAIL_ADR, XSANE_EMAIL_ADR);
|
||||
|
||||
@@ -5733,6 +5736,7 @@ static int xsane_init(int argc, char **argv)
|
||||
|
||||
case 'v': /* --version */
|
||||
g_print("%s-%s %s %s\n", xsane.prog_name, XSANE_VERSION, XSANE_COPYRIGHT_SIGN, XSANE_COPYRIGHT_TXT);
|
||||
+ g_print("\n%s\n%s\n\n", TEXT_MODIFIED_BLURB, XSANE_BUGTRACKER_URL);
|
||||
g_print(" %s %s\n", TEXT_EMAIL_ADR, XSANE_EMAIL_ADR);
|
||||
g_print(" %s %s\n", TEXT_PACKAGE, XSANE_PACKAGE_VERSION);
|
||||
g_print(" %s%d.%d.%d\n", TEXT_GTK_VERSION, GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
@@ -5859,17 +5863,9 @@ static int xsane_init(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
- if (xsane_pref_restore()) /* restore preferences, returns TRUE if license is not accpted yet */
|
||||
+ if (xsane_pref_restore()) /* restore preferences, returns TRUE if the version is different from the last run */
|
||||
{
|
||||
- if (xsane_display_eula(1)) /* show license and ask for accept/not accept */
|
||||
- {
|
||||
- DBG(DBG_info, "user did not accept eula, we abort\n");
|
||||
- return 1; /* User did not accept eula */
|
||||
- }
|
||||
- else /* User did accept eula */
|
||||
- {
|
||||
- xsane_pref_save();
|
||||
- }
|
||||
+ xsane_pref_save();
|
||||
}
|
||||
|
||||
xsane_pref_restore_media();
|
||||
diff --git a/src/xsane.h b/src/xsane.h
|
||||
index 3d8caaa..6c7568e 100644
|
||||
--- a/src/xsane.h
|
||||
+++ b/src/xsane.h
|
||||
@@ -98,6 +98,9 @@
|
||||
#define XSANE_EMAIL_ADR "Oliver.Rauch@xsane.org"
|
||||
#define XSANE_HOMEPAGE "http://www.xsane.org"
|
||||
#define XSANE_COPYRIGHT_TXT XSANE_DATE " " XSANE_COPYRIGHT
|
||||
+#ifndef XSANE_BUGTRACKER_URL
|
||||
+#define XSANE_BUGTRACKER_URL "(no bug tracker configured)"
|
||||
+#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,148 +0,0 @@
|
||||
From a2ef22d59904d5e53c3d58093b561fa1ab7127a6 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 10:58:54 +0200
|
||||
Subject: [PATCH] patch: ipv6
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 9f9d5c46fdef5ba7baccb81ab8170cfc24797de6
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:27:42 2010 +0100
|
||||
|
||||
support IPv6 (#198422)
|
||||
---
|
||||
src/xsane-save.c | 96 ++++++++++++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 62 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/src/xsane-save.c b/src/xsane-save.c
|
||||
index 84f5d59..87ef685 100644
|
||||
--- a/src/xsane-save.c
|
||||
+++ b/src/xsane-save.c
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
+#include <glib.h>
|
||||
+
|
||||
/* the following test is always false */
|
||||
#ifdef _native_WIN32
|
||||
# include <winsock.h>
|
||||
@@ -7488,55 +7490,81 @@ void write_email_attach_file(int fd_socket, char *boundary, FILE *infile, char *
|
||||
/* returns fd_socket if sucessfull, < 0 when error occured */
|
||||
int open_socket(char *server, int port)
|
||||
{
|
||||
- int fd_socket;
|
||||
- struct sockaddr_in sin;
|
||||
- struct hostent *he;
|
||||
+ int fd_socket, e;
|
||||
+
|
||||
+ struct addrinfo *ai_list, *ai;
|
||||
+ struct addrinfo hints;
|
||||
+ gchar *port_s;
|
||||
+ gint connected;
|
||||
+
|
||||
+ memset(&hints, '\0', sizeof(hints));
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+
|
||||
+ port_s = g_strdup_printf("%d", port);
|
||||
+ e = getaddrinfo(server, port_s, &hints, &ai_list);
|
||||
+ g_free(port_s);
|
||||
|
||||
- he = gethostbyname(server);
|
||||
- if (!he)
|
||||
+ if (e != 0)
|
||||
{
|
||||
- DBG(DBG_error, "open_socket: Could not get hostname of \"%s\"\n", server);
|
||||
+ DBG(DBG_error, "open_socket: Could not lookup \"%s\"\n", server);
|
||||
return -1;
|
||||
}
|
||||
- else
|
||||
+
|
||||
+ connected = 0;
|
||||
+ for (ai = ai_list; ai != NULL && !connected; ai = ai->ai_next)
|
||||
{
|
||||
- DBG(DBG_info, "open_socket: connecting to \"%s\" = %d.%d.%d.%d\n",
|
||||
- he->h_name,
|
||||
- (unsigned char) he->h_addr_list[0][0],
|
||||
- (unsigned char) he->h_addr_list[0][1],
|
||||
- (unsigned char) he->h_addr_list[0][2],
|
||||
- (unsigned char) he->h_addr_list[0][3]);
|
||||
- }
|
||||
+ gchar hostname[NI_MAXHOST];
|
||||
+ gchar hostaddr[NI_MAXHOST];
|
||||
+
|
||||
+ /* If all else fails */
|
||||
+ strncpy(hostname, "(unknown name)", NI_MAXHOST-1);
|
||||
+ strncpy(hostaddr, "(unknown address)", NI_MAXHOST-1);
|
||||
+
|
||||
+ /* Determine canonical name and IPv4/IPv6 address */
|
||||
+ (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostname, sizeof(hostname),
|
||||
+ NULL, 0, 0);
|
||||
+ (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostaddr, sizeof(hostaddr),
|
||||
+ NULL, 0, NI_NUMERICHOST);
|
||||
+
|
||||
+ DBG(DBG_info, "open_socket: connecting to \"%s\" (\"%s\"): %s\n",
|
||||
+ server, hostname, hostaddr);
|
||||
|
||||
- if (he->h_addrtype != AF_INET)
|
||||
- {
|
||||
- DBG(DBG_error, "open_socket: Unknown address family: %d\n", he->h_addrtype);
|
||||
- return -1;
|
||||
- }
|
||||
+ if ((ai->ai_family != AF_INET) && (ai->ai_family != AF_INET6))
|
||||
+ {
|
||||
+ DBG(DBG_error, "open_socket: Unknown address family: %d\n", ai->ai_family);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- fd_socket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
+ fd_socket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||
|
||||
- if (fd_socket < 0)
|
||||
- {
|
||||
- DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
+ if (fd_socket < 0)
|
||||
+ {
|
||||
+ DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
-/* setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
|
||||
+ /* setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
|
||||
|
||||
- sin.sin_port = htons(port);
|
||||
- sin.sin_family = AF_INET;
|
||||
- memcpy(&sin.sin_addr, he->h_addr_list[0], he->h_length);
|
||||
+ if (connect(fd_socket, ai->ai_addr, ai->ai_addrlen) != 0)
|
||||
+ {
|
||||
+ DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", port, strerror(errno));
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* All went well */
|
||||
+ connected = 1;
|
||||
+ }
|
||||
|
||||
- if (connect(fd_socket, &sin, sizeof(sin)))
|
||||
+ if (!connected)
|
||||
{
|
||||
- DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", ntohs(sin.sin_port), strerror(errno));
|
||||
- return -1;
|
||||
+ DBG(DBG_info, "open_socket: Could not connect to any address");
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
- DBG(DBG_info, "open_socket: Connected with port %d\n", ntohs(sin.sin_port));
|
||||
+ DBG(DBG_info, "open_socket: Connected with port %d\n", port);
|
||||
|
||||
- return fd_socket;
|
||||
+ return fd_socket;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,127 +0,0 @@
|
||||
From 7f43255972b741ff178f94233ffff67c9779c247 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 10:57:38 +0200
|
||||
Subject: [PATCH] patch: off-root-build
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit f88d28c807667f618b3b1cf91c12b823f3853983
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:23:57 2010 +0100
|
||||
|
||||
enable off-root builds
|
||||
---
|
||||
configure.in | 2 +-
|
||||
doc/Makefile.in | 12 ++++++------
|
||||
lib/Makefile.in | 4 ++--
|
||||
src/Makefile.in | 8 ++++----
|
||||
4 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index a770253..770077b 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -312,4 +312,4 @@ echo "* ------------------------------------------------------------ *"
|
||||
echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING XSANE ... *"
|
||||
echo "* ------------------------------------------------------------ *"
|
||||
echo "****************************************************************"
|
||||
-cat xsane.NEWS
|
||||
+cat ${srcdir}/xsane.NEWS
|
||||
diff --git a/doc/Makefile.in b/doc/Makefile.in
|
||||
index 59b022b..4038a6b 100644
|
||||
--- a/doc/Makefile.in
|
||||
+++ b/doc/Makefile.in
|
||||
@@ -57,14 +57,14 @@ install: $(MANPAGES)
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir)
|
||||
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(xsanedocdir)
|
||||
- @for page in *.html; do\
|
||||
+ @for page in $(notdir $(wildcard $(srcdir)/*.html)); do \
|
||||
echo installing $${page} in $(DESTDIR)$(xsanedocdir)/$${page}...; \
|
||||
- $(INSTALL_DATA) $${page} $(DESTDIR)$(xsanedocdir)/$${page} || exit 1; \
|
||||
+ $(INSTALL_DATA) $(srcdir)/$${page} $(DESTDIR)$(xsanedocdir)/$${page} || exit 1; \
|
||||
done
|
||||
|
||||
- @for image in *.jpg; do\
|
||||
+ @for image in $(notdir $(wildcard $(srcdir)/*.jpg)); do \
|
||||
echo installing $${image} in $(DESTDIR)$(xsanedocdir)/$${image}...; \
|
||||
- $(INSTALL_DATA) $${image} $(DESTDIR)$(xsanedocdir)/$${image} || exit 1; \
|
||||
+ $(INSTALL_DATA) $(srcdir)/$${image} $(DESTDIR)$(xsanedocdir)/$${image} || exit 1; \
|
||||
done
|
||||
|
||||
uninstall:
|
||||
@@ -73,12 +73,12 @@ uninstall:
|
||||
rm -f $(DESTDIR)$(mandir)/man1/$${page} || exit 1; \
|
||||
done
|
||||
|
||||
- @for page in *.html; do\
|
||||
+ @for page in $(notdir $(wildcard $(srcdir)/*.html)); do \
|
||||
echo uninstalling $(DESTDIR)$(xsanedocdir)/$${page}...; \
|
||||
rm -f $(DESTDIR)$(xsanedocdir)/$${page} || exit 1; \
|
||||
done
|
||||
|
||||
- @for image in *.jpg; do\
|
||||
+ @for image in $(notdir $(wildcard $(srcdir)/*.jpg)); do \
|
||||
echo uninstalling $${image} in $(DESTDIR)$(xsanedocdir)/$${image}...; \
|
||||
rm -f $(DESTDIR)$(xsanedocdir)/$${image} || exit 1; \
|
||||
done
|
||||
diff --git a/lib/Makefile.in b/lib/Makefile.in
|
||||
index 7567d54..6be1eeb 100644
|
||||
--- a/lib/Makefile.in
|
||||
+++ b/lib/Makefile.in
|
||||
@@ -30,7 +30,7 @@ RANLIB = @RANLIB@
|
||||
|
||||
CC = @CC@
|
||||
INCLUDES = -I. -I$(srcdir) \
|
||||
- -I$(top_builddir)/include/sane -I$(top_srcdir)/include
|
||||
+ -I$(top_builddir)/include/sane -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
@@ -68,7 +68,7 @@ uninstall:
|
||||
check:
|
||||
|
||||
depend:
|
||||
- makedepend -I. -I../include *.c
|
||||
+ makedepend -I. -I../include $(srcdir)/*.c
|
||||
|
||||
clean:
|
||||
rm -f *.out *.o *.lo *~ *.a *.bak $(TESTPROGRAMS)
|
||||
diff --git a/src/Makefile.in b/src/Makefile.in
|
||||
index 905ef93..2b246db 100644
|
||||
--- a/src/Makefile.in
|
||||
+++ b/src/Makefile.in
|
||||
@@ -77,10 +77,10 @@ install: $(PROGRAMS)
|
||||
$(INSTALL_DATA) $(srcdir)/xsane-eula.txt $(DESTDIR)$(sanedatadir)/xsane/xsane-eula.txt
|
||||
$(INSTALL_DATA) $(srcdir)/xsane.desktop $(DESTDIR)$(desktopappdir)/xsane.desktop
|
||||
$(INSTALL_DATA) $(srcdir)/xsane.xpm $(DESTDIR)$(pixmapdir)/xsane.xpm
|
||||
- @for logo in *-logo.xpm; do \
|
||||
+ @for logo in $(notdir $(wildcard $(srcdir)/*-logo.xpm)); do \
|
||||
echo installing $(DESTDIR)$(sanedatadir)/xsane/$${logo}; \
|
||||
$(INSTALL_DATA) $(srcdir)/$${logo} $(DESTDIR)$(sanedatadir)/xsane/$${logo}; \
|
||||
- done
|
||||
+ done
|
||||
|
||||
uninstall:
|
||||
@for program in $(BINPROGS); do \
|
||||
@@ -99,7 +99,7 @@ uninstall:
|
||||
rm -f $(DESTDIR)$(desktopappdir)/xsane.desktop
|
||||
echo uninstalling $(DESTDIR)$(pixmapdir)/xsane.xpm
|
||||
rm -f $(DESTDIR)$(pixmapdir)/xsane.xpm
|
||||
- @for logo in *-logo.xpm; do \
|
||||
+ @for logo in $(notdir $(wildcard $(srcdir)/*-logo.xpm)); do \
|
||||
echo uninstalling $(DESTDIR)$(sanedatadir)/xsane/$${logo}; \
|
||||
rm -f $(DESTDIR)$(sanedatadir)/xsane/$${logo}; \
|
||||
done
|
||||
@@ -119,7 +119,7 @@ distclean: clean
|
||||
rm -f Makefile $(PROGRAMS)
|
||||
|
||||
depend:
|
||||
- makedepend $(INCLUDES) *.c
|
||||
+ makedepend $(INCLUDES) $(srcdir)/*.c
|
||||
|
||||
.PHONY: all install depend clean distclean
|
||||
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,53 +0,0 @@
|
||||
From e3f3e266249f77ff655299daeab3128347d6cb17 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Wed, 30 Jan 2013 15:59:40 +0100
|
||||
Subject: [PATCH] patch: desktop-file
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit e472b870c4490f41b9257c835d4c8c72a575e9e9
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Wed Jan 30 15:57:57 2013 +0100
|
||||
|
||||
desktop file: use Name, GenericName, X-GNOME-FullName
|
||||
|
||||
commit 9f7f6a039193f91473ded79780bd72e29d7b94fb
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Wed Jan 30 15:57:14 2013 +0100
|
||||
|
||||
desktop file: remove obsolete encoding key
|
||||
|
||||
commit 79a444793a60bd729c72283ad1920f0ce9c65dc2
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:41:23 2010 +0100
|
||||
|
||||
customize desktop file
|
||||
---
|
||||
src/xsane.desktop | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/xsane.desktop b/src/xsane.desktop
|
||||
index d5161e5..a2a4a61 100644
|
||||
--- a/src/xsane.desktop
|
||||
+++ b/src/xsane.desktop
|
||||
@@ -1,9 +1,14 @@
|
||||
[Desktop Entry]
|
||||
-Encoding=UTF-8
|
||||
-Name=XSane - Scanning
|
||||
+Version=1.0
|
||||
+#Name=XSane - Scanning
|
||||
+Name=XSane
|
||||
+GenericName=Scanner Tool
|
||||
+X-GNOME-FullName=XSane (Scanner Tool)
|
||||
Comment=Acquire images from a scanner
|
||||
Exec=xsane
|
||||
+TryExec=xsane
|
||||
Icon=xsane
|
||||
Terminal=false
|
||||
Type=Application
|
||||
-Categories=Application;Graphics
|
||||
+Categories=Graphics;2DGraphics;RasterGraphics;Scanning;GTK;
|
||||
+StartupNotify=true
|
||||
--
|
||||
1.8.1
|
||||
|
@ -1,41 +0,0 @@
|
||||
From bd29bb933cf80f397dd28286635da2aec58e6e6c Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 16 Aug 2012 11:26:54 +0200
|
||||
Subject: [PATCH] patch: libpng
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 9df6d60274c95b5081faf5b398aa27cde969c649
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon Nov 21 13:50:38 2011 +0100
|
||||
|
||||
support libpng-1.5
|
||||
---
|
||||
src/xsane-save.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/xsane-save.c b/src/xsane-save.c
|
||||
index 87ef685..5461bf1 100644
|
||||
--- a/src/xsane-save.c
|
||||
+++ b/src/xsane-save.c
|
||||
@@ -4912,7 +4912,7 @@ int xsane_save_png(FILE *outfile, int compression, FILE *imagefile, Image_info *
|
||||
return -1; /* error */
|
||||
}
|
||||
|
||||
- if (setjmp(png_ptr->jmpbuf))
|
||||
+ if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG);
|
||||
xsane_back_gtk_error(buf, TRUE);
|
||||
@@ -5102,7 +5102,7 @@ int xsane_save_png_16(FILE *outfile, int compression, FILE *imagefile, Image_inf
|
||||
return -1; /* error */
|
||||
}
|
||||
|
||||
- if (setjmp(png_ptr->jmpbuf))
|
||||
+ if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, ERR_LIBPNG);
|
||||
xsane_back_gtk_error(buf, TRUE);
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,60 +0,0 @@
|
||||
From d8bf0d3f0af16e208b52084f19a9a1287acbcea0 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri, 2 Sep 2011 11:56:26 +0200
|
||||
Subject: [PATCH] patch: preview-selection
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit e7c03a6de0c76256810b6340e0a954e88c3448e9
|
||||
Author: Reinhard Fössmeier <info@ais-sanmarino.org>
|
||||
Date: Wed May 12 20:23:18 2010 +0200
|
||||
|
||||
fixed a problem in mouse event processing
|
||||
|
||||
Fixed a problem in mouse event processing that interfered with selecting
|
||||
the scan rectangle in the preview window.
|
||||
---
|
||||
src/xsane-preview.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/xsane-preview.c b/src/xsane-preview.c
|
||||
index f089dd1..264c775 100644
|
||||
--- a/src/xsane-preview.c
|
||||
+++ b/src/xsane-preview.c
|
||||
@@ -80,7 +80,6 @@
|
||||
#include "xsane-preview.h"
|
||||
#include "xsane-preferences.h"
|
||||
#include "xsane-gamma.h"
|
||||
-#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
@@ -3023,9 +3022,9 @@ static gint preview_motion_event_handler(GtkWidget *window, GdkEvent *event, gpo
|
||||
preview_display_color_components(p, event->motion.x, event->motion.y);
|
||||
|
||||
switch (((GdkEventMotion *)event)->state &
|
||||
- GDK_Num_Lock & GDK_Caps_Lock & GDK_Shift_Lock & GDK_Scroll_Lock) /* mask all Locks */
|
||||
+ (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) /* only check for mouse buttons */
|
||||
{
|
||||
- case 256: /* left button */
|
||||
+ case GDK_BUTTON1_MASK: /* left button */
|
||||
|
||||
DBG(DBG_info2, "left button\n");
|
||||
|
||||
@@ -3292,8 +3291,8 @@ static gint preview_motion_event_handler(GtkWidget *window, GdkEvent *event, gpo
|
||||
}
|
||||
break;
|
||||
|
||||
- case 512: /* middle button */
|
||||
- case 1024: /* right button */
|
||||
+ case GDK_BUTTON2_MASK: /* middle button */
|
||||
+ case GDK_BUTTON3_MASK: /* right button */
|
||||
DBG(DBG_info2, "middle or right button\n");
|
||||
|
||||
if (p->selection_drag)
|
||||
--
|
||||
1.7.11.4
|
||||
|
@ -1,33 +0,0 @@
|
||||
From a0b23d7e1991b23e2b9ab78bf382c55b9e24cfb9 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri, 25 May 2012 11:47:39 +0200
|
||||
Subject: [PATCH] patch: wmclass
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit d42b7a9dbe397a301373e3cbaa589540a1475a0b
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri May 25 11:45:48 2012 +0200
|
||||
|
||||
set program name -> wmclass to match desktop file name
|
||||
---
|
||||
src/xsane.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/xsane.c b/src/xsane.c
|
||||
index 8b24b0c..eee76ff 100644
|
||||
--- a/src/xsane.c
|
||||
+++ b/src/xsane.c
|
||||
@@ -6208,6 +6208,9 @@ int main(int argc, char **argv)
|
||||
xsane.ipc_pipefd[1] = 0;
|
||||
}
|
||||
|
||||
+ /* Set program name -> wmclass to match desktop file name */
|
||||
+ g_set_prgname("xsane");
|
||||
+
|
||||
#if 0
|
||||
bindtextdomain(PACKAGE, STRINGIFY(LOCALEDIR));
|
||||
textdomain(PACKAGE);
|
||||
--
|
||||
1.7.11.4
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,372 +0,0 @@
|
||||
From 30af0e2edbf061b71bed9536d826894449f0390d Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon, 23 Sep 2013 16:11:31 +0200
|
||||
Subject: [PATCH] patch: lcms2
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit f975accf7e1a08438b63580ea848457d373200f5
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon Sep 23 14:53:45 2013 +0200
|
||||
|
||||
Add support for lcms 2.x.
|
||||
---
|
||||
configure.in | 22 ++++++++++++++----
|
||||
include/config.h.in | 8 ++++++-
|
||||
src/xsane-preview.c | 6 +++--
|
||||
src/xsane-save.c | 38 ++++++++++++++++++++++++++-----
|
||||
src/xsane-viewer.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
src/xsane.h | 8 ++++++-
|
||||
6 files changed, 130 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index df7b114..3659c97 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -130,7 +130,17 @@ if test "${USE_TIFF}" = "yes"; then
|
||||
fi
|
||||
|
||||
if test "${USE_LCMS}" = "yes"; then
|
||||
- AC_CHECK_LIB(lcms, cmsOpenProfileFromFile)
|
||||
+ AC_SEARCH_LIBS(cmsOpenProfileFromFile, [lcms2 lcms])
|
||||
+ if test "${ac_cv_search_cmsOpenProfileFromFile}" != "no"; then
|
||||
+ AC_DEFINE(HAVE_LIBLCMS, 1, [Define if LCMS is to be used.])
|
||||
+ fi
|
||||
+ if test "${ac_cv_search_cmsOpenProfileFromFile}" == "-llcms2"; then
|
||||
+ AC_DEFINE(HAVE_LIBLCMS2, 1, [Define if you have liblcms2.])
|
||||
+ else
|
||||
+ if test "${ac_cv_search_cmsOpenProfileFromFile}" == "-llcms"; then
|
||||
+ AC_DEFINE(HAVE_LIBLCMS1, 1, [Define if you have liblcms.])
|
||||
+ fi
|
||||
+ fi
|
||||
fi
|
||||
|
||||
dnl Checks for library functions.
|
||||
@@ -294,10 +304,14 @@ else
|
||||
echo "* - PNG support deactivated *"
|
||||
fi
|
||||
|
||||
-if test "${ac_cv_lib_lcms_cmsOpenProfileFromFile}" = "yes"; then
|
||||
- echo "* - LCMS (color management) support activated *"
|
||||
+if test "${ac_cv_search_cmsOpenProfileFromFile}" = "-llcms2"; then
|
||||
+ echo "* - LCMS (color management) support activated (lcms2) *"
|
||||
else
|
||||
- echo "* - LCMS (color management) support deactivated *"
|
||||
+ if test "${ac_cv_search_cmsOpenProfileFromFile}" = "-llcms"; then
|
||||
+ echo "* - LCMS (color management) support activated (lcms) *"
|
||||
+ else
|
||||
+ echo "* - LCMS (color management) support deactivated *"
|
||||
+ fi
|
||||
fi
|
||||
|
||||
echo "* *"
|
||||
diff --git a/include/config.h.in b/include/config.h.in
|
||||
index ecc9637..f9a3e40 100755
|
||||
--- a/include/config.h.in
|
||||
+++ b/include/config.h.in
|
||||
@@ -290,9 +290,15 @@
|
||||
/* Define if you have libtiff. */
|
||||
#undef HAVE_LIBTIFF
|
||||
|
||||
-/* Define if you have liblcms. */
|
||||
+/* Define if LCMS is to be used. */
|
||||
#undef HAVE_LIBLCMS
|
||||
|
||||
+/* Define if you have liblcms. */
|
||||
+#undef HAVE_LIBLCMS1
|
||||
+
|
||||
+/* Define if you have liblcms2. */
|
||||
+#undef HAVE_LIBLCMS2
|
||||
+
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
/* OS/2 needs this */
|
||||
# define strncasecmp(a, b, c) strnicmp(a, b, c)
|
||||
diff --git a/src/xsane-preview.c b/src/xsane-preview.c
|
||||
index 6327ca7..6eaf687 100644
|
||||
--- a/src/xsane-preview.c
|
||||
+++ b/src/xsane-preview.c
|
||||
@@ -6346,8 +6346,8 @@ int preview_do_color_correction(Preview *p)
|
||||
cmsHPROFILE hOutProfile = NULL;
|
||||
cmsHPROFILE hProofProfile = NULL;
|
||||
cmsHTRANSFORM hTransform = NULL;
|
||||
- DWORD input_format, output_format;
|
||||
- DWORD cms_flags = 0;
|
||||
+ cmsUInt32Number input_format, output_format;
|
||||
+ cmsUInt32Number cms_flags = 0;
|
||||
int proof = 0;
|
||||
char *cms_proof_icm_profile = NULL;
|
||||
int linesize = 0;
|
||||
@@ -6355,7 +6355,9 @@ int preview_do_color_correction(Preview *p)
|
||||
|
||||
DBG(DBG_proc, "preview_do_color_correction\n");
|
||||
|
||||
+#ifdef HAVE_LIBLCMS1
|
||||
cmsErrorAction(LCMS_ERROR_SHOW);
|
||||
+#endif
|
||||
|
||||
if (preferences.cms_bpc)
|
||||
{
|
||||
diff --git a/src/xsane-save.c b/src/xsane-save.c
|
||||
index 75e0a63..2d0e44b 100644
|
||||
--- a/src/xsane-save.c
|
||||
+++ b/src/xsane-save.c
|
||||
@@ -832,9 +832,9 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
|
||||
cmsHPROFILE hInProfile = NULL;
|
||||
cmsHPROFILE hOutProfile = NULL;
|
||||
cmsHTRANSFORM hTransform = NULL;
|
||||
- DWORD cms_input_format;
|
||||
- DWORD cms_output_format;
|
||||
- DWORD cms_flags = 0;
|
||||
+ cmsUInt32Number cms_input_format;
|
||||
+ cmsUInt32Number cms_output_format;
|
||||
+ cmsUInt32Number cms_flags = 0;
|
||||
|
||||
if (cms_function == XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE)
|
||||
{
|
||||
@@ -843,7 +843,9 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
|
||||
|
||||
DBG(DBG_info, "Prepare CMS transform\n");
|
||||
|
||||
+#ifdef HAVE_LIBLCMS1
|
||||
cmsErrorAction(LCMS_ERROR_SHOW);
|
||||
+#endif
|
||||
|
||||
if (cms_bpc)
|
||||
{
|
||||
@@ -890,10 +892,18 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
|
||||
if (image_info->channels == 1) /* == 1 (grayscale) */
|
||||
{
|
||||
#if 1 /* xxx oli */
|
||||
+# ifdef HAVE_LIBLCMS2
|
||||
+ cmsToneCurve *Gamma = cmsBuildGamma(NULL, 2.2);
|
||||
+# else
|
||||
LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
|
||||
+# endif
|
||||
|
||||
hOutProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
|
||||
+# ifdef HAVE_LIBLCMS2
|
||||
+ cmsFreeToneCurve(Gamma);
|
||||
+# else
|
||||
cmsFreeGamma(Gamma);
|
||||
+# endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -2896,7 +2906,11 @@ static int xsane_write_CSA(FILE *outfile, char *input_profile, int intent)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ n = cmsGetPostScriptCSA(NULL, hProfile, intent, 0, NULL, 0);
|
||||
+#else
|
||||
n = cmsGetPostScriptCSA(hProfile, intent, NULL, 0);
|
||||
+#endif
|
||||
if (n == 0)
|
||||
{
|
||||
return -2;
|
||||
@@ -2908,7 +2922,11 @@ static int xsane_write_CSA(FILE *outfile, char *input_profile, int intent)
|
||||
return -3;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ cmsGetPostScriptCSA(NULL, hProfile, intent, 0, buffer, n);
|
||||
+#else
|
||||
cmsGetPostScriptCSA(hProfile, intent, buffer, n);
|
||||
+#endif
|
||||
buffer[n] = 0;
|
||||
|
||||
fprintf(outfile, "%s", buffer);
|
||||
@@ -2927,7 +2945,7 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
|
||||
cmsHPROFILE hProfile;
|
||||
size_t n;
|
||||
char* buffer;
|
||||
- DWORD flags = cmsFLAGS_NODEFAULTRESOURCEDEF;
|
||||
+ cmsUInt32Number flags = cmsFLAGS_NODEFAULTRESOURCEDEF;
|
||||
|
||||
hProfile = cmsOpenProfileFromFile(output_profile, "r");
|
||||
if (!hProfile)
|
||||
@@ -2940,7 +2958,11 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
|
||||
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ n = cmsGetPostScriptCRD(NULL, hProfile, intent, flags, NULL, 0);
|
||||
+#else
|
||||
n = cmsGetPostScriptCRDEx(hProfile, intent, flags, NULL, 0);
|
||||
+#endif
|
||||
if (n == 0)
|
||||
{
|
||||
return -2;
|
||||
@@ -2952,7 +2974,11 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
|
||||
return -3;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ cmsGetPostScriptCRD(NULL, hProfile, intent, flags, buffer, n);
|
||||
+#else
|
||||
cmsGetPostScriptCRDEx(hProfile, intent, flags, buffer, n);
|
||||
+#endif
|
||||
buffer[n] = 0;
|
||||
|
||||
fprintf(outfile, "%s", buffer);
|
||||
@@ -4349,7 +4375,7 @@ static void xsane_jpeg_embed_scanner_icm_profile(j_compress_ptr cinfo_ptr, const
|
||||
{
|
||||
FILE *icm_profile;
|
||||
size_t size, embed_len;
|
||||
- LPBYTE embed_buffer;
|
||||
+ cmsUInt8Number *embed_buffer;
|
||||
|
||||
DBG(DBG_proc, "xsane_jpeg_embed_scanner_icm_profile(%s)\n", icm_filename);
|
||||
|
||||
@@ -4363,7 +4389,7 @@ static void xsane_jpeg_embed_scanner_icm_profile(j_compress_ptr cinfo_ptr, const
|
||||
size = ftell(icm_profile);
|
||||
fseek(icm_profile, 0, SEEK_SET);
|
||||
|
||||
- embed_buffer = (LPBYTE) malloc(size + 1);
|
||||
+ embed_buffer = (cmsUInt8Number *) malloc(size + 1);
|
||||
if (embed_buffer)
|
||||
{
|
||||
embed_len = fread(embed_buffer, 1, size, icm_profile);
|
||||
diff --git a/src/xsane-viewer.c b/src/xsane-viewer.c
|
||||
index 69a444d..844c077 100644
|
||||
--- a/src/xsane-viewer.c
|
||||
+++ b/src/xsane-viewer.c
|
||||
@@ -1795,6 +1795,9 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
|
||||
{
|
||||
Viewer *v = (Viewer *) data;
|
||||
int val;
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ cmsUInt16Number alarm_codes[cmsMAXCHANNELS];
|
||||
+#endif
|
||||
|
||||
g_signal_handlers_block_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[0]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
|
||||
g_signal_handlers_block_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[1]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
|
||||
@@ -1811,6 +1814,49 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
|
||||
v->cms_gamut_alarm_color = val;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(v->cms_gamut_alarm_color_widget[v->cms_gamut_alarm_color]), TRUE);
|
||||
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ switch(v->cms_gamut_alarm_color)
|
||||
+ {
|
||||
+ default:
|
||||
+ case 0: /* black */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 0;
|
||||
+ break;
|
||||
+
|
||||
+ case 1: /* gray */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 128;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 128;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 128;
|
||||
+ break;
|
||||
+
|
||||
+ case 2: /* white */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 255;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 255;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 255;
|
||||
+ break;
|
||||
+
|
||||
+ case 3: /* red */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 255;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 0;
|
||||
+ break;
|
||||
+
|
||||
+ case 4: /* green */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 255;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 0;
|
||||
+ break;
|
||||
+
|
||||
+ case 5: /* blue */
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 255;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ cmsSetAlarmCodes(alarm_codes);
|
||||
+#else
|
||||
switch(v->cms_gamut_alarm_color)
|
||||
{
|
||||
default:
|
||||
@@ -1838,6 +1884,7 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
|
||||
cmsSetAlarmCodes(0, 0, 255);
|
||||
break;
|
||||
}
|
||||
+#endif
|
||||
|
||||
g_signal_handlers_unblock_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[0]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
|
||||
g_signal_handlers_unblock_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[1]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
|
||||
@@ -2172,9 +2219,9 @@ static int xsane_viewer_read_image(Viewer *v)
|
||||
cmsHTRANSFORM hTransform = NULL;
|
||||
int proof = 0;
|
||||
char *cms_proof_icm_profile = NULL;
|
||||
- DWORD cms_input_format;
|
||||
- DWORD cms_output_format;
|
||||
- DWORD cms_flags = 0;
|
||||
+ cmsUInt32Number cms_input_format;
|
||||
+ cmsUInt32Number cms_output_format;
|
||||
+ cmsUInt32Number cms_flags = 0;
|
||||
#endif
|
||||
|
||||
/* open imagefile */
|
||||
@@ -2203,7 +2250,9 @@ static int xsane_viewer_read_image(Viewer *v)
|
||||
|
||||
if ((v->enable_color_management) && (v->cms_enable))
|
||||
{
|
||||
+#ifdef HAVE_LIBLCMS1
|
||||
cmsErrorAction(LCMS_ERROR_SHOW);
|
||||
+#endif
|
||||
|
||||
if (v->cms_bpc)
|
||||
{
|
||||
@@ -2801,6 +2850,9 @@ Viewer *xsane_viewer_new(char *filename, char *selection_filetype, int allow_red
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *zoom_option_menu, *zoom_menu, *zoom_menu_item;
|
||||
int i, selection;
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ cmsUInt16Number alarm_codes[cmsMAXCHANNELS];
|
||||
+#endif
|
||||
|
||||
DBG(DBG_proc, "viewer_new(%s)\n", filename);
|
||||
|
||||
@@ -2830,8 +2882,15 @@ Viewer *xsane_viewer_new(char *filename, char *selection_filetype, int allow_red
|
||||
v->cms_proofing_intent = INTENT_ABSOLUTE_COLORIMETRIC;
|
||||
v->cms_gamut_check = 0;
|
||||
v->cms_gamut_alarm_color = 3; /* red */
|
||||
+#ifdef HAVE_LIBLCMS2
|
||||
+ alarm_codes[0] = (cmsUInt16Number) 255;
|
||||
+ alarm_codes[1] = (cmsUInt16Number) 0;
|
||||
+ alarm_codes[2] = (cmsUInt16Number) 0;
|
||||
+ cmsSetAlarmCodes(alarm_codes);
|
||||
+#else
|
||||
cmsSetAlarmCodes(255, 0, 0);
|
||||
#endif
|
||||
+#endif
|
||||
if (selection_filetype)
|
||||
{
|
||||
v->selection_filetype = strdup(selection_filetype);
|
||||
diff --git a/src/xsane.h b/src/xsane.h
|
||||
index 4067d61..adcc0ed 100644
|
||||
--- a/src/xsane.h
|
||||
+++ b/src/xsane.h
|
||||
@@ -70,7 +70,13 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef HAVE_LIBLCMS
|
||||
-# include "lcms.h"
|
||||
+# ifdef HAVE_LIBLCMS2
|
||||
+# include "lcms2.h"
|
||||
+# else
|
||||
+# include "lcms.h"
|
||||
+typedef BYTE cmsUInt8Number;
|
||||
+typedef DWORD cmsUInt32Number;
|
||||
+# endif
|
||||
#else
|
||||
# define cmsHTRANSFORM void *
|
||||
#endif
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 2dbbd80a5fb80741729c7cd5027af058b9c08c2c Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon, 8 Jul 2013 17:46:06 +0200
|
||||
Subject: [PATCH] patch: man-page
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit e1915d50b677458127a8ad1c7953ee1d2e2ce250
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon Jul 8 17:44:26 2013 +0200
|
||||
|
||||
xsane.man: update command line options
|
||||
---
|
||||
doc/xsane.man | 29 ++++++++++++++++++++++++-----
|
||||
1 file changed, 24 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/doc/xsane.man b/doc/xsane.man
|
||||
index ee363a8..38b453d 100644
|
||||
--- a/doc/xsane.man
|
||||
+++ b/doc/xsane.man
|
||||
@@ -4,6 +4,7 @@
|
||||
xsane - scanner frontend for SANE
|
||||
.SH SYNOPSIS
|
||||
.B xsane
|
||||
+.RB [ --help | -h ]
|
||||
.RB [ --version | -v ]
|
||||
.RB [ --license | -l ]
|
||||
.RB [ --device-settings
|
||||
@@ -13,8 +14,9 @@ xsane - scanner frontend for SANE
|
||||
.RB [ --viewer | -V ]
|
||||
.RB [ --save | -s ]
|
||||
.RB [ --copy | -c ]
|
||||
+.RB [ --multipage | -m ]
|
||||
.RB [ --fax | -f ]
|
||||
-.RB [ --mail | -m ]
|
||||
+.RB [ --email | -e ]
|
||||
.RB [ --no-mode-selection | -n ]
|
||||
.RB [ --Fixed | -F ]
|
||||
.RB [ --Resizable | -R ]
|
||||
@@ -25,6 +27,7 @@ xsane - scanner frontend for SANE
|
||||
.IR name ]
|
||||
.RB [ --display
|
||||
.IR d ]
|
||||
+.RB [ --no-xshm ]
|
||||
.RB [ --sync ]
|
||||
.RI [ devicename ]
|
||||
.SH DESCRIPTION
|
||||
@@ -121,6 +124,12 @@ and
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
If the
|
||||
+.B --help
|
||||
+or
|
||||
+.B -h
|
||||
+flag is given xsane displays a short help message and exits.
|
||||
+.PP
|
||||
+If the
|
||||
.B --version
|
||||
or
|
||||
.B -v
|
||||
@@ -128,7 +137,7 @@ flag is given xsane prints a version information, some
|
||||
information about gtk+ and gimp version it is compiled
|
||||
against and lists the supported file formats, then it exits.
|
||||
.PP
|
||||
-when the
|
||||
+If the
|
||||
.B --license
|
||||
or
|
||||
.B -l
|
||||
@@ -161,16 +170,22 @@ or
|
||||
flag forces xsane to start in copy mode.
|
||||
.PP
|
||||
The
|
||||
+.B --multipage
|
||||
+or
|
||||
+.B -m
|
||||
+flag forces xsane to start in multipage mode.
|
||||
+.PP
|
||||
+The
|
||||
.B --fax
|
||||
or
|
||||
.B -f
|
||||
flag forces xsane to start in fax mode.
|
||||
.PP
|
||||
The
|
||||
-.B --mail
|
||||
+.B --email
|
||||
or
|
||||
-.B -m
|
||||
-flag forces xsane to start in mail mode.
|
||||
+.B -e
|
||||
+flag forces xsane to start in e-mail mode.
|
||||
.PP
|
||||
The
|
||||
.B --no-mode-selection
|
||||
@@ -217,6 +232,10 @@ flag selects the X11 display used to present the graphical user-interface
|
||||
for details).
|
||||
.PP
|
||||
The
|
||||
+.B --no-xshm
|
||||
+flag forces xsane not to use shared memory images.
|
||||
+.PP
|
||||
+The
|
||||
.B --sync
|
||||
flag requests a synchronous connection with the X11 server. This is for
|
||||
debugging purposes only.
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,91 +0,0 @@
|
||||
From 2f7abcaa7ad39f118b2f49fdcba9c90b37b3d972 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri, 5 Jul 2013 16:15:55 +0200
|
||||
Subject: [PATCH] patch: no-file-selected
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit f887550276e324151947960292a7266c71aeb573
|
||||
Author: Pavel Polischouk <pavel.polischouk@gmail.com>
|
||||
Date: Fri Nov 25 23:55:49 2011 -0500
|
||||
|
||||
fix changing working directory (#621778)
|
||||
|
||||
The patch checks the value returned by xsane_back_gtk_get_filename. In
|
||||
most places it will check the result properly (taking 0 for success),
|
||||
except one case where it takes 0 for an error, and this happens in
|
||||
xsane_browse_filename_callback (xsane-front-gtk.c). The new code would
|
||||
abort copying the filename into preferences structure if 0 was returned,
|
||||
and that's the OK case. I'm very curious how wonderfully it would blow
|
||||
up if an actual error was returned, but that's a different story.
|
||||
|
||||
commit 2c02ddd8282fa231107d8860aee4d92bdb5cb8e8
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Fri Nov 19 12:25:54 2010 +0100
|
||||
|
||||
don't crash if no files are selected (#608047)
|
||||
---
|
||||
src/xsane-back-gtk.c | 20 ++++++++++++++++----
|
||||
src/xsane-front-gtk.c | 6 +++++-
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/xsane-back-gtk.c b/src/xsane-back-gtk.c
|
||||
index bca9eb2..6ef1506 100644
|
||||
--- a/src/xsane-back-gtk.c
|
||||
+++ b/src/xsane-back-gtk.c
|
||||
@@ -1111,6 +1111,11 @@ static void xsane_back_gtk_filetype2_callback(GtkWidget *widget, gpointer data)
|
||||
|
||||
chooser_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser));
|
||||
|
||||
+ if (!chooser_filename)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if ((new_filetype) && (*new_filetype))
|
||||
{
|
||||
extension = strrchr(chooser_filename, '.');
|
||||
@@ -1505,12 +1510,19 @@ int xsane_back_gtk_get_filename(const char *label, const char *default_name, siz
|
||||
#endif
|
||||
|
||||
chooser_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser));
|
||||
- strncpy(filename, chooser_filename, max_len - 1);
|
||||
- g_free(chooser_filename);
|
||||
+ if (chooser_filename)
|
||||
+ {
|
||||
+ strncpy(filename, chooser_filename, max_len - 1);
|
||||
+ g_free(chooser_filename);
|
||||
|
||||
- filename[max_len - 1] = '\0';
|
||||
+ filename[max_len - 1] = '\0';
|
||||
|
||||
- ok = TRUE;
|
||||
+ ok = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ ok = FALSE;
|
||||
+ }
|
||||
}
|
||||
|
||||
gtk_widget_destroy(filechooser);
|
||||
diff --git a/src/xsane-front-gtk.c b/src/xsane-front-gtk.c
|
||||
index 4c973fb..7bb49b0 100644
|
||||
--- a/src/xsane-front-gtk.c
|
||||
+++ b/src/xsane-front-gtk.c
|
||||
@@ -1333,7 +1333,11 @@ static void xsane_browse_filename_callback(GtkWidget *widget, gpointer data)
|
||||
snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_OUTPUT_FILENAME, xsane.device_text);
|
||||
|
||||
umask((mode_t) preferences.directory_umask); /* define new file permissions */
|
||||
- xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, &preferences.cms_function, XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE, show_extra_widgets, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES);
|
||||
+ if (xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, &preferences.cms_function, XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE, show_extra_widgets, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES) < 0)
|
||||
+ {
|
||||
+ xsane_set_sensitivity(TRUE);
|
||||
+ return;
|
||||
+ }
|
||||
umask(XSANE_DEFAULT_UMASK); /* define new file permissions */
|
||||
|
||||
if (preferences.filename)
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,51 +0,0 @@
|
||||
From c0686879ac66c1933aefbb62b69afb0c9a0db912 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon, 9 Sep 2013 17:13:15 +0200
|
||||
Subject: [PATCH] patch: pdf-no-high-bpp
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 9f7d97e114389595481f6e9d3ac1038972f3f73b
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Mon Sep 9 17:08:38 2013 +0200
|
||||
|
||||
avoid producing PDFs with bpp > 8
|
||||
---
|
||||
src/xsane-save.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/xsane-save.c b/src/xsane-save.c
|
||||
index 5461bf1..75e0a63 100644
|
||||
--- a/src/xsane-save.c
|
||||
+++ b/src/xsane-save.c
|
||||
@@ -4205,6 +4205,18 @@ int xsane_save_pdf(FILE *outfile, FILE *imagefile, Image_info *image_info, float
|
||||
|
||||
*cancel_save = 0;
|
||||
|
||||
+ if (image_info->depth > 8)
|
||||
+ {
|
||||
+ char buf[TEXTBUFSIZE];
|
||||
+
|
||||
+ snprintf(buf, sizeof(buf), "%s %s", ERR_DURING_SAVE, "PDF doesn't allow bit depths > 8");
|
||||
+ DBG(DBG_error, "%s\n", buf);
|
||||
+ xsane_back_gtk_decision(ERR_HEADER_ERROR, (gchar **) error_xpm, buf, BUTTON_OK, NULL, TRUE /* wait */);
|
||||
+ *cancel_save = 1;
|
||||
+
|
||||
+ goto bail_out;
|
||||
+ }
|
||||
+
|
||||
xsane_save_pdf_create_document_header(outfile, &xref, 1, flatedecode);
|
||||
|
||||
if (apply_ICM_profile && (cms_function == XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE))
|
||||
@@ -4232,6 +4244,8 @@ int xsane_save_pdf(FILE *outfile, FILE *imagefile, Image_info *image_info, float
|
||||
*cancel_save = 1;
|
||||
}
|
||||
|
||||
+bail_out:
|
||||
+
|
||||
return (*cancel_save);
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,242 +0,0 @@
|
||||
From 3b5d3b7e1f320b0bfbe48024a586c0a22375aa2d Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu, 3 Jul 2014 10:38:03 +0200
|
||||
Subject: [PATCH] patch: signal-handling
|
||||
|
||||
Squashed commit of the following:
|
||||
|
||||
commit 1e9e8cf5edc469114c8eadf46817cd5c1261b35c
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu Jul 3 10:14:52 2014 +0200
|
||||
|
||||
don't use g_unix_open_pipe(), g_unix_fd_add()
|
||||
|
||||
These functions have only recently been added to glib. Use pipe()/
|
||||
fcntl() and g_io_channel_unix_new()/g_io_add_watch() instead which are
|
||||
available in the minimum glib version needed for gtk+-2.x.
|
||||
|
||||
commit acbdf3f693d3d2a78ee7490ca1bf76957daf00cf
|
||||
Author: Nils Philippsen <nils@redhat.com>
|
||||
Date: Thu Mar 13 13:38:12 2014 +0100
|
||||
|
||||
separate signal handlers in top and bottom half
|
||||
|
||||
This is to avoid race-conditions occurring when a signal is received
|
||||
while the signal handler is not yet finished. It also avoids calling
|
||||
non-reentrant functions from a signal handler. The top half (the real
|
||||
signal handler) just writes a character into a pipe which gets picked up
|
||||
and serviced by the bottom half from the normal event loop, this
|
||||
serializes things and makes using non-reentrant functions safe.
|
||||
---
|
||||
src/xsane.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 136 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/xsane.c b/src/xsane.c
|
||||
index 2b9211b..fc2ebbe 100644
|
||||
--- a/src/xsane.c
|
||||
+++ b/src/xsane.c
|
||||
@@ -47,6 +47,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/wait.h>
|
||||
+#include <glib-unix.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -121,6 +122,7 @@ static const Preferences_medium_t pref_default_medium[]=
|
||||
|
||||
int DBG_LEVEL = 0;
|
||||
static guint xsane_resolution_timer = 0;
|
||||
+static int xsane_signal_pipe[2];
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
@@ -161,8 +163,11 @@ void xsane_pref_save(void);
|
||||
static int xsane_pref_restore(void);
|
||||
static void xsane_pref_save_media(void);
|
||||
static void xsane_pref_restore_media(void);
|
||||
-static RETSIGTYPE xsane_quit_handler(int signal);
|
||||
-static RETSIGTYPE xsane_sigchld_handler(int signal);
|
||||
+static RETSIGTYPE xsane_signal_handler_top_half(int signal);
|
||||
+static gboolean xsane_signal_handler_bottom_half(GIOChannel *source,
|
||||
+ GIOCondition condition,
|
||||
+ gpointer user_data);
|
||||
+static void xsane_sigchld_handler(void);
|
||||
static void xsane_quit(void);
|
||||
static void xsane_exit(void);
|
||||
static gint xsane_standard_option_win_delete(GtkWidget *widget, gpointer data);
|
||||
@@ -2296,16 +2301,119 @@ static void xsane_pref_restore_media(void)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
-static RETSIGTYPE xsane_quit_handler(int signal)
|
||||
+static RETSIGTYPE xsane_signal_handler_top_half(int signal)
|
||||
{
|
||||
- DBG(DBG_proc, "xsane_quit_handler\n");
|
||||
+ const char *msg_func = "xsane_signal_handler_top_half(): ";
|
||||
+ const char *msg_short_write = "Short write() while processing signal.\n";
|
||||
+ const char *msg_err = "Error during write().\n";
|
||||
+ char sig_char;
|
||||
+ ssize_t written;
|
||||
+ int errno_saved = errno;
|
||||
|
||||
- xsane_quit();
|
||||
+ switch (signal)
|
||||
+ {
|
||||
+ case SIGTERM:
|
||||
+ sig_char = 't';
|
||||
+ break;
|
||||
+ case SIGINT:
|
||||
+ sig_char = 'i';
|
||||
+ break;
|
||||
+ case SIGHUP:
|
||||
+ sig_char = 'h';
|
||||
+ break;
|
||||
+ case SIGCHLD:
|
||||
+ sig_char = 'c';
|
||||
+ break;
|
||||
+ default:
|
||||
+ sig_char = '?';
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if ((written = write(xsane_signal_pipe[1], &sig_char, 1)) <= 0)
|
||||
+ {
|
||||
+ /* At this point, all bets are off. Salvage what we can. */
|
||||
+
|
||||
+ const char *msg = (written == 0) ? msg_short_write : msg_err;
|
||||
+
|
||||
+ if ((write(STDERR_FILENO, msg_func, strlen(msg_func)) < 0) ||
|
||||
+ (write(STDERR_FILENO, msg, strlen(msg)) < 0))
|
||||
+ {
|
||||
+ /* This is really a no-op, but at this point it doesn't really matter
|
||||
+ * anymore if the writes succeeded or not. */
|
||||
+ goto bail_out;
|
||||
+ }
|
||||
+
|
||||
+bail_out:
|
||||
+ /* Ignore SIGCHLD errors, zombie processes don't hurt that much. */
|
||||
+ if (signal != SIGCHLD)
|
||||
+ {
|
||||
+ struct SIGACTION act;
|
||||
+ memset(&act, 0, sizeof(act));
|
||||
+ act.sa_handler = SIG_DFL;
|
||||
+ sigaction(signal, &act, NULL);
|
||||
+ raise(signal);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ errno = errno_saved;
|
||||
+}
|
||||
+
|
||||
+static gboolean xsane_signal_handler_bottom_half(GIOChannel *source,
|
||||
+ GIOCondition condition,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ char sig_char;
|
||||
+ ssize_t readlen;
|
||||
+
|
||||
+ DBG(DBG_proc, "xsane_signal_handler_bottom_half\n");
|
||||
+
|
||||
+ while ((readlen = read(xsane_signal_pipe[0], &sig_char, 1)) != 0)
|
||||
+ {
|
||||
+ if (readlen < 0)
|
||||
+ {
|
||||
+ if (errno == EINTR)
|
||||
+ {
|
||||
+ /* if interrupted by signal, just repeat reading */
|
||||
+ continue;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ switch (sig_char)
|
||||
+ {
|
||||
+ case 't':
|
||||
+ case 'i':
|
||||
+ case 'h':
|
||||
+ xsane_quit();
|
||||
+ break;
|
||||
+ case 'c':
|
||||
+ xsane_sigchld_handler();
|
||||
+ break;
|
||||
+ default:
|
||||
+ DBG(DBG_error,
|
||||
+ "Don't know how to cope with character-encoded signal: '%c'\n",
|
||||
+ sig_char);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* previous invocation might have read more than it should, so ignore
|
||||
+ * EAGAIN/EWOULDBLOCK */
|
||||
+ if (readlen < 0 && errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
+ {
|
||||
+ DBG(DBG_error, "Error while reading from pipe: %d '%s'\n", errno,
|
||||
+ strerror(errno));
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
-static RETSIGTYPE xsane_sigchld_handler(int signal)
|
||||
+static void xsane_sigchld_handler(void)
|
||||
{
|
||||
int status;
|
||||
XsaneChildprocess **childprocess_listptr = &xsane.childprocess_list;
|
||||
@@ -6026,6 +6134,8 @@ void xsane_interface(int argc, char **argv)
|
||||
{
|
||||
struct SIGACTION act;
|
||||
|
||||
+ GIOChannel *gio_pipe_read;
|
||||
+
|
||||
DBG(DBG_proc, "xsane_interface\n");
|
||||
|
||||
xsane.info_label = NULL;
|
||||
@@ -6069,18 +6179,29 @@ void xsane_interface(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
+ if ((pipe(xsane_signal_pipe) == -1) ||
|
||||
+ (fcntl(xsane_signal_pipe[0], F_SETFD, FD_CLOEXEC) == -1) ||
|
||||
+ (fcntl(xsane_signal_pipe[0], F_SETFL, O_NONBLOCK) == -1) ||
|
||||
+ (fcntl(xsane_signal_pipe[1], F_SETFD, FD_CLOEXEC) == -1) ||
|
||||
+ (fcntl(xsane_signal_pipe[1], F_SETFL, O_NONBLOCK) == -1) ||
|
||||
+ !(gio_pipe_read = g_io_channel_unix_new(xsane_signal_pipe[0])) ||
|
||||
+ !g_io_add_watch(gio_pipe_read, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI,
|
||||
+ xsane_signal_handler_bottom_half, NULL))
|
||||
+ {
|
||||
+ DBG(DBG_error,
|
||||
+ "Couldn't create signal handling pipe, set flags on it or install\n"
|
||||
+ "bottom half of handler.\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
/* define SIGTERM, SIGINT, SIGHUP-handler to make sure that e.g. all temporary files are deleted */
|
||||
/* when xsane gets such a signal */
|
||||
memset(&act, 0, sizeof(act));
|
||||
- act.sa_handler = xsane_quit_handler;
|
||||
- sigaction(SIGTERM, &act, 0);
|
||||
- sigaction(SIGINT, &act, 0);
|
||||
- sigaction(SIGHUP, &act, 0);
|
||||
-
|
||||
- /* add a signal handler that cleans up zombie child processes */
|
||||
- memset(&act, 0, sizeof(act));
|
||||
- act.sa_handler = xsane_sigchld_handler;
|
||||
- sigaction(SIGCHLD, &act, 0);
|
||||
+ act.sa_handler = xsane_signal_handler_top_half;
|
||||
+ sigaction(SIGTERM, &act, NULL);
|
||||
+ sigaction(SIGINT, &act, NULL);
|
||||
+ sigaction(SIGHUP, &act, NULL);
|
||||
+ sigaction(SIGCHLD, &act, NULL);
|
||||
|
||||
gtk_main();
|
||||
sane_exit();
|
||||
--
|
||||
1.9.3
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
Avoid implicit function declarations, for improved compatibility with
|
||||
future compilers.
|
||||
|
||||
Fixed upstream via:
|
||||
|
||||
commit 562008027f343127d70bae44457cf8f06c666428
|
||||
Author: Ralph Little <littlesincanada@yahoo.co.uk>
|
||||
Date: Thu Aug 29 21:49:08 2019 -0700
|
||||
|
||||
m4/sane.m4: remove m4/sane.m4 and update aclocal.m4 to suit.
|
||||
|
||||
We are now using pkg-config and it is pretty much a one-liner.
|
||||
No point in a whole file in m4 for just this feature.
|
||||
|
||||
diff -up xsane-0.999/configure.c99 xsane-0.999/configure
|
||||
--- xsane-0.999/configure.c99 2023-01-17 17:11:53.179785420 +0100
|
||||
+++ xsane-0.999/configure 2023-01-17 17:11:58.234735290 +0100
|
||||
@@ -6672,6 +6672,7 @@ else
|
||||
|
||||
#include <sane/sane.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
diff -up xsane-0.999/m4/sane.m4.c99 xsane-0.999/m4/sane.m4
|
||||
--- xsane-0.999/m4/sane.m4.c99 2023-01-17 17:11:08.940224113 +0100
|
||||
+++ xsane-0.999/m4/sane.m4 2023-01-17 17:11:11.565198082 +0100
|
||||
@@ -44,6 +44,7 @@ dnl
|
||||
AC_TRY_RUN([
|
||||
#include <sane/sane.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
@ -1 +0,0 @@
|
||||
PLUGINFILE=@BINDIR@/xsane-gimp
|
Loading…
Reference in New Issue
Block a user