Hello community, here is the log from the commit of package printer-driver-brlaser for openSUSE:Factory checked in at 2016-06-19 12:52:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/printer-driver-brlaser (Old) and /work/SRC/openSUSE:Factory/.printer-driver-brlaser.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "printer-driver-brlaser" Changes: -------- --- /work/SRC/openSUSE:Factory/printer-driver-brlaser/printer-driver-brlaser.changes 2016-02-11 12:37:43.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.printer-driver-brlaser.new/printer-driver-brlaser.changes 2016-06-19 12:52:54.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Jun 17 06:36:23 UTC 2016 - lnus...@suse.de + +- Update to version 3+git20160302.03bb366: + * Kill a harmless dead store + * Fix lest.hpp dependency for the tests. + * Add Brother DCP-7055 + * Misc cleanups, mostly in the test code + * Reject unexpected raster formats + * Use cups-config --ldflags + * Refuse to build without a C++11 compiler +- fetch patches from pull requests: + 0001-mark-DCP-7055W-as-supported.diff (was brlaser-br7055w.diff) + 0002-Add-Brother-DCP1510.diff + 0003-Add-missing-include-string.diff (fixes boo#985119) +- remove SLE11 and SLE10 noise from spec file again, doesn't build there + anyways. + +------------------------------------------------------------------- Old: ---- brlaser-3+git20141125.4f1a00d.tar.gz brlaser-br7055w.diff New: ---- 0001-mark-DCP-7055W-as-supported.diff 0002-Add-Brother-DCP1510.diff 0003-Add-missing-include-string.diff brlaser-3+git20160302.03bb366.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ printer-driver-brlaser.spec ++++++ --- /var/tmp/diff_new_pack.7OKE4K/_old 2016-06-19 12:52:55.000000000 +0200 +++ /var/tmp/diff_new_pack.7OKE4K/_new 2016-06-19 12:52:55.000000000 +0200 @@ -17,7 +17,7 @@ Name: printer-driver-brlaser -Version: 3+git20141125.4f1a00d +Version: 3+git20160302.03bb366 Release: 0 Summary: Driver for (some) Brother laster printers License: GPL-2.0+ @@ -25,22 +25,17 @@ Url: https://github.com/pdewacht/brlaser Source: brlaser-%{version}.tar.gz # PATCH-FIX-UPSTREAM -- https://github.com/pdewacht/brlaser/pull/5 -Patch0: brlaser-br7055w.diff +Patch0: 0001-mark-DCP-7055W-as-supported.diff +# PATCH-FIX-UPSTREAM -- https://github.com/pdewacht/brlaser/pull/7 +Patch1: 0002-Add-Brother-DCP1510.diff +# PATCH-FIX-UPSTREAM -- https://github.com/pdewacht/brlaser/pull/9 +Patch2: 0003-Add-missing-include-string.diff BuildRequires: autoconf BuildRequires: automake -# SLE10 and SLE11 and SLE12 need special BuildRequires. -# For suse_version values see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto -%if 0%{?suse_version} != 1010 && 0%{?suse_version} != 1110 && 0%{?suse_version} != 1315 -# Anything what is not SLE10 or SLE11 or SLE12 (i.e. all openSUSE versions) have "normal" BuildRequires. +%if 0%{?is_opensuse} || 0%{?suse_version} != 1315 BuildRequires: cups-ddk BuildRequires: cups-devel -%endif -%if 0%{?suse_version} == 1110 || 0%{?suse_version} == 1010 -# On SLE11 and SLE10 there is the separated package cupsddk. -BuildRequires: cups-devel -BuildRequires: cupsddk -%endif -%if 0%{?suse_version} == 1315 +%else # For SLE12 by default CUPS 1.7.5 is provided and alternatively CUPS 1.5.4 is provided in the "legacy" module. # For SLE12 build it with traditional CUPS 1.5.4 to ensure it works on SLE12 both with CUPS 1.7.5 and CUPS 1.5.4. # Only in the Printing project for SLE12 use cups154-ddk (a sub package of the cups154-SLE12 source package): @@ -48,15 +43,7 @@ BuildRequires: cups154-devel %endif BuildRequires: gcc-c++ -%if 0%{?suse_version} != 1010 -# On SLE10 there is no python-cups. Simply omit it because that BuildRequires is only there to -# add python-cups BuildRequires to have postscriptdriver() Provides for the drivers in gutenprint. BuildRequires: python-cups -%endif -%if 0%{?suse_version} == 1110 -# For SLE11 redefine _libexecdir because on SLE11 _libexecdir is "/usr/lib64": -%global _libexecdir /usr/lib -%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -67,14 +54,14 @@ It is known to support these printers: + Brother DCP-1510 series Brother DCP-7030 Brother DCP-7055 Brother DCP-7055W Brother DCP-7065DN %prep -%setup -q -n brlaser-%{version} -%patch0 -p1 +%autosetup -p1 -n brlaser-%{version} %build autoreconf -fi ++++++ 0001-mark-DCP-7055W-as-supported.diff ++++++ >From 1c5d3177eb74c5e150aec44ef1750f9a55f4d769 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel <ludwig.nus...@suse.de> Date: Thu, 28 Jan 2016 10:57:04 +0100 Subject: [PATCH 1/3] mark DCP-7055W as supported --- README.md | 1 + brlaser.drv.in | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 5a7f8c0..32bd2fc 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ It is known to support these printers: * Brother DCP-7030 * Brother DCP-7055 +* Brother DCP-7055W * Brother DCP-7065DN Copyright diff --git a/brlaser.drv.in b/brlaser.drv.in index 9f83b8e..c58afc1 100644 --- a/brlaser.drv.in +++ b/brlaser.drv.in @@ -90,6 +90,14 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10 } { + ModelName "DCP-7055W" + Attribute "NickName" "" "Brother DCP-7055W, using @PACKAGE@ @VERSION@" + Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7055W;CLS:PRINTER;CID:Brother Laser Type1;" + + PCFileName "br7055w.ppd" +} + +{ ModelName "DCP-7065DN" Attribute "NickName" "" "Brother DCP-7065DN, using @PACKAGE@ v@VERSION@" Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7065DN;CLS:PRINTER;CID:Brother Laser Type1;" -- 2.8.3 ++++++ 0002-Add-Brother-DCP1510.diff ++++++ >From 08595f5cb96d1163cd6e7071a94a2a11e4eacbdf Mon Sep 17 00:00:00 2001 From: Robin Kreis <r.kr...@uni-bremen.de> Date: Sat, 26 Mar 2016 13:24:59 +0100 Subject: [PATCH 2/3] Add Brother-DCP1510 --- README.md | 1 + brlaser.drv.in | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 32bd2fc..dcc1ba7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ don't work, this one might help. It is known to support these printers: +* Brother DCP-1510 series * Brother DCP-7030 * Brother DCP-7055 * Brother DCP-7055W diff --git a/brlaser.drv.in b/brlaser.drv.in index c58afc1..74a77f8 100644 --- a/brlaser.drv.in +++ b/brlaser.drv.in @@ -76,6 +76,13 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10 { + ModelName "DCP-1510" + Attribute "NickName" "" "Brother DCP-1510 series, using @PACKAGE@ v@VERSION@" + Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,XL2HB;MDL:DCP-1510 series;CLS:PRINTER;CID:Brother Laser Type1;" + PCFileName "br1510.ppd" +} + +{ ModelName "DCP-7030" Attribute "NickName" "" "Brother DCP-7030, using @PACKAGE@ v@VERSION@" Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7030;CLS:PRINTER;" -- 2.8.3 ++++++ 0003-Add-missing-include-string.diff ++++++ >From 7cd64500bb23e22df4ae84602279b90ebb0c64c0 Mon Sep 17 00:00:00 2001 From: Peter Spiess-Knafl <d...@spiessknafl.at> Date: Mon, 25 Apr 2016 15:02:37 +0200 Subject: [PATCH 3/3] Add missing #include <string> --- src/brdecode.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/brdecode.cc b/src/brdecode.cc index d5c4c0d..bcd3ec7 100644 --- a/src/brdecode.cc +++ b/src/brdecode.cc @@ -21,6 +21,7 @@ #include <algorithm> #include <exception> #include <vector> +#include <string> namespace { -- 2.8.3 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.7OKE4K/_old 2016-06-19 12:52:55.000000000 +0200 +++ /var/tmp/diff_new_pack.7OKE4K/_new 2016-06-19 12:52:55.000000000 +0200 @@ -4,6 +4,7 @@ <param name="url">git://github.com/pdewacht/brlaser.git</param> <param name="scm">git</param> <param name="revision">master</param> + <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="disabled"> <param name="compression">gz</param> ++++++ brlaser-3+git20141125.4f1a00d.tar.gz -> brlaser-3+git20160302.03bb366.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/Makefile.am new/brlaser-3+git20160302.03bb366/Makefile.am --- old/brlaser-3+git20141125.4f1a00d/Makefile.am 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/Makefile.am 2016-06-17 08:33:58.000000000 +0200 @@ -29,6 +29,7 @@ src/line.h \ src/line.cc src_rastertobrlaser_LDADD = $(CUPS_LIBS) +src_rastertobrlaser_LDFLAGS = $(CUPS_LDFLAGS) src_brdecode_SOURCES = \ src/brdecode.cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/configure.ac new/brlaser-3+git20160302.03bb366/configure.ac --- old/brlaser-3+git20141125.4f1a00d/configure.ac 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/configure.ac 2016-06-17 08:33:58.000000000 +0200 @@ -29,7 +29,7 @@ AM_SILENT_RULES([yes]) AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_11 +AX_CXX_COMPILE_STDCXX([11]) AX_CXXFLAGS_WARN_ALL dnl Use cups-config to detect the CUPS configuration. @@ -38,10 +38,12 @@ [AC_MSG_ERROR(["cups-config" command not found. Please install the CUPS development package.])]) CUPS_CFLAGS=`"$CUPS_CONFIG" --cflags` CUPS_LIBS=`"$CUPS_CONFIG" --image --libs` +CUPS_LDFLAGS=`"$CUPS_CONFIG" --image --ldflags` CUPS_SERVERBIN=`"$CUPS_CONFIG" --serverbin` CUPS_DATADIR=`"$CUPS_CONFIG" --datadir` AC_SUBST(CUPS_CFLAGS) AC_SUBST(CUPS_LIBS) +AC_SUBST(CUPS_LDFLAGS) AC_SUBST(CUPS_SERVERBIN) AC_SUBST(CUPS_DATADIR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/m4/ax_cxx_compile_stdcxx.m4 new/brlaser-3+git20160302.03bb366/m4/ax_cxx_compile_stdcxx.m4 --- old/brlaser-3+git20141125.4f1a00d/m4/ax_cxx_compile_stdcxx.m4 1970-01-01 01:00:00.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/m4/ax_cxx_compile_stdcxx.m4 2016-06-17 08:33:58.000000000 +0200 @@ -0,0 +1,556 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX to +# enable support. VERSION may be '11' (for the C++11 standard) or '14' +# (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik <b...@redhat.com> +# Copyright (c) 2012 Zack Weinberg <za...@panix.com> +# Copyright (c) 2013 Roy Stogner <royst...@ices.utexas.edu> +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <soko...@google.com> +# Copyright (c) 2015 Paul Norman <penor...@mac.com> +# Copyright (c) 2015 Moritz Klammler <mor...@klammler.eu> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 3 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template <typename T> + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check<void> single_type; + typedef check<check<void>> double_type; + typedef check<check<check<void>>> triple_type; + typedef check<check<check<check<void>>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same<T, T> + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same<int, decltype(0)>::value == true, ""); + static_assert(is_same<int, decltype(c)>::value == false, ""); + static_assert(is_same<int, decltype(v)>::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same<int, decltype(ac)>::value == true, ""); + static_assert(is_same<int, decltype(av)>::value == true, ""); + static_assert(is_same<int, decltype(sumi)>::value == true, ""); + static_assert(is_same<int, decltype(sumf)>::value == false, ""); + static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template <int...> + struct sum; + + template <int N0, int... N1toN> + struct sum<N0, N1toN...> + { + static constexpr auto value = N0 + sum<N1toN...>::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template<typename T> + using member = typename T::member_type; + + template<typename T> + void func(...) {} + + template<typename T> + void func(member<T>*) {} + + void test(); + + void test() { func<foo>(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same<T, T> + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same<int, decltype(f(x))>::value, ""); + static_assert(is_same<int&, decltype(g(x))>::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/m4/ax_cxx_compile_stdcxx_11.m4 new/brlaser-3+git20160302.03bb366/m4/ax_cxx_compile_stdcxx_11.m4 --- old/brlaser-3+git20141125.4f1a00d/m4/ax_cxx_compile_stdcxx_11.m4 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/m4/ax_cxx_compile_stdcxx_11.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,133 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXXFLAGS to enable support. -# -# The first argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The second argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline C++11 support is required and that the macro -# should error out if no mode with that support is found. If specified -# 'optional', then configuration proceeds regardless, after defining -# HAVE_CXX11 if and only if a supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik <b...@redhat.com> -# Copyright (c) 2012 Zack Weinberg <za...@panix.com> -# Copyright (c) 2013 Roy Stogner <royst...@ices.utexas.edu> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 3 - -m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [ - template <typename T> - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check<check<bool>> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check<int> check_type; - check_type c; - check_type&& cr = static_cast<check_type&&>(c); - - auto d = a; -]) - -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl - m4_if([$1], [], [], - [$1], [ext], [], - [$1], [noext], [], - [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl - m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], - [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], - [$2], [optional], [ax_cxx_compile_cxx11_required=false], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++11 features by default, - ax_cv_cxx_compile_cxx11, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [ax_cv_cxx_compile_cxx11=yes], - [ax_cv_cxx_compile_cxx11=no])]) - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi - - m4_if([$1], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++11 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - m4_if([$1], [ext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=c++11 -std=c++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx11_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) - fi - else - if test x$ac_success = xno; then - HAVE_CXX11=0 - AC_MSG_NOTICE([No compiler with C++11 support was found]) - else - HAVE_CXX11=1 - AC_DEFINE(HAVE_CXX11,1, - [define if the compiler supports basic C++11 syntax]) - fi - - AC_SUBST(HAVE_CXX11) - fi -]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/src/block.h new/brlaser-3+git20160302.03bb366/src/block.h --- old/brlaser-3+git20141125.4f1a00d/src/block.h 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/src/block.h 2016-06-17 08:33:58.000000000 +0200 @@ -25,13 +25,18 @@ class block { public: block(): line_bytes_(0) { + lines_.reserve(max_lines_per_block_); + } + + bool empty() const { + return line_bytes_ == 0; } void add_line(std::vector<uint8_t> &&line) { assert(!line.empty()); assert(line_fits(line.size())); line_bytes_ += line.size(); - lines_.push_back(line); + lines_.emplace_back(line); } bool line_fits(unsigned size) { @@ -40,7 +45,7 @@ } void flush(FILE *f) { - if (line_bytes_) { + if (!empty()) { fprintf(f, "%dw%c%c", line_bytes_ + 2, 0, static_cast<int>(lines_.size())); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/src/main.cc new/brlaser-3+git20160302.03bb366/src/main.cc --- old/brlaser-3+git20141125.4f1a00d/src/main.cc 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/src/main.cc 2016-06-17 08:33:58.000000000 +0200 @@ -169,7 +169,16 @@ { job job(stdout, ascii_job_name(job_name, job_charset)); while (!interrupted && cupsRasterReadHeader2(ras, &header)) { + if (header.cupsBitsPerPixel != 1 + || header.cupsBitsPerColor != 1 + || header.cupsNumColors != 1 + || header.cupsBytesPerLine > 10000) { + fprintf(stderr, "ERROR: Page %d: Bogus raster data.\n", pages + 1); + dump_page_header(header); + return 1; + } if (pages == 0) { + fprintf(stderr, "DEBUG: Page header of first page\n"); dump_page_header(header); } job.encode_page(build_page_params(), @@ -180,8 +189,9 @@ fprintf(stderr, "PAGE: %d %d\n", ++pages, header.NumCopies); } } + if (pages == 0) { - fprintf(stderr, "ERROR: No pages were found."); + fprintf(stderr, "ERROR: No pages were found.\n"); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/test/test_block.cc new/brlaser-3+git20160302.03bb366/test/test_block.cc --- old/brlaser-3+git20141125.4f1a00d/test/test_block.cc 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/test/test_block.cc 2016-06-17 08:33:58.000000000 +0200 @@ -24,7 +24,20 @@ typedef std::vector<uint8_t> vec; const lest::test specification[] = { - "Block line limit", + "A block is created empty", + [] { + block b; + EXPECT(b.empty()); + }, + + "Adding a line makes a block no longer empty", + [] { + block b; + b.add_line(vec{1}); + EXPECT(!b.empty()); + }, + + "A block can contain 128 lines", [] { block b; for (int i = 0; i < 128; ++i) { @@ -34,7 +47,7 @@ EXPECT(!b.line_fits(1)); }, - "Block size limit", + "A block has a size limit of about 16 kilobyte", [] { block b; for (int i = 0; i < 16; ++i) { @@ -44,30 +57,33 @@ EXPECT(!b.line_fits(400)); }, - "Flush", + "Flushing an empty block does nothing", [] { block b; - { - tempfile f; - b.flush(f.file()); - EXPECT(f.data().empty()); - } - for (uint8_t n = 0; n < 10; n += 2) { - vec line = {n, static_cast<uint8_t>(n+1)}; - EXPECT(b.line_fits(line.size())); - b.add_line(std::move(line)); - } - { - tempfile f; - b.flush(f.file()); - EXPECT(( f.data() == vec{'1','2','w',0,5,0,1,2,3,4,5,6,7,8,9} )); - } - { - tempfile f; - b.flush(f.file()); - EXPECT(f.data().empty()); + tempfile f; + b.flush(f.file()); + EXPECT(f.data().empty()); + }, + + "Flush() writes the lines to a file with a proper header", + [] { + block b; + for (uint8_t n = 1; n < 6; ++n) { + b.add_line(vec{n, n}); } + tempfile f; + b.flush(f.file()); + EXPECT(( f.data() == vec{'1','2','w',0,5,1,1,2,2,3,3,4,4,5,5} )); }, + + "After flush() a block is empty again", + [] { + block b; + b.add_line(vec{1}); + tempfile f; + b.flush(f.file()); + EXPECT(b.empty()); + } }; int main() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/brlaser-3+git20141125.4f1a00d/test/test_line.cc new/brlaser-3+git20160302.03bb366/test/test_line.cc --- old/brlaser-3+git20141125.4f1a00d/test/test_line.cc 2015-11-27 13:34:36.000000000 +0100 +++ new/brlaser-3+git20160302.03bb366/test/test_line.cc 2016-06-17 08:33:58.000000000 +0200 @@ -53,7 +53,7 @@ [] { EXPECT(( encode_line(vec{1,2,3}) == (vec{1,sub(0,2),1,2,3}) )); }, - + "Encoding a (non-initial) blank line", [] { EXPECT(( encode_line(vec{0,0,0}, vec{1,2,3}) == vec{0xFF} ));