[slic3r] Add patch from Debian to fix debian#757798
Miro Hrončok
churchyard at fedoraproject.org
Tue Sep 23 14:13:46 UTC 2014
commit 7d8e177474145be53096b25eecaf7bb6a798f7ff
Author: Miro Hrončok <miro at hroncok.cz>
Date: Tue Sep 23 16:13:44 2014 +0200
Add patch from Debian to fix debian#757798
slic3r-test-out-of-memory.patch | 138 +++++++++++++++++++++++++++++++++++++++
slic3r.spec | 9 ++-
2 files changed, 144 insertions(+), 3 deletions(-)
---
diff --git a/slic3r-test-out-of-memory.patch b/slic3r-test-out-of-memory.patch
new file mode 100644
index 0000000..63e83b6
--- /dev/null
+++ b/slic3r-test-out-of-memory.patch
@@ -0,0 +1,138 @@
+From: Alessandro Ranellucci <aar at cpan.org>
+Date: Wed, 25 Jun 2014 14:57:06 +0200
+Subject: Fix compilation under 5.20 (untested). #2109
+
+Bug-Debian: #757798
+Bug: https://github.com/alexrj/Slic3r/issues/2109
+Origin: commit:67bf99633e48f9c8a5863b88c2a03fddc1cc247f
+---
+ xs/Build.PL | 2 +-
+ xs/src/ClipperUtils.cpp | 2 +-
+ xs/src/MultiPoint.cpp | 4 ++--
+ xs/xsp/TriangleMesh.xsp | 6 ++++--
+ xs/xsp/my.map | 17 +++++++++++------
+ 5 files changed, 19 insertions(+), 12 deletions(-)
+
+diff --git a/xs/Build.PL b/xs/Build.PL
+index e21df5e..49195d7 100644
+--- a/xs/Build.PL
++++ b/xs/Build.PL
+@@ -30,7 +30,7 @@ my $build = Module::Build::WithXSpp->new(
+ build_requires => {qw(
+ ExtUtils::ParseXS 3.18
+ ExtUtils::Typemap 1.00
+- ExtUtils::Typemaps::Default 1.03
++ ExtUtils::Typemaps::Default 1.05
+ ExtUtils::XSpp 0.17
+ Module::Build 0.3601
+ Test::More 0
+diff --git a/xs/src/ClipperUtils.cpp b/xs/src/ClipperUtils.cpp
+index 2989783..240cf3b 100644
+--- a/xs/src/ClipperUtils.cpp
++++ b/xs/src/ClipperUtils.cpp
+@@ -542,7 +542,7 @@ polynode_children_2_perl(const ClipperLib::PolyNode& node)
+ {
+ AV* av = newAV();
+ const unsigned int len = node.ChildCount();
+- av_extend(av, len-1);
++ if (len > 0) av_extend(av, len-1);
+ for (int i = 0; i < len; ++i) {
+ av_store(av, i, polynode2perl(*node.Childs[i]));
+ }
+diff --git a/xs/src/MultiPoint.cpp b/xs/src/MultiPoint.cpp
+index 47830ce..5da3cb4 100644
+--- a/xs/src/MultiPoint.cpp
++++ b/xs/src/MultiPoint.cpp
+@@ -139,7 +139,7 @@ SV*
+ MultiPoint::to_AV() {
+ const unsigned int num_points = this->points.size();
+ AV* av = newAV();
+- av_extend(av, num_points-1);
++ if (num_points > 0) av_extend(av, num_points-1);
+ for (unsigned int i = 0; i < num_points; i++) {
+ av_store(av, i, perl_to_SV_ref(this->points[i]));
+ }
+@@ -150,7 +150,7 @@ SV*
+ MultiPoint::to_SV_pureperl() const {
+ const unsigned int num_points = this->points.size();
+ AV* av = newAV();
+- av_extend(av, num_points-1);
++ if (num_points > 0) av_extend(av, num_points-1);
+ for (unsigned int i = 0; i < num_points; i++) {
+ av_store(av, i, this->points[i].to_SV_pureperl());
+ }
+diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp
+index 3338d97..be40543 100644
+--- a/xs/xsp/TriangleMesh.xsp
++++ b/xs/xsp/TriangleMesh.xsp
+@@ -151,10 +151,12 @@ TriangleMesh::slice(z)
+ mslicer.slice(z_f, &layers);
+
+ AV* layers_av = newAV();
+- av_extend(layers_av, layers.size()-1);
++ size_t len = layers.size();
++ if (len > 0) av_extend(layers_av, len-1);
+ for (unsigned int i = 0; i < layers.size(); i++) {
+ AV* expolygons_av = newAV();
+- av_extend(expolygons_av, layers[i].size()-1);
++ len = layers[i].size();
++ if (len > 0) av_extend(expolygons_av, len-1);
+ unsigned int j = 0;
+ for (ExPolygons::iterator it = layers[i].begin(); it != layers[i].end(); ++it) {
+ av_store(expolygons_av, j++, perl_to_SV_clone_ref(*it));
+diff --git a/xs/xsp/my.map b/xs/xsp/my.map
+index e69ba04..994874d 100644
+--- a/xs/xsp/my.map
++++ b/xs/xsp/my.map
+@@ -235,7 +235,8 @@ T_ARRAYREF
+ AV* av = newAV();
+ $arg = newRV_noinc((SV*)av);
+ sv_2mortal($arg);
+- av_extend(av, $var.size()-1);
++ const unsigned int len = $var.size();
++ if (len > 0) av_extend(av, len-1);
+ int i = 0;
+ for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
+ av_store(av, i++, perl_to_SV_clone_ref(*it));
+@@ -246,7 +247,8 @@ T_ARRAYREF_PTR
+ AV* av = newAV();
+ $arg = newRV_noinc((SV*)av);
+ sv_2mortal($arg);
+- av_extend(av, $var->size()-1);
++ const unsigned int len = $var->size();
++ if (len > 0) av_extend(av, len-1);
+ int i = 0;
+ for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
+ av_store(av, i++, perl_to_SV_ref(*it));
+@@ -256,7 +258,8 @@ T_PTR_ARRAYREF_PTR
+ AV* av = newAV();
+ $arg = newRV_noinc((SV*)av);
+ sv_2mortal($arg);
+- av_extend(av, $var->size()-1);
++ const unsigned int len = $var->size();
++ if (len > 0) av_extend(av, len-1);
+ int i = 0;
+ for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
+ av_store(av, i++, perl_to_SV_ref(**it));
+@@ -266,7 +269,8 @@ T_PTR_ARRAYREF
+ AV* av = newAV();
+ $arg = newRV_noinc((SV*)av);
+ sv_2mortal($arg);
+- av_extend(av, $var.size()-1);
++ const unsigned int len = $var.size();
++ if (len > 0) av_extend(av, len-1);
+ int i = 0;
+ for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
+ av_store(av, i++, (*it)->to_SV());
+@@ -275,8 +279,9 @@ T_PTR_ARRAYREF
+ T_LAYER_HEIGHT_RANGES
+ AV* av = newAV();
+ $arg = newRV_noinc((SV*)av);
+- sv_2mortal($arg);
+- av_extend(av, $var.size() - 1);
++ sv_2mortal($arg);
++ const unsigned int len = $var.size();
++ if (len > 0) av_extend(av, len-1);
+ // map is sorted, so we can just copy it in order
+ int i = 0;
+ for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
diff --git a/slic3r.spec b/slic3r.spec
index ea46fdd..7b71201 100644
--- a/slic3r.spec
+++ b/slic3r.spec
@@ -21,10 +21,11 @@ Patch1: %{name}-nowarn-datadir.patch
Patch2: %{name}-english-locale.patch
Patch3: %{name}-linker.patch
Patch4: %{name}-clear-error.patch
+Patch5: %{name}-test-out-of-memory.patch
%if %with_clipper
# Unbundle clipper
-Patch5: %{name}-clipper.patch
+Patch6: %{name}-clipper.patch
%endif
Source1: %{name}.desktop
@@ -35,7 +36,7 @@ BuildRequires: perl(Encode::Locale)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.80
BuildRequires: perl(ExtUtils::ParseXS) >= 3.22
BuildRequires: perl(ExtUtils::Typemap)
-BuildRequires: perl(ExtUtils::Typemaps::Default) >= 1.03
+BuildRequires: perl(ExtUtils::Typemaps::Default) >= 1.05
BuildRequires: perl(File::Basename)
BuildRequires: perl(File::Spec)
BuildRequires: perl(Getopt::Long)
@@ -87,9 +88,10 @@ for more information.
%patch2 -p1
%patch3 -p1
%patch4 -p1
+%patch5 -p1
%if %with_clipper
-%patch5 -p1
+%patch6 -p1
# Remove bundled clipper
rm xs/src/clipper.*pp
%endif
@@ -188,6 +190,7 @@ fi
%changelog
* Tue Sep 23 2014 Miro Hrončok <mhroncok at redhat.com> - 1.1.7-1
- Update to 1.1.7
+- Add patch from Debian to fix debian#757798
* Tue Sep 23 2014 Miro Hrončok <mhroncok at redhat.com> - 1.1.6-4
- Admesh 0.98.1 compatibility patch
More information about the scm-commits
mailing list