Hello community, here is the log from the commit of package xsane for openSUSE:Factory checked in at 2017-07-25 11:40:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xsane (Old) and /work/SRC/openSUSE:Factory/.xsane.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xsane" Tue Jul 25 11:40:17 2017 rev:29 rq:512222 version:0.999 Changes: -------- --- /work/SRC/openSUSE:Factory/xsane/xsane.changes 2016-05-10 09:27:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.xsane.new/xsane.changes 2017-07-25 11:41:09.557878665 +0200 @@ -1,0 +2,33 @@ +Fri Jul 21 12:27:31 UTC 2017 - tchva...@suse.com + +- Rebase patches to include rh/gentoo/debian ones: + A 001-xdg-open-as-default-browser.patch + A 002-close-fds.patch + A 004-ipv6-support.patch + A 006-preview-selection.patch + A 100-remove-non-working-help.patch + A 101-xsane_fix_pdf_floats.patch + A 200-fix_options_handling_fix.patch + A 201-fix_pdf_xref.patch + A 901-desktop-file.patch + A 902-license-dialog.patch + A 903-fix_broken_links.patch + A 904-fix_message_typo.patch + A 907-fix_spin_button_pagesize.patch + A 908-no-file-selected.patch + A 0005-m4.patch + A 0010-fix_missing_sane-config.patch +- Drop patches hanled in the above: + D no-eula.patch + D remove-non-working-help.patch + D xdg-open-as-default-browser.patch + D xsane_fix_pdf_floats.patch + D xsane-desktop.patch + +------------------------------------------------------------------- +Fri Jul 21 12:15:08 UTC 2017 - tchva...@suse.com + +- Add patch to build with lcms2 instead of lcms: + * xsane-0.999-lcms2.patch + +------------------------------------------------------------------- Old: ---- no-eula.patch remove-non-working-help.patch xdg-open-as-default-browser.patch xsane-desktop.patch xsane_fix_pdf_floats.patch New: ---- 0005-m4.patch 001-xdg-open-as-default-browser.patch 0010-fix_missing_sane-config.patch 002-close-fds.patch 004-ipv6-support.patch 006-preview-selection.patch 100-remove-non-working-help.patch 101-xsane_fix_pdf_floats.patch 200-fix_options_handling_fix.patch 201-fix_pdf_xref.patch 901-desktop-file.patch 902-license-dialog.patch 903-fix_broken_links.patch 907-fix_spin_button_pagesize.patch 908-no-file-selected.patch xsane-0.999-lcms2.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xsane.spec ++++++ --- /var/tmp/diff_new_pack.TNiKOk/_old 2017-07-25 11:41:11.329628522 +0200 +++ /var/tmp/diff_new_pack.TNiKOk/_new 2017-07-25 11:41:11.329628522 +0200 @@ -1,7 +1,7 @@ # # spec file for package xsane # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,51 +25,38 @@ Url: http://www.xsane.org/ # URL for Source0: http://www.xsane.org/download/xsane-0.998.tar.gz Source0: http://www.xsane.org/download/xsane-%{version}.tar.gz -# PATCH-FIX-UPSTREAM xsane-desktop.patch sbra...@suse.cz -- Fix upstream desktop file. -Patch: %{name}-desktop.patch -# fix printf using locale dependent float representation -Patch1: xsane_fix_pdf_floats.patch -# fix build with libpng15 -Patch2: xsane-libpng15.patch -# Patch100... is SUSE specific stuff: -# Patch100 suppresses the disclaimer of warranty and liability dialog -# and adds a modification note and adds a openSUSE Bugzilla URL -# to make the change obvious for the user and direct bug reports to us: -Patch100: no-eula.patch -# Patch101 sets DEFAULT_BROWSER "xdg-open" in xsane.h -# to get the right browser launched for KDE and Gnome users: -Patch101: xdg-open-as-default-browser.patch -# Patch102 removes the items in the help menue regarding backend documentation -# because the referred files do not exist (dead URLs in sane-backends-doc.html): -Patch102: remove-non-working-help.patch -# bnc#542539 -Patch103: xsane-memory-leak.diff +Patch0: xsane-memory-leak.diff +Patch1: xsane-libpng15.patch +Patch2: xsane-0.999-lcms2.patch +Patch3: 001-xdg-open-as-default-browser.patch +Patch4: 002-close-fds.patch +Patch5: 004-ipv6-support.patch +Patch7: 006-preview-selection.patch +Patch8: 100-remove-non-working-help.patch +Patch9: 101-xsane_fix_pdf_floats.patch +Patch10: 200-fix_options_handling_fix.patch +Patch11: 201-fix_pdf_xref.patch +Patch12: 901-desktop-file.patch +Patch13: 902-license-dialog.patch +Patch14: 903-fix_broken_links.patch +Patch18: 907-fix_spin_button_pagesize.patch +Patch19: 908-no-file-selected.patch +Patch20: 0010-fix_missing_sane-config.patch +Patch21: 0005-m4.patch +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: fdupes BuildRequires: gimp-devel BuildRequires: libgphoto2-devel BuildRequires: libjpeg-devel -BuildRequires: liblcms-devel +BuildRequires: liblcms2-devel BuildRequires: libtiff-devel -BuildRequires: update-desktop-files -BuildRequires: fdupes -%if 0%{?suse_version} > 1130 +BuildRequires: libtool BuildRequires: sane-backends-devel -%else -BuildRequires: sane-backends -%endif -# Require the SANE base system in sane-backends explicitely to be on the safe side -# because whatever third-party scanner driver package (e.g. a third-party Iscan RPM) -# could provide libsane.so.1 by accident via RPM Autoreqprov, see our iscan-free.spec -# and iscan.spec how to exclude libsane from the provide-list of Autoreqprov. -# Require xdg-utils because Patch101 sets the DEFAULT_BROWSER to "xdg-open" -# to get the right browser launched for KDE and Gnome users. +BuildRequires: update-desktop-files Requires: sane-backends Requires: xdg-utils -# Provide the RPM capability "gimp-2.0-scanner-plugin" which is also provided by -# the sane-frontends RPM so that the gimp RPM can recommend "gimp-2.0-scanner-plugin" -# so that either of xsane or sane-frontends are sufficient to be installed. Provides: gimp-2.0-scanner-plugin -# Install into this non-root directory (required when norootforbuild is used): -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description XSane does not support any scanners itself. XSane uses the SANE library @@ -82,43 +69,30 @@ XSane may not work correctly or you may not be able to take full advantage of all functions if you do not configure XSane correctly. See -the documentation at /usr/share/sane/xsane/doc/sane-xsane-doc.html. +the documentation at %{_datadir}/sane/xsane/doc/sane-xsane-doc.html. The XSane home page is http://www.xsane.org/. %prep -# Be quiet when unpacking: %setup -q # zh is not valid locale. In fact it is zh_TW: mv po/zh.po po/zh_TW.po mv po/zh.gmo po/zh_TW.gmo sed -i "s/ zh / zh_TW /" configure.in configure -%patch -%patch1 -p1 -%patch2 -p1 -# Patch100 suppresses the disclaimer of warranty and liability dialog -# and adds a modification note and adds a openSUSE Bugzilla URL -# to make the change obvious for the user and direct bug reports to us: -%patch100 -# Patch101 sets DEFAULT_BROWSER "xdg-open" in xsane.h -# to get the right browser launched for KDE and Gnome users: -%patch101 -# Patch102 removes the items in the help menue regarding backend documentation -# because the referred files do not exist (dead URLs in sane-backends-doc.html): -%patch102 -%patch103 -p1 +%autopatch -p1 + +mv configure.in configure.ac %build # Set our preferred architecture-specific flags for the compiler and linker: export CFLAGS="%{optflags} -fno-strict-aliasing" -# See /usr/lib/rpm/suse_macros regarding our RPM macros (e.g. sysconfdir is /etc): -#ACLOCAL="aclocal -I m4" autoreconf -f -i +ACLOCAL="aclocal -I m4" autoreconf -f -i %configure\ --enable-gimp make %{?_smp_mflags} %install -%makeinstall +%make_install # Create GIMP plugin link: mkdir -p %{buildroot}%{_libdir}/gimp/2.0/plug-ins ln -sf %{_bindir}/xsane %{buildroot}%{_libdir}/gimp/2.0/plug-ins/xsane @@ -127,12 +101,10 @@ %fdupes %{buildroot} %files -f %{name}.lang -%defattr(-,root,root) -# Exclude xsane.WIN* and xsane,INSTALL: %doc xsane.[A-HJ-VX-Z]* %{_bindir}/xsane %{_datadir}/sane/xsane -%doc %{_mandir}/man1/xsane.1* +%{_mandir}/man1/xsane.1* %dir %{_libdir}/gimp/ %dir %{_libdir}/gimp/2.0/ %dir %{_libdir}/gimp/2.0/plug-ins/ ++++++ 0005-m4.patch ++++++ Description: add missing m4 tags Author: Jörg Frings-Fürst <deb...@jff-webhosting.net> Last-Update: 2016-10-03 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: trunk/configure.in =================================================================== --- trunk.orig/configure.in +++ trunk/configure.in @@ -1,6 +1,7 @@ dnl Process this file with autoconf to produce a configure script. -*-sh-*- AC_INIT(include/config.h.in) AC_CONFIG_HEADER(include/config.h) +AC_CONFIG_MACRO_DIRS([m4]) # AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. # AC_ARG_PROGRAM @@ -21,12 +22,15 @@ XSANE_PACKAGE_VERSION="$PACKAGE-$VERSION AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of the distribution]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define to the version of the distribution]) AC_DEFINE_UNQUOTED(XSANE_PACKAGE_VERSION, "$XSANE_PACKAGE_VERSION", [Define to name and version of distribution]) +AC_DEFINE([ENABLE_NLS], [], [Description]) +AC_DEFINE([HAVE_CATGETS], [], [Description]) +AC_DEFINE([HAVE_GETTEXT], [], [Description]) +AC_DEFINE([HAVE_LC_MESSAGES], [], [Description]) AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_SUBST(XSANE_PACKAGE_VERSION) AC_SUBST(SANE_MAJOR) - dnl Check args echo "" ++++++ 001-xdg-open-as-default-browser.patch ++++++ --- a/src/xsane.h 2008-03-05 14:21:38.000000000 +0100 +++ b/src/xsane.h 2008-03-05 14:30:58.000000000 +0100 @@ -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 ++++++ 0010-fix_missing_sane-config.patch ++++++ Description: Fix FTBFS against libsane-dev >= 1.0.25-3 Fix missing sane-config Author: Andreas Metzler <ametz...@bebt.de> Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852840 Forwarded: https://github.com/nphilipp/xsane/issues/1 Reviewed-by: Jörg Frings-Fürst <deb...@jff-webhosting.net> Last-Update: 2017-01-28 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: trunk/configure.in =================================================================== --- trunk.orig/configure.in +++ trunk/configure.in @@ -165,8 +165,10 @@ fi AC_SUBST(INTLSUB) -AM_PATH_SANE(1.0.0, HAVE_SANE=yes, ) - +PKG_CHECK_MODULES([SANE], [sane-backends >= 1.0.0]) +PKG_CHECK_VAR([SANE_PREFIX], [sane-backends >= 1.0.0], [prefix]) +PKG_CHECK_VAR([SANE_LDFLAGS], [sane-backends >= 1.0.0], [ldflags], + [HAVE_SANE=yes]) if test "${USE_GIMP}" = "yes"; then if test "${TRY_GIMP_2}" = "yes"; then AM_PATH_GIMP_2_0(1.3.23, HAVE_GIMP=yes, ) ++++++ 002-close-fds.patch ++++++ diff -up xsane-0.995/src/xsane.c.close-fds xsane-0.995/src/xsane.c --- xsane-0.995/src/xsane.c.close-fds 2007-09-28 17:24:56.000000000 +0200 +++ xsane-0.995/src/xsane.c 2008-07-18 16:10:30.000000000 +0200 @@ -48,6 +48,8 @@ #include <sys/wait.h> +#include <stdarg.h> + /* ---------------------------------------------------------------------------------------------------------------------- */ struct option long_options[] = @@ -3673,6 +3675,41 @@ static void xsane_show_gpl(GtkWidget *wi /* ---------------------------------------------------------------------------------------------------------------------- */ +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; @@ -3725,6 +3762,8 @@ static void xsane_show_doc_via_nsr(GtkWi 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()); @@ -3767,6 +3806,8 @@ static void xsane_show_doc_via_nsr(GtkWi 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()); @@ -3888,6 +3929,8 @@ static void xsane_show_doc(GtkWidget *wi 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()); ++++++ 004-ipv6-support.patch ++++++ diff -up xsane-0.997/src/xsane-save.c.ipv6 xsane-0.997/src/xsane-save.c --- xsane-0.997/src/xsane-save.c.ipv6 2008-09-20 22:48:29.000000000 +0200 +++ xsane-0.997/src/xsane-save.c 2010-06-29 17:05:03.853290307 +0200 @@ -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> @@ -7462,55 +7464,81 @@ void write_email_attach_file(int fd_sock /* 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; } /* ---------------------------------------------------------------------------------------------------------------------- */ ++++++ 006-preview-selection.patch ++++++ >From 81782eb74370afd321dbd394ca1aa60c01bead7f Mon Sep 17 00:00:00 2001 From: Nils Philippsen <n...@redhat.com> Date: Wed, 1 Jun 2011 14:30:14 +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 3a238ff28cf8c57d11f41624cf340d2fdbe15c83 Author: Reinhard Fössmeier <i...@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 files 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.5.2 ++++++ 100-remove-non-working-help.patch ++++++ Index: src/xsane.c =================================================================== --- a/src/xsane.c +++ b/src/xsane.c @@ -4258,27 +4258,6 @@ static GtkWidget *xsane_help_build_menu( gtk_widget_show(item); - /* Backend doc -> html viewer */ - - if (xsane.backend) - { - item = gtk_menu_item_new_with_label(MENU_ITEM_BACKEND_DOC); - gtk_menu_append(GTK_MENU(menu), item); - g_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_show_doc, (void *) xsane.backend); - gtk_widget_add_accelerator(item, "activate", xsane.accelerator_group, GDK_F2, 0, GTK_ACCEL_VISIBLE | DEF_GTK_ACCEL_LOCKED); - gtk_widget_show(item); - } - - - /* available backends -> html viewer */ - - item = gtk_menu_item_new_with_label(MENU_ITEM_AVAILABLE_BACKENDS); - gtk_menu_append(GTK_MENU(menu), item); - g_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_show_doc, (void *) "sane-backends"); - gtk_widget_add_accelerator(item, "activate", xsane.accelerator_group, GDK_F3, 0, GTK_ACCEL_VISIBLE | DEF_GTK_ACCEL_LOCKED); - gtk_widget_show(item); - - /* problems -> html viewer */ item = gtk_menu_item_new_with_label(MENU_ITEM_PROBLEMS); ++++++ 101-xsane_fix_pdf_floats.patch ++++++ Fix saving pdfs http://lists.alioth.debian.org/pipermail/sane-devel/2009-June/025047.html diff -urNad xsane-0.996~/src/xsane-save.c xsane-0.996/src/xsane-save.c --- xsane-0.996~/src/xsane-save.c 2008-09-20 22:48:29.000000000 +0200 +++ xsane-0.996/src/xsane-save.c 2009-06-26 11:46:52.599585386 +0200 @@ -26,6 +26,8 @@ #include "xsane-back-gtk.h" #include "xsane-front-gtk.h" #include "xsane-save.h" +#include <locale.h> +#include <string.h> #include <time.h> #include <sys/wait.h> @@ -2411,6 +2413,7 @@ int flatedecode) { int depth; + char *save_locale; depth = image_info->depth; @@ -2428,8 +2431,15 @@ fprintf(outfile, "%d rotate\n", degree); fprintf(outfile, "%d %d translate\n", position_left, position_bottom); + + save_locale = strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "POSIX"); + fprintf(outfile, "%f %f scale\n", width, height); + setlocale(LC_NUMERIC, save_locale); + free(save_locale); + fprintf(outfile, "<<\n"); fprintf(outfile, " /ImageType 1\n"); fprintf(outfile, " /Width %d\n", image_info->image_width); @@ -3889,6 +3899,7 @@ int position_left, position_bottom, box_left, box_bottom, box_right, box_top, depth; int left, bottom; float rad; + char *save_locale; DBG(DBG_proc, "xsane_save_pdf_create_page_header\n"); @@ -4003,8 +4014,16 @@ fprintf(outfile, "q\n"); fprintf(outfile, "1 0 0 1 %d %d cm\n", position_left, position_bottom); /* translate */ + + save_locale = strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "POSIX"); + fprintf(outfile, "%f %f -%f %f 0 0 cm\n", cos(rad), sin(rad), sin(rad), cos(rad)); /* rotate */ fprintf(outfile, "%f 0 0 %f 0 0 cm\n", width, height); /* scale */ + + setlocale(LC_NUMERIC, save_locale); + free(save_locale); + fprintf(outfile, "BI\n"); fprintf(outfile, " /W %d\n", image_info->image_width); fprintf(outfile, " /H %d\n", image_info->image_height); ++++++ 200-fix_options_handling_fix.patch ++++++ Description: Fixup options handling Duplicate string values for options with constraint type of SANE_CONSTRAINT_STRING_LIST. The string list is not guaranteed to be stable, and actually isn't stable when the net backend is used. Author: Julien BLACHE <jbla...@debian.org> Index: xsane-0.998/src/xsane-back-gtk.c =================================================================== --- xsane-0.998.orig/src/xsane-back-gtk.c 2010-11-16 21:24:59.000000000 +0100 +++ xsane-0.998/src/xsane-back-gtk.c 2011-02-04 19:50:46.389016001 +0100 @@ -2225,11 +2225,13 @@ /* ----------------------------------------------------------------------------------------------------------------- */ void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[], - const char *val, DialogElement *elem, + const char *val, SANE_Constraint_Type constraint_type, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable) { GtkWidget *hbox, *label, *option_menu, *menu, *item; MenuItem *menu_items; + int dup_string; + char *strval; int i, num_items; DBG(DBG_proc, "xsane_back_gtk_option_menu_new(%s)\n", name); @@ -2247,16 +2249,23 @@ menu_items = malloc((num_items + 1) * sizeof(menu_items[0])); + dup_string = (constraint_type == SANE_CONSTRAINT_STRING_LIST); + menu = gtk_menu_new(); for (i = 0; i < num_items; ++i) { - item = gtk_menu_item_new_with_label(_BGT(str_list[i])); + if (dup_string) + strval = strdup(str_list[i]); + else + strval = str_list[i]; + + item = gtk_menu_item_new_with_label(_BGT(strval)); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_back_gtk_option_menu_callback, menu_items + i); gtk_widget_show(item); - menu_items[i].label = str_list[i]; + menu_items[i].label = strval; menu_items[i].elem = elem; menu_items[i].index = i; } @@ -2402,14 +2411,15 @@ xsane.standard_hbox = NULL; xsane.advanced_hbox = NULL; - /* free the menu labels of integer/fix-point word-lists: */ + /* free the menu labels */ for (i = 0; i < xsane.num_elements; ++i) { if (xsane.element[i].menu) { opt = xsane_get_option_descriptor(xsane.dev, i); elem = xsane.element + i; - if (opt->type != SANE_TYPE_STRING) + if ((opt->type != SANE_TYPE_STRING) + || (opt->constraint_type == SANE_CONSTRAINT_STRING_LIST)) { for (j = 0; j < elem->menu_size; ++j) { Index: xsane-0.998/src/xsane-back-gtk.h =================================================================== --- xsane-0.998.orig/src/xsane-back-gtk.h 2007-02-24 01:56:54.000000000 +0100 +++ xsane-0.998/src/xsane-back-gtk.h 2011-02-04 19:50:46.389016001 +0100 @@ -117,7 +117,7 @@ gfloat quant, int automatic, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); extern void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[], - const char *val, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); + const char *val, SANE_Constraint_Type constraint_type, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); extern void xsane_back_gtk_text_entry_new(GtkWidget *parent, const char *name, const char *val, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable); extern void xsane_back_gtk_push_button_callback(GtkWidget *widget, gpointer data); Index: xsane-0.998/src/xsane-front-gtk.c =================================================================== --- xsane-0.998.orig/src/xsane-front-gtk.c 2010-11-16 21:25:33.000000000 +0100 +++ xsane-0.998/src/xsane-front-gtk.c 2011-02-04 19:50:46.393016001 +0100 @@ -64,10 +64,10 @@ int *state, void *xsane_toggle_button_callback); GtkWidget *xsane_button_new_with_pixmap(GdkWindow *window, GtkWidget *parent, const char *xpm_d[], const char *desc, void *xsane_button_callback, gpointer data); -void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, +void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc, void *option_menu_callback, SANE_Int settable, const gchar *widget_name); void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc, - char *str_list[], const char *val, + char *str_list[], const char *val, SANE_Constraint_Type constraint_type, GtkWidget **data, int option, void *option_menu_callback, SANE_Int settable, const gchar *widget_name); void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc, @@ -1011,12 +1011,14 @@ /* ---------------------------------------------------------------------------------------------------------------------- */ -void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, +void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc, void *option_menu_callback, SANE_Int settable, const gchar *widget_name) { GtkWidget *option_menu, *menu, *item; MenuItem *menu_items; DialogElement *elem; + int dup_string; + char *strval; int i, num_items; DBG(DBG_proc, "xsane_option_menu_new\n"); @@ -1035,9 +1037,16 @@ gtk_widget_set_name(menu, widget_name); } + dup_string = (constraint_type == SANE_CONSTRAINT_STRING_LIST); + for (i = 0; i < num_items; ++i) { - item = gtk_menu_item_new_with_label(_BGT(str_list[i])); + if (dup_string) + strval = strdup(str_list[i]); + else + strval = str_list[i]; + + item = gtk_menu_item_new_with_label(_BGT(strval)); gtk_container_add(GTK_CONTAINER(menu), item); if (option_menu_callback) @@ -1051,7 +1060,7 @@ gtk_widget_show(item); - menu_items[i].label = str_list[i]; + menu_items[i].label = strval; menu_items[i].elem = elem; menu_items[i].index = i; } @@ -1079,7 +1088,7 @@ /* ---------------------------------------------------------------------------------------------------------------------- */ void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc, - char *str_list[], const char *val, + char *str_list[], const char *val, SANE_Constraint_Type constraint_type, GtkWidget **data, int option, void *option_menu_callback, SANE_Int settable, const gchar *widget_name) { @@ -1098,7 +1107,7 @@ gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2); gtk_widget_show(pixmapwidget); - xsane_option_menu_new(hbox, str_list, val, option, desc, option_menu_callback, settable, widget_name); + xsane_option_menu_new(hbox, str_list, val, constraint_type, option, desc, option_menu_callback, settable, widget_name); gtk_widget_show(hbox); } Index: xsane-0.998/src/xsane-front-gtk.h =================================================================== --- xsane-0.998.orig/src/xsane-front-gtk.h 2007-05-17 14:45:19.000000000 +0200 +++ xsane-0.998/src/xsane-front-gtk.h 2011-02-04 19:50:46.453016001 +0100 @@ -54,10 +54,10 @@ extern GtkWidget *xsane_button_new_with_pixmap(GdkWindow *window, GtkWidget *parent, const char *xpm_d[], const char *desc, void *xsane_button_callback, gpointer data); extern void xsane_pixmap_new(GtkWidget *parent, char *title, int width, int height, XsanePixmap *hist); -extern void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc, +extern void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc, void *option_menu_callback, SANE_Int settable, const gchar *widget_name); extern void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc, - char *str_list[], const char *val, + char *str_list[], const char *val, SANE_Constraint_Type constraint_type, GtkWidget **data, int option, void *option_menu_callback, SANE_Int settable, const gchar *widget_name); extern void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc, Index: xsane-0.998/src/xsane.c =================================================================== --- xsane-0.998.orig/src/xsane.c 2011-02-04 19:50:40.957016002 +0100 +++ xsane-0.998/src/xsane.c 2011-02-04 19:50:46.457016001 +0100 @@ -876,7 +876,7 @@ str_list[j] = 0; sprintf(str, "%d", (int) val); - xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc, str_list, str, &resolution_widget, well_known_option, + xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc, str_list, str, opt->constraint_type, &resolution_widget, well_known_option, xsane_resolution_list_callback, SANE_OPTION_IS_SETTABLE(opt->cap), widget_name); free(str_list); @@ -931,7 +931,7 @@ xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc, - str_list, str, &resolution_widget, well_known_option, + str_list, str, opt->constraint_type, &resolution_widget, well_known_option, xsane_resolution_list_callback, SANE_OPTION_IS_SETTABLE(opt->cap), widget_name); free(str_list); } @@ -1496,7 +1496,7 @@ set = malloc(opt->size); status = xsane_control_option(xsane.dev, xsane.well_known.scansource, SANE_ACTION_GET_VALUE, set, 0); - xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, xsane.well_known.scansource, + xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, opt->constraint_type, xsane.well_known.scansource, _BGT(opt->desc), 0, SANE_OPTION_IS_SETTABLE(opt->cap), 0); } break; @@ -1536,7 +1536,7 @@ set = malloc(opt->size); status = xsane_control_option(xsane.dev, xsane.well_known.scanmode, SANE_ACTION_GET_VALUE, set, 0); - xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, xsane.well_known.scanmode, + xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, opt->constraint_type, xsane.well_known.scanmode, _BGT(opt->desc), xsane_scanmode_menu_callback, SANE_OPTION_IS_SETTABLE(opt->cap), 0); } break; @@ -4646,7 +4646,7 @@ } str_list[j] = 0; sprintf(str, "%d", val); - xsane_back_gtk_option_menu_new(parent, title, str_list, str, elem, xsane.tooltips, _BGT(opt->desc), + xsane_back_gtk_option_menu_new(parent, title, str_list, str, opt->constraint_type, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap)); free(str_list); gtk_widget_show(parent->parent); @@ -4744,7 +4744,7 @@ } str_list[j] = 0; sprintf(str, "%g", SANE_UNFIX(val)); - xsane_back_gtk_option_menu_new(parent, title, str_list, str, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap)); + xsane_back_gtk_option_menu_new(parent, title, str_list, str, opt->constraint_type, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap)); free (str_list); gtk_widget_show(parent->parent); } @@ -4789,7 +4789,7 @@ (strcmp (opt->name, SANE_NAME_SCAN_SOURCE) != 0) ) /* do not show scansource */ { /* use a "list-selection" widget */ - xsane_back_gtk_option_menu_new(parent, title, (char **) opt->constraint.string_list, buf, + xsane_back_gtk_option_menu_new(parent, title, (char **) opt->constraint.string_list, buf, opt->constraint_type, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap)); gtk_widget_show (parent->parent); } ++++++ 201-fix_pdf_xref.patch ++++++ Description: Fix xref table generation Mark non-existent objects as free in the xref table. Author: Julien BLACHE <jbla...@debian.org> Forwarded: yes Index: xsane-0.998/src/xsane-multipage-project.c =================================================================== --- xsane-0.998.orig/src/xsane-multipage-project.c 2010-11-16 21:25:50.000000000 +0100 +++ xsane-0.998/src/xsane-multipage-project.c 2011-02-04 19:50:53.929016002 +0100 @@ -973,6 +973,10 @@ else if (output_format == XSANE_PDF) { xsane_save_pdf_create_document_header(outfile, &xref, pages, preferences.save_pdf_flatedecoded); + + /* Objects 4 and 5 are unused and do not exist */ + xref.obj[4] = 0; + xref.obj[5] = 0; } } #ifdef HAVE_LIBTIFF ++++++ 901-desktop-file.patch ++++++ --- a/src/xsane.desktop 2008-03-29 10:32:18.000000000 +0100 +++ b/src/xsane.desktop 2011-07-08 14:19:30.000000000 +0200 @@ -1,9 +1,11 @@ [Desktop Entry] -Encoding=UTF-8 -Name=XSane - Scanning +Name=XSane Scanner Tool +GenericName=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 ++++++ 902-license-dialog.patch ++++++ diff -up xsane-0.996/src/xsane.c.no-eula xsane-0.996/src/xsane.c --- xsane-0.996/src/xsane.c.no-eula 2009-07-21 15:33:00.927455229 +0200 +++ xsane-0.996/src/xsane.c 2009-07-21 15:39:28.661456472 +0200 @@ -3524,10 +3524,13 @@ static void xsane_about_dialog(GtkWidget 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); @@ -5714,6 +5717,7 @@ static int xsane_init(int argc, char **a 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); @@ -5840,17 +5844,9 @@ static int xsane_init(int argc, char **a } - 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 -up xsane-0.996/src/xsane.h.no-eula xsane-0.996/src/xsane.h --- xsane-0.996/src/xsane.h.no-eula 2009-07-21 15:33:00.921470546 +0200 +++ xsane-0.996/src/xsane.h 2009-07-21 16:08:01.398707123 +0200 @@ -98,6 +98,9 @@ #define XSANE_EMAIL_ADR "oliver.ra...@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 "http://bugzilla.suse.com" +#endif /* ---------------------------------------------------------------------------------------------------------------------- */ diff -up xsane-0.996/src/xsane-text.h.no-eula xsane-0.996/src/xsane-text.h --- xsane-0.996/src/xsane-text.h.no-eula 2007-08-13 09:16:43.000000000 +0200 +++ xsane-0.996/src/xsane-text.h 2009-07-21 15:42:00.609707360 +0200 @@ -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:") ++++++ 903-fix_broken_links.patch ++++++ Description: Fix broken links in HTML documentation Fix/remove a couple of broken links. Author: Julien BLACHE <jbla...@debian.org> Index: xsane-0.998/doc/sane-xsane-doc.html =================================================================== --- xsane-0.998.orig/doc/sane-xsane-doc.html 2007-03-03 14:11:32.000000000 +0100 +++ xsane-0.998/doc/sane-xsane-doc.html 2011-02-04 19:51:09.289016000 +0100 @@ -165,8 +165,7 @@ <li><a href="sane-xsane-setup-display-doc.html">Display setup</a></li> <li><a href="sane-xsane-setup-enhancement-doc.html">Enhancement setup</a></li> <li><a href="sane-xsane-setup-fax-doc.html">Fax setup</a></li> -<li><a href="sane-xsane-setup-image-doc.html">Image setup</a></li> -<li><a href="sane-xsane-setup-mail-doc.html">Mail setup</a></li> +<li><a href="sane-xsane-setup-email-doc.html">Mail setup</a></li> <li><a href="sane-xsane-setup-save-doc.html">Saving setup</a></li> <li><a href="sane-xsane-setup-color-management-doc.html">Color management setup</a></li> </ul> ++++++ 907-fix_spin_button_pagesize.patch ++++++ Description: Fix spin buttons usage for newer versions of GTK+ 2.0 Set adjustment page size to 0 for spin buttons. Fix for newer GTK versions, silences runtime warnings. Author: Julien BLACHE <jbla...@debian.org> Forwarded: no Index: xsane-0.998/src/xsane-back-gtk.c =================================================================== --- xsane-0.998.orig/src/xsane-back-gtk.c 2011-02-04 19:50:46.000000000 +0100 +++ xsane-0.998/src/xsane-back-gtk.c 2011-02-04 19:54:55.581016002 +0100 @@ -2028,6 +2028,7 @@ digits = 5; } #endif + gtk_adjustment_set_page_size(GTK_ADJUSTMENT(elem->data), 0); spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(elem->data), 0, digits); if (preferences.show_range_mode & 3) /* slider also visible */ @@ -2129,6 +2130,7 @@ digits = 5; } #endif + gtk_adjustment_set_page_size(GTK_ADJUSTMENT(elem->data), 0); spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(elem->data), 0, digits); if (preferences.show_range_mode & 3) /* sliders are visible */ Index: xsane-0.998/src/xsane-front-gtk.c =================================================================== --- xsane-0.998.orig/src/xsane-front-gtk.c 2011-02-04 19:50:46.000000000 +0100 +++ xsane-0.998/src/xsane-front-gtk.c 2011-02-04 19:54:55.581016002 +0100 @@ -1163,6 +1163,7 @@ /* spinbutton */ if (preferences.show_range_mode & 4) { + gtk_adjustment_set_page_size(GTK_ADJUSTMENT(*data), 0); spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(*data), 0, digits); if (preferences.show_range_mode & 3) /* slider also visible */ { @@ -1255,6 +1256,7 @@ /* spinbutton */ if (preferences.show_range_mode & 4) { + gtk_adjustment_set_page_size(GTK_ADJUSTMENT(*data), 0); spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(*data), 0, digits); gtk_widget_set_size_request(spinbutton, 60, -1); xsane_back_gtk_set_tooltip(xsane.tooltips, spinbutton, desc); ++++++ 908-no-file-selected.patch ++++++ Slightly modified version of the former 003 Fedora patch, in order to fix gentoo bug 396127 diff -up xsane-0.997/src/xsane-back-gtk.c.no-file-selected xsane-0.997/src/xsane-back-gtk.c --- xsane-0.997/src/xsane-back-gtk.c.no-file-selected 2002-10-02 13:05:52.000000000 +0200 +++ xsane-0.997/src/xsane-back-gtk.c 2010-07-13 10:02:09.468118791 +0200 @@ -1111,6 +1111,11 @@ static void xsane_back_gtk_filetype2_cal chooser_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser)); + if (!chooser_filename) + { + return; + } + if ((new_filetype) && (*new_filetype)) { extension = strrchr(chooser_filename, '.'); @@ -1501,12 +1506,19 @@ int xsane_back_gtk_get_filename(const ch #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 -up xsane-0.997/src/xsane-front-gtk.c.no-file-selected xsane-0.997/src/xsane-front-gtk.c --- xsane-0.997/src/xsane-front-gtk.c.no-file-selected 2002-10-02 13:04:33.000000000 +0200 +++ xsane-0.997/src/xsane-front-gtk.c 2010-07-13 09:59:31.005868940 +0200 @@ -1339,7 +1339,11 @@ static void xsane_browse_filename_callba 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) ++++++ xsane-0.999-lcms2.patch ++++++ >From 30af0e2edbf061b71bed9536d826894449f0390d Mon Sep 17 00:00:00 2001 From: Nils Philippsen <n...@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 <n...@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