summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-03-13 21:44:30 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-03-13 21:44:30 +0000
commit3e19ed88ad827fc4e9e638713d672f6fa5346926 (patch)
tree79e44f01ba54b5a8c41818ab0a4e37e832c358d3 /src
parentcppcheck (diff)
downloadinkscape-3e19ed88ad827fc4e9e638713d672f6fa5346926.tar.gz
inkscape-3e19ed88ad827fc4e9e638713d672f6fa5346926.zip
Fix build failure with clang. Thanks to Samuel Chase for patch (leaks fixed).
(bzr r12202)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/basic-intersection.cpp12
-rw-r--r--src/2geom/recursive-bezier-intersection.cpp11
-rw-r--r--src/2geom/solve-bezier-parametric.cpp27
-rw-r--r--src/color-profile.cpp6
4 files changed, 45 insertions, 11 deletions
diff --git a/src/2geom/basic-intersection.cpp b/src/2geom/basic-intersection.cpp
index 3be6792b9..544bf0dd1 100644
--- a/src/2geom/basic-intersection.cpp
+++ b/src/2geom/basic-intersection.cpp
@@ -64,7 +64,12 @@ void find_intersections(std::vector< std::pair<double, double> > & xs,
void split(vector<Point> const &p, double t,
vector<Point> &left, vector<Point> &right) {
const unsigned sz = p.size();
- Geom::Point Vtemp[sz][sz];
+
+ Geom::Point **Vtemp = new Geom::Point* [sz];
+
+ for (unsigned int i = 0; i < sz; ++i) {
+ Vtemp[i] = new Geom::Point[sz];
+ }
/* Copy control points */
std::copy(p.begin(), p.end(), Vtemp[0]);
@@ -82,6 +87,11 @@ void split(vector<Point> const &p, double t,
left[j] = Vtemp[j][0];
for (unsigned j = 0; j < sz; j++)
right[j] = Vtemp[sz-1-j][j];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
}
diff --git a/src/2geom/recursive-bezier-intersection.cpp b/src/2geom/recursive-bezier-intersection.cpp
index b4c81e08e..7db0438a7 100644
--- a/src/2geom/recursive-bezier-intersection.cpp
+++ b/src/2geom/recursive-bezier-intersection.cpp
@@ -81,7 +81,11 @@ const double INV_EPS = (1L<<14);
*/
void OldBezier::split(double t, OldBezier &left, OldBezier &right) const {
const unsigned sz = p.size();
- Geom::Point Vtemp[sz][sz];
+
+ Geom::Point **Vtemp = new Geom::Point* [sz];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ Vtemp[i] = new Geom::Point[sz];
/* Copy control points */
std::copy(p.begin(), p.end(), Vtemp[0]);
@@ -99,6 +103,11 @@ void OldBezier::split(double t, OldBezier &left, OldBezier &right) const {
left.p[j] = Vtemp[j][0];
for (unsigned j = 0; j < sz; j++)
right.p[j] = Vtemp[sz-1-j][j];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
}
#if 0
diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp
index 76cf65e17..ed693c584 100644
--- a/src/2geom/solve-bezier-parametric.cpp
+++ b/src/2geom/solve-bezier-parametric.cpp
@@ -68,13 +68,20 @@ find_parametric_bezier_roots(Geom::Point const *w, /* The control points */
break;
}
- /* Otherwise, solve recursively after subdividing control polygon */
- Geom::Point Left[degree+1], /* New left and right */
- Right[degree+1]; /* control polygons */
+ /*
+ * Otherwise, solve recursively after subdividing control polygon
+ * New left and right control polygons
+ */
+ Geom::Point *Left = new Geom::Point[degree+1];
+ Geom::Point *Right = new Geom::Point[degree+1];
+
Bezier(w, degree, 0.5, Left, Right);
total_subs ++;
find_parametric_bezier_roots(Left, degree, solutions, depth+1);
find_parametric_bezier_roots(Right, degree, solutions, depth+1);
+
+ delete[] Left;
+ delete[] Right;
}
@@ -191,7 +198,10 @@ Bezier(Geom::Point const *V, /* Control pts */
Geom::Point *Left, /* RETURN left half ctl pts */
Geom::Point *Right) /* RETURN right half ctl pts */
{
- Geom::Point Vtemp[degree+1][degree+1];
+ Geom::Point **Vtemp = new Geom::Point* [degree+1];
+
+ for (unsigned int i = 0; i < degree+1; ++i)
+ Vtemp[i] = new Geom::Point[degree+1];
/* Copy control points */
std::copy(V, V+degree+1, Vtemp[0]);
@@ -208,7 +218,14 @@ Bezier(Geom::Point const *V, /* Control pts */
for (unsigned j = 0; j <= degree; j++)
Right[j] = Vtemp[degree-j][j];
- return (Vtemp[degree][0]);
+ Geom::Point return_value = Vtemp[degree][0];
+
+ for (unsigned int i = 0; i < degree+1; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
+
+ return return_value;
}
};
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 42b6e86dd..fe663957c 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -103,6 +103,8 @@ extern guint update_in_progress;
static SPObjectClass *cprof_parent_class;
+namespace Inkscape {
+
class ColorProfileImpl {
public:
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -129,10 +131,6 @@ public:
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
};
-
-
-namespace Inkscape {
-
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig)
{