Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd746cd

Browse files
committed
Use correct types for array sizes.
1 parent ff4ab66 commit bd746cd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/matplotlib/tri/_tri.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,9 @@ PyObject* TriContourGenerator::contour_to_segs_and_kinds(const Contour& contour)
629629
ContourLine::const_iterator point;
630630

631631
// Find total number of points in all contour lines.
632-
int n_points = 0;
632+
npy_intp n_points = 0;
633633
for (line = contour.begin(); line != contour.end(); ++line)
634-
n_points += line->size();
634+
n_points += (npy_intp)line->size();
635635

636636
// Create segs array for point coordinates.
637637
npy_intp segs_dims[2] = {n_points, 2};
@@ -1021,8 +1021,8 @@ TrapezoidMapTriFinder::add_edge_to_tree(const Edge& edge)
10211021
// Iterate through trapezoids intersecting edge from left to right.
10221022
// Replace each old trapezoid with 2+ new trapezoids, and replace its
10231023
// corresponding nodes in the search tree with new nodes.
1024-
unsigned int ntraps = trapezoids.size();
1025-
for (unsigned int i = 0; i < ntraps; ++i) {
1024+
size_t ntraps = trapezoids.size();
1025+
for (size_t i = 0; i < ntraps; ++i) {
10261026
Trapezoid* old = trapezoids[i]; // old trapezoid to replace.
10271027
bool start_trap = (i == 0);
10281028
bool end_trap = (i == ntraps-1);
@@ -1397,8 +1397,8 @@ TrapezoidMapTriFinder::initialize()
13971397
std::random_shuffle(_edges.begin()+2, _edges.end(), rng);
13981398

13991399
// Add edges, one at a time, to tree.
1400-
unsigned int nedges = _edges.size();
1401-
for (unsigned int index = 2; index < nedges; ++index) {
1400+
size_t nedges = _edges.size();
1401+
for (size_t index = 2; index < nedges; ++index) {
14021402
if (!add_edge_to_tree(_edges[index]))
14031403
throw std::runtime_error("Triangulation is invalid");
14041404
_tree->assert_valid(index == nedges-1);

src/_path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ int convert_to_string(PathIterator &path,
12291229
}
12301230

12311231
if (sketch_params.scale != 0.0) {
1232-
*buffersize *= 10.0;
1232+
*buffersize *= 10;
12331233
}
12341234

12351235
*buffer = (char *)malloc(*buffersize);

src/_png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds)
173173

174174
png_uint_32 width = (png_uint_32)buffer.dim(1);
175175
png_uint_32 height = (png_uint_32)buffer.dim(0);
176-
int channels = buffer.dim(2);
176+
npy_intp channels = buffer.dim(2);
177177
std::vector<png_bytep> row_pointers(height);
178178
for (png_uint_32 row = 0; row < (png_uint_32)height; ++row) {
179179
row_pointers[row] = (png_bytep)&buffer(row, 0, 0);

0 commit comments

Comments
 (0)