Skip to content

Commit c63f671

Browse files
committed
Merge pull request matplotlib#1434 from mgiuca-google/c++-11-narrowing
C++11 narrowing conversions
2 parents 332ac0a + 913b460 commit c63f671

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/tri/_tri.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void Triangulation::calculate_edges()
277277
}
278278

279279
// Convert to python _edges array.
280-
npy_intp dims[2] = {edge_set.size(), 2};
280+
npy_intp dims[2] = {static_cast<npy_intp>(edge_set.size()), 2};
281281
_edges = (PyArrayObject*)PyArray_SimpleNew(2, dims, PyArray_INT);
282282
int* edges_ptr = (int*)PyArray_DATA(_edges);
283283
for (EdgeSet::const_iterator it = edge_set.begin(); it != edge_set.end(); ++it) {
@@ -571,7 +571,7 @@ Py::Object TriContourGenerator::contour_to_segs(const Contour& contour)
571571
Py::List segs(contour.size());
572572
for (Contour::size_type i = 0; i < contour.size(); ++i) {
573573
const ContourLine& line = contour[i];
574-
npy_intp dims[2] = {line.size(),2};
574+
npy_intp dims[2] = {static_cast<npy_intp>(line.size()),2};
575575
PyArrayObject* py_line = (PyArrayObject*)PyArray_SimpleNew(
576576
2, dims, PyArray_DOUBLE);
577577
double* p = (double*)PyArray_DATA(py_line);

src/_path.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ _add_polygon(Py::List& polygons, const std::vector<double>& polygon)
13531353
{
13541354
return;
13551355
}
1356-
npy_intp polygon_dims[] = { polygon.size() / 2, 2, 0 };
1356+
npy_intp polygon_dims[] = { static_cast<npy_intp>(polygon.size() / 2), 2, 0 };
13571357
PyArrayObject* polygon_array = NULL;
13581358
polygon_array = (PyArrayObject*)PyArray_SimpleNew
13591359
(2, polygon_dims, PyArray_DOUBLE);

0 commit comments

Comments
 (0)