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

Skip to content

Commit 7bacaa6

Browse files
committed
[2903460] _path.pyd crashes in 0.99.1.win32-py2.6 on PIII CPU
svn path=/branches/v0_99_maint/; revision=8001
1 parent d12f935 commit 7bacaa6

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/_path.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool point_in_path_impl(const double tx, const double ty, T& path)
147147

148148
// The following cases denote the beginning on a new subpath
149149
if (code == agg::path_cmd_stop ||
150-
(code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
150+
(code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
151151
{
152152
x = sx;
153153
y = sy;
@@ -190,13 +190,13 @@ bool point_in_path_impl(const double tx, const double ty, T& path)
190190
vty1 = y;
191191
}
192192
while (code != agg::path_cmd_stop &&
193-
(code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
193+
(code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
194194

195195
yflag1 = (vty1 >= ty);
196196
if (yflag0 != yflag1)
197197
{
198198
if ( ((vty1-ty) * (vtx0-vtx1) >=
199-
(vtx1-tx) * (vty0-vty1)) == yflag1 )
199+
(vtx1-tx) * (vty0-vty1)) == yflag1 )
200200
{
201201
inside_flag ^= 1;
202202
}
@@ -462,7 +462,7 @@ Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args)
462462

463463
//segments, trans, clipbox, colors, linewidths, antialiaseds
464464
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr());
465-
Py::SeqBase<Py::Object> paths = args[1];
465+
Py::SeqBase<Py::Object> paths = args[1];
466466
Py::SeqBase<Py::Object> transforms_obj = args[2];
467467
Py::Object offsets_obj = args[3];
468468
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4].ptr(), false);
@@ -474,15 +474,15 @@ Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args)
474474
{
475475
offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
476476
if (!offsets ||
477-
(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
478-
(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
477+
(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
478+
(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
479479
{
480480
throw Py::ValueError("Offsets array must be Nx2");
481481
}
482482

483483
size_t Npaths = paths.length();
484484
size_t Noffsets = offsets->dimensions[0];
485-
size_t N = std::max(Npaths, Noffsets);
485+
size_t N = std::max(Npaths, Noffsets);
486486
size_t Ntransforms = std::min(transforms_obj.length(), N);
487487
size_t i;
488488

@@ -555,16 +555,16 @@ Py::Object _path_module::point_in_path_collection(const Py::Tuple& args)
555555
double y = Py::Float(args[1]);
556556
double radius = Py::Float(args[2]);
557557
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3].ptr());
558-
Py::SeqBase<Py::Object> paths = args[4];
558+
Py::SeqBase<Py::Object> paths = args[4];
559559
Py::SeqBase<Py::Object> transforms_obj = args[5];
560560
Py::SeqBase<Py::Object> offsets_obj = args[6];
561561
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7].ptr());
562562
bool filled = Py::Int(args[8]);
563563

564564
PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
565565
if (!offsets ||
566-
(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
567-
(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
566+
(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
567+
(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
568568
{
569569
Py_XDECREF(offsets);
570570
throw Py::ValueError("Offsets array must be Nx2");
@@ -888,7 +888,7 @@ Py::Object _path_module::clip_path_to_rect(const Py::Tuple &args)
888888
}
889889
for (size_t i = 0; i < size; ++i)
890890
{
891-
((double *)pyarray->data)[2*i] = (*p)[i].x;
891+
((double *)pyarray->data)[2*i] = (*p)[i].x;
892892
((double *)pyarray->data)[2*i+1] = (*p)[i].y;
893893
}
894894
if (PyList_SetItem(py_results, p - results.begin(), (PyObject *)pyarray) != -1)
@@ -922,14 +922,14 @@ Py::Object _path_module::affine_transform(const Py::Tuple& args)
922922
vertices = (PyArrayObject*)PyArray_FromObject
923923
(vertices_obj.ptr(), PyArray_DOUBLE, 1, 2);
924924
if (!vertices ||
925-
(PyArray_NDIM(vertices) == 2 && PyArray_DIM(vertices, 1) != 2) ||
926-
(PyArray_NDIM(vertices) == 1 && PyArray_DIM(vertices, 0) != 2))
925+
(PyArray_NDIM(vertices) == 2 && PyArray_DIM(vertices, 1) != 2) ||
926+
(PyArray_NDIM(vertices) == 1 && PyArray_DIM(vertices, 0) != 2))
927927
throw Py::ValueError("Invalid vertices array.");
928928

929929
transform = (PyArrayObject*) PyArray_FromObject
930930
(transform_obj.ptr(), PyArray_DOUBLE, 2, 2);
931931
if (!transform ||
932-
PyArray_DIM(transform, 0) != 3 ||
932+
PyArray_DIM(transform, 0) != 3 ||
933933
PyArray_DIM(transform, 1) != 3)
934934
throw Py::ValueError("Invalid transform.");
935935

@@ -1010,7 +1010,7 @@ Py::Object _path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args)
10101010
{
10111011
args.verify_length(2);
10121012

1013-
Py::Object bbox = args[0];
1013+
Py::Object bbox = args[0];
10141014
Py::SeqBase<Py::Object> bboxes = args[1];
10151015

10161016
double ax0, ay0, ax1, ay1;
@@ -1131,13 +1131,13 @@ Py::Object _path_module::path_intersects_path(const Py::Tuple& args)
11311131

11321132
void _add_polygon(Py::List& polygons, const std::vector<double>& polygon) {
11331133
if (polygon.size() == 0)
1134-
return;
1134+
return;
11351135
npy_intp polygon_dims[] = { polygon.size() / 2, 2, 0 };
11361136
PyArrayObject* polygon_array = NULL;
11371137
polygon_array = (PyArrayObject*)PyArray_SimpleNew
1138-
(2, polygon_dims, PyArray_DOUBLE);
1138+
(2, polygon_dims, PyArray_DOUBLE);
11391139
if (!polygon_array)
1140-
throw Py::MemoryError("Error creating polygon array");
1140+
throw Py::MemoryError("Error creating polygon array");
11411141
double* polygon_data = (double*)PyArray_DATA(polygon_array);
11421142
memcpy(polygon_data, &polygon[0], polygon.size() * sizeof(double));
11431143
polygons.append(Py::Object((PyObject*)polygon_array, true));
@@ -1179,26 +1179,26 @@ Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args)
11791179

11801180
while ((code = curve.vertex(&x, &y)) != agg::path_cmd_stop)
11811181
{
1182-
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
1182+
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
11831183
{
1184-
if (polygon.size() >= 2)
1185-
{
1186-
polygon.push_back(polygon[0]);
1187-
polygon.push_back(polygon[1]);
1188-
_add_polygon(polygons, polygon);
1189-
}
1190-
polygon.clear();
1191-
}
1184+
if (polygon.size() >= 2)
1185+
{
1186+
polygon.push_back(polygon[0]);
1187+
polygon.push_back(polygon[1]);
1188+
_add_polygon(polygons, polygon);
1189+
}
1190+
polygon.clear();
1191+
}
11921192
else
11931193
{
1194-
if (code == agg::path_cmd_move_to)
1194+
if (code == agg::path_cmd_move_to)
11951195
{
1196-
_add_polygon(polygons, polygon);
1197-
polygon.clear();
1198-
}
1199-
polygon.push_back(x);
1200-
polygon.push_back(y);
1201-
}
1196+
_add_polygon(polygons, polygon);
1197+
polygon.clear();
1198+
}
1199+
polygon.push_back(x);
1200+
polygon.push_back(y);
1201+
}
12021202
}
12031203

12041204
_add_polygon(polygons, polygon);
@@ -1356,8 +1356,8 @@ extern "C"
13561356
DL_EXPORT(void)
13571357
init_path(void)
13581358
{
1359-
import_array();
1360-
13611359
static _path_module* _path = NULL;
13621360
_path = new _path_module;
1361+
1362+
import_array();
13631363
}

0 commit comments

Comments
 (0)