Here's an initial set of patches (attached). The first is copied
verbatim from the github bug I referenced. The second is motivated by
the reference, but fixes significant bugs in the original. The third is
something small that I found.
I'm still in the middle of tracking something down which is looking more
and more like a GCC optimizer bug, but could also be UB-related, and
ends up causing a segfault in one of the unit tests. In case anyone is
interested in helping debug, here's the summary:
This unit test line:
https://github.com/ukoethe/vigra/blob/master/test/utilities/test.cxx#L1507
ends up triggering this line:
https://github.com/ukoethe/vigra/blob/master/include/vigra/any.hxx#L400
The nullptr check for the precondition is deleted (i.e. always returns
not-null) by -fdelete-null-pointer-checks (which is enabled with -O2),
even in the case where the dynamic_cast fails (which will by design
return a nullptr). This causes a nullptr dereference on the following
line, with "ptr2->cast(...". In my case, I've found that specifying
`-fsanitize=null` will prevent the null-pointer check from being
deleted, which causes the crash to not manifest. Specifying
`-fno-delete-null-pointer-checks` also fixes the segfault, but with
unknown performance effects.
$gcc --version
gcc (Debian 11.2.0-13) 11.2.0
Cheers,
--xsdg
On 12/27/21 7:31 AM, Andreas Metzler wrote:
On 2021-12-27 Omari Stephens <[email protected]> wrote:
[...]
If I and/or others were able to get libvigraimpex compiling again, is there
any chance of those changes making it into Debian in some fashion, in order
to unstick the other people who depend on hugin/enfuse/enblend?
[...]
Good morning,
if there existed clean patches (i.e. inter alia especially testsuite works
again) I would apply them and upload to Debian.
cu Andreas
>From 73c2135746aa48573c6dd92375c869ceef1eaced Mon Sep 17 00:00:00 2001
From: Omari Stephens <[email protected]>
Date: Tue, 28 Dec 2021 21:14:57 +0000
Subject: [PATCH 1/3] Remove deprecated binder1st and binder2nd from
functortraits
>From https://github.com/ukoethe/vigra/pull/500/commits/8da122a26bd8952e9c66328583442f99f445f072
---
include/vigra/functortraits.hxx | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/vigra/functortraits.hxx b/include/vigra/functortraits.hxx
index 175ffbf..63a7730 100644
--- a/include/vigra/functortraits.hxx
+++ b/include/vigra/functortraits.hxx
@@ -195,8 +195,6 @@ VIGRA_DEFINE_STL_FUNCTOR(std::binary_negate, VigraFalseType, VigraTrueType)
VIGRA_DEFINE_STL_FUNCTOR(std::negate, VigraTrueType, VigraFalseType)
VIGRA_DEFINE_STL_FUNCTOR(std::logical_not, VigraTrueType, VigraFalseType)
VIGRA_DEFINE_STL_FUNCTOR(std::unary_negate, VigraTrueType, VigraFalseType)
-VIGRA_DEFINE_STL_FUNCTOR(std::binder1st, VigraTrueType, VigraFalseType)
-VIGRA_DEFINE_STL_FUNCTOR(std::binder2nd, VigraTrueType, VigraFalseType)
#undef VIGRA_DEFINE_STL_FUNCTOR
template <class R>
--
2.15.0
>From c7dffd84e83729b7137790603121011a8f4394c0 Mon Sep 17 00:00:00 2001
From: Omari Stephens <[email protected]>
Date: Tue, 28 Dec 2021 21:44:59 +0000
Subject: [PATCH 2/3] Replaces usages of std::bind1st and std::bind2nd with
std::bind
std::bind1st and std::bind2nd were deprecated in c++11 and removed in c++17. This change restores the ability to compile libvigraimpex with compilers (like GCC11) that default to the c++17 standard.
The changes were autogenerated using the following two commands (which don't work generally, but work for the usages in this specific codebase):
$ ruby -pi -e '$_.sub!(/std::bind1st\((?<fxn>[^,]+), (?<arg>[^)]+)\)/, "std::bind(\\k<fxn>, \\k<arg>, std::placeholders::_1)")' $(grep -Rl 'std::bind1st')
$ ruby -pi -e '$_.sub!(/std::bind2nd\((?<fxn>[^,]+), (?<arg>[^)]+)\)/, "std::bind(\\k<fxn>, std::placeholders::_1, \\k<arg>)")' $(grep -Rl 'std::bind2nd')
This follows the idea of https://github.com/ukoethe/vigra/pull/500/commits/257084d845d20795a68e8d2591b83628da766976 , except that change misinterprets std::bind2nd (by incorrectly using std::placeholders::_1 and _2, instead of correctly passing _1 as the first or second argument after the function in std::bind)
---
include/vigra/fftw3.hxx | 4 ++--
include/vigra/functorexpression.hxx | 2 +-
include/vigra/numpy_array_traits.hxx | 2 +-
test/classifier/test.cxx | 2 +-
test/imagehierarchy/basic_image_test.hxx | 8 +++----
test/imagehierarchy/imagehierarchy_test.hxx | 26 +++++++++++------------
test/imagehierarchy/parent_test_class.hxx | 12 +++++------
test/imagehierarchy/select_image_test.hxx | 14 ++++++------
test/imagehierarchy/single_band_image_test.hxx | 20 ++++++++---------
test/imagehierarchy/variable_bands_image_test.hxx | 20 ++++++++---------
10 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/include/vigra/fftw3.hxx b/include/vigra/fftw3.hxx
index 00146f7..1f216ce 100644
--- a/include/vigra/fftw3.hxx
+++ b/include/vigra/fftw3.hxx
@@ -1489,7 +1489,7 @@ class FFTWPhaseAccessor
// do not forget to normalize the result according to the image size
transformImage(srcImageRange(spatial), destImage(spatial),
- std::bind1st(std::multiplies<FFTWComplex>(), 1.0 / width / height));
+ std::bind(std::multiplies<FFTWComplex>(), 1.0 / width / height, std::placeholders::_1));
\endcode
Note that in the creation of a plan, the height must be given
@@ -2785,7 +2785,7 @@ fourierTransformRealImpl(
if(norm != 1.0)
transformImage(srcImageRange(res), destIter(dul, dest),
- std::bind1st(std::multiplies<fftw_real>(), 1.0 / norm));
+ std::bind(std::multiplies<fftw_real>(), 1.0 / norm, std::placeholders::_1));
else
copyImage(srcImageRange(res), destIter(dul, dest));
}
diff --git a/include/vigra/functorexpression.hxx b/include/vigra/functorexpression.hxx
index 022df50..284c839 100644
--- a/include/vigra/functorexpression.hxx
+++ b/include/vigra/functorexpression.hxx
@@ -119,7 +119,7 @@
vigra::transformImage(srcImageRange(src), destImage(dest),
std::compose1(std::ptr_fun(exp),
- std::bind1st(std::multiplies<float>(), -beta)));
+ std::bind(std::multiplies<float>(), -beta, std::placeholders::_1)));
\endcode
I won't go into details on how this works. Suffice it to say that
diff --git a/include/vigra/numpy_array_traits.hxx b/include/vigra/numpy_array_traits.hxx
index adc0006..6d10c95 100644
--- a/include/vigra/numpy_array_traits.hxx
+++ b/include/vigra/numpy_array_traits.hxx
@@ -762,7 +762,7 @@ struct NumpyArrayTraits<N, TinyVector<T, M>, StridedArrayTag>
TinyVector<npy_intp, N+1> npyStride;
std::transform(
stride.begin(), stride.end(), npyStride.begin(),
- std::bind2nd(std::multiplies<npy_intp>(), sizeof(value_type)));
+ std::bind(std::multiplies<npy_intp>(), std::placeholders::_1, sizeof(value_type)));
npyStride[N] = sizeof(T);
return constructNumpyArrayFromData(npyShape, npyStride.begin(),
diff --git a/test/classifier/test.cxx b/test/classifier/test.cxx
index 1e26292..d069b43 100644
--- a/test/classifier/test.cxx
+++ b/test/classifier/test.cxx
@@ -533,7 +533,7 @@ struct ClassifierTest
totalWeight = std::accumulate(a, a + data.ClassIter(ii).size(),
totalWeight);
std::transform(tmp.begin(), tmp.end(),tmp.begin(),
- std::bind2nd(std::divides<double>(), totalWeight));
+ std::bind(std::divides<double>(), std::placeholders::_1, totalWeight));
MultiArrayView<2, double>
should_resp(Shp(1, data.ClassIter(ii).size()), tmp.data());
diff --git a/test/imagehierarchy/basic_image_test.hxx b/test/imagehierarchy/basic_image_test.hxx
index 9c1ec5a..cc15bd1 100644
--- a/test/imagehierarchy/basic_image_test.hxx
+++ b/test/imagehierarchy/basic_image_test.hxx
@@ -19,10 +19,10 @@ public:
void testOperatorAssignmentPixel()
{
(*image1_) = data[4];
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[4])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[4])));
(*image0_) = data[5];
- should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
+ should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
}
void testResizeInt()
@@ -57,13 +57,13 @@ public:
should(image1_->height() == 6);
should(image1_->width() == 4);
should(image1_->size() == vigra::Diff2D(4,6));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
image0_->resize(1, 4, data[10]);
should(image0_->height() == 4);
should(image0_->width() == 1);
should(image0_->size() == vigra::Diff2D(1,4));
- should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[10])));
+ should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[10])));
}
/** testet die Methode resizeCopy(BasicImage img) an Instanzen der Klasse BasicImage.
diff --git a/test/imagehierarchy/imagehierarchy_test.hxx b/test/imagehierarchy/imagehierarchy_test.hxx
index 4cd371d..10cf61c 100644
--- a/test/imagehierarchy/imagehierarchy_test.hxx
+++ b/test/imagehierarchy/imagehierarchy_test.hxx
@@ -22,13 +22,13 @@ public:
should(image1->height() == 4);
should(image1->width() == 3);
should(image1->size() == vigra::Diff2D(3,4));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[0])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[0])));
std::auto_ptr<Image> image2(Policy::factory(new typename ChildImage::InnerImage(0, 0, child_data[1])));
should(image2->height() == 0);
should(image2->width() == 0);
should(image2->size() == vigra::Diff2D(0,0));
- should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[1])));
+ should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[1])));
}
/** testet die clone() Methode der Klasse aus imagehierarchy
@@ -47,11 +47,11 @@ public:
*/
image1->init(data[5]);
should((*image1_->begin()) != static_cast<typename Image::PixelType> (data[5]));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
image1_->init(data[6]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
std::auto_ptr<typename Image::CloneType> image0(image0_->clone());
should(equal(*image0, *image0_));
@@ -84,12 +84,12 @@ public:
/* Aenderung mit der init-Funktion
*/
image1->init(data[7]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
image1->init(data[8]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
/* Eine shallowCopy zeigt auf die selben Daten des kopierten Objektes
*/
@@ -98,9 +98,9 @@ public:
should(&(*image1Copy) != &(*image1_));
image1Copy->init(data[9]);
- should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
+ should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
std::auto_ptr<Image> image0(image0_->shallowCopy());
should(equal(*image0, *image0_));
@@ -213,7 +213,7 @@ public:
*/
image1_->init(data[7]);
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
for(int x = 0; x < image1_->width(); x++)
for(int y = 0; y < image1_->height(); y++)
diff --git a/test/imagehierarchy/parent_test_class.hxx b/test/imagehierarchy/parent_test_class.hxx
index 65e6377..f5e3649 100644
--- a/test/imagehierarchy/parent_test_class.hxx
+++ b/test/imagehierarchy/parent_test_class.hxx
@@ -217,13 +217,13 @@ public:
should(image1->height() == 3);
should(image1->width() == 2);
should(image1->size() == vigra::Diff2D(2,3));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[0])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[0])));
std::auto_ptr<Image> image2(Policy::factory(0, 0, child_data[1]));
should(image2->height() == 0);
should(image2->width() == 0);
should(image2->size() == vigra::Diff2D(0,0));
- should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[1])));
+ should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[1])));
}
/** Testet den Copy Konstruktor ( Image(Image img) ).
@@ -266,13 +266,13 @@ public:
void testInit()
{
image1_->init(data[6]);
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
image1_->init(data[7]);
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
- should(image1_->end() != std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
+ should(image1_->end() != std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
image0_->init(data[8]);
- should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
+ should(image0_->end() == std::find_if(image0_->begin(), image0_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
}
void testWidth()
diff --git a/test/imagehierarchy/select_image_test.hxx b/test/imagehierarchy/select_image_test.hxx
index c2df9f0..238313f 100644
--- a/test/imagehierarchy/select_image_test.hxx
+++ b/test/imagehierarchy/select_image_test.hxx
@@ -23,7 +23,7 @@ public:
should(image1->size() == vigra::Diff2D(2,3));
// Bei SelectBandImage wird nur der selektierte Band mit dem Pixel child_data[0] initialisiert
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[0][Policy::n])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[0][Policy::n])));
std::auto_ptr<Image> image2(Policy::factory(0, 0, child_data[1]));
should(image2->height() == 0);
@@ -31,7 +31,7 @@ public:
should(image2->size() == vigra::Diff2D(0,0));
// Bei SelectBandImage wird nur der selektierte Band mit dem Pixel child_data[1] initialisiert
- should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[1][Policy::n])));
+ should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[1][Policy::n])));
}
/** Testet den Copy Konstruktor ( Image(Image img) ).
@@ -62,13 +62,13 @@ public:
should(image1->height() == 4);
should(image1->width() == 3);
should(image1->size() == vigra::Diff2D(3,4));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[0][Policy::n])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[0][Policy::n])));
std::auto_ptr<Image> image2(Policy::factory(new typename ChildImage::InnerImage(0, 0, child_data[1])));
should(image2->height() == 0);
should(image2->width() == 0);
should(image2->size() == vigra::Diff2D(0,0));
- should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), child_data[1][Policy::n])));
+ should(image2->end() == std::find_if(image2->begin(), image2->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, child_data[1][Policy::n])));
}
/** testet die clone() Methode der Klasse aus imagehierarchy
@@ -87,11 +87,11 @@ public:
*/
image1->init(data[5]);
should((*image1_->begin()) != static_cast<typename Image::PixelType> (data[5]));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
image1_->init(data[6]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
std::auto_ptr<typename Image::CloneType> image0(image0_->clone());
should(equal(*image0, *image0_));
diff --git a/test/imagehierarchy/single_band_image_test.hxx b/test/imagehierarchy/single_band_image_test.hxx
index 5002fde..b82b318 100644
--- a/test/imagehierarchy/single_band_image_test.hxx
+++ b/test/imagehierarchy/single_band_image_test.hxx
@@ -29,11 +29,11 @@ public:
*/
image1->init(data[5]);
should((*image1_->begin()) != static_cast<typename Image::PixelType> (data[5]));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
image1_->init(data[6]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
std::auto_ptr<typename Image::CloneType> image0(image0_->clone());
should(equal(*image0, *image0_));
@@ -58,12 +58,12 @@ public:
/* Aenderung mit der init-Funktion
*/
image1->init(data[7]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
image1->init(data[8]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
/* Eine shallowCopy zeigt auf die selben Daten des kopierten Objektes
*/
@@ -72,9 +72,9 @@ public:
should(&(*image1Copy) != &(*image1_));
image1Copy->init(data[9]);
- should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
+ should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
std::auto_ptr<Image> image0(image0_->shallowCopy());
should(equal(*image0, *image0_));
diff --git a/test/imagehierarchy/variable_bands_image_test.hxx b/test/imagehierarchy/variable_bands_image_test.hxx
index 96c72e6..9f2b4e7 100644
--- a/test/imagehierarchy/variable_bands_image_test.hxx
+++ b/test/imagehierarchy/variable_bands_image_test.hxx
@@ -29,11 +29,11 @@ public:
*/
image1->init(data[5]);
should((*image1_->begin()) != static_cast<typename Image::PixelType> (data[5]));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
image1_->init(data[6]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[5])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[6])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[5])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[6])));
std::auto_ptr<typename Image::CloneType> image0(image0_->clone());
should(equal(*image0, *image0_));
@@ -58,12 +58,12 @@ public:
/* Aenderung mit der init-Funktion
*/
image1->init(data[7]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[7])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[7])));
image1->init(data[8]);
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[8])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[8])));
/* Eine shallowCopy zeigt auf die selben Daten des kopierten Objektes
*/
@@ -72,9 +72,9 @@ public:
should(&(*image1Copy) != &(*image1_));
image1Copy->init(data[9]);
- should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
- should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind2nd(Pixels_not_equal_to<value_type>(), data[9])));
+ should(image1Copy->end() == std::find_if(image1Copy->begin(), image1Copy->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1_->end() == std::find_if(image1_->begin(), image1_->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
+ should(image1->end() == std::find_if(image1->begin(), image1->end(), std::bind(Pixels_not_equal_to<value_type>(), std::placeholders::_1, data[9])));
std::auto_ptr<Image> image0(image0_->shallowCopy());
should(equal(*image0, *image0_));
--
2.15.0
>From faf6c37561089cf874334d64027afae4c812d9f0 Mon Sep 17 00:00:00 2001
From: Omari Stephens <[email protected]>
Date: Tue, 28 Dec 2021 21:54:51 +0000
Subject: [PATCH 3/3] Updates doc generation config for Python 3 compatibility
---
vigranumpy/docsrc/conf.py.cmake2.in | 2 +-
vigranumpy/docsrc/conf.py.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vigranumpy/docsrc/conf.py.cmake2.in b/vigranumpy/docsrc/conf.py.cmake2.in
index e4266a6..175dfb3 100644
--- a/vigranumpy/docsrc/conf.py.cmake2.in
+++ b/vigranumpy/docsrc/conf.py.cmake2.in
@@ -23,7 +23,7 @@ _original_getargspec = inspect.getargspec
def _getargspec_workaround(*args, **kw):
try:
return _original_getargspec(*args, **kw)
- except TypeError, e:
+ except TypeError as e:
if str(e).startswith('arg is not a Python function'):
return inspect.ArgSpec([], None, None, None)
else:
diff --git a/vigranumpy/docsrc/conf.py.in b/vigranumpy/docsrc/conf.py.in
index 6075593..ac2261d 100644
--- a/vigranumpy/docsrc/conf.py.in
+++ b/vigranumpy/docsrc/conf.py.in
@@ -22,7 +22,7 @@ _original_getargspec = inspect.getargspec
def _getargspec_workaround(*args, **kw):
try:
return _original_getargspec(*args, **kw)
- except TypeError, e:
+ except TypeError as e:
if str(e).startswith('arg is not a Python function'):
return inspect.ArgSpec([], None, None, None)
else:
--
2.15.0
--
Pkg-phototools-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-phototools-devel