Skip to content

Commit

Permalink
version 3.0.5,
Browse files Browse the repository at this point in the history
fix some data types to work with numpy and prevent warnings,
fix warning in gpfInfo()
  • Loading branch information
jraedler committed Jul 3, 2012
1 parent 7f1ff09 commit 44bade9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
03.07.12
- version 3.0.5
- changed some data types to prevent warnings
- fixed numpy interface
- numpy support is switched on by default now
- fixed warning in gpfInfo()

30.03.11
- version 3.0.4
- fixed a bug in writeSVG()
Expand Down
2 changes: 1 addition & 1 deletion Polygon/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,5 @@ def gpfInfo(fileName):
holes += int(f.readline())
[ f.readline() for p in range(pp-x) ]
points += pp

f.close()
return contours, holes, points, withHoles
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * faster adding of contours from NumPy arrays
# * data style STYLE_NUMPY to get contours and TriStrips
# as NumPy arrays
withNumPy=False
withNumPy=True

# if withNumPy is True, set the include path for numpy/arrayobject.h
# the example is for python on Windows:
Expand Down Expand Up @@ -71,7 +71,7 @@

args = {
'name' : "Polygon",
'version' : "3.0.4",
'version' : "3.0.5",
'description' : "Polygon is a python package that handles polygonal shapes in 2D",
'long_description': longdesc,
'license' : "LGPL for Polygon, other for gpc",
Expand Down
10 changes: 5 additions & 5 deletions src/cPolygon.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Operations on polygons:\n\
#define INDEF INT_MAX

#ifndef POLY_VERSION
#define POLY_VERSION "3.0.4"
#define POLY_VERSION "3.0.5"
#endif

#ifndef PyMODINIT_FUNC
Expand Down Expand Up @@ -348,12 +348,12 @@ static PyObject *Polygon_repr(PyObject *self) {
}


static int Polygon_len(PyObject *self) {
static Py_ssize_t Polygon_len(PyObject *self) {
return ((Polygon *)self)->gpc_p->num_contours;
}


static PyObject *Polygon_getitem(PyObject *self, int item) {
static PyObject *Polygon_getitem(PyObject *self, Py_ssize_t item) {
PyObject *R;
gpc_vertex_list * vl = NULL;
gpc_vertex *v;
Expand Down Expand Up @@ -391,7 +391,7 @@ static PyObject *Polygon_getitem(PyObject *self, int item) {
} break;
#ifdef WITH_NUMPY
case STYLE_NUMPY: {
int dims[2] = {0, 2};
npy_intp dims[2] = {0, 2};
PyArrayObject *a;
dims[0] = imax;
R = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
Expand Down Expand Up @@ -1037,7 +1037,7 @@ static PyObject *Polygon_triStrip(Polygon *self) {
} break;
#ifdef WITH_NUMPY
case STYLE_NUMPY: {
int dims[2] = {0, 2};
npy_intp dims[2] = {0, 2};
R = PyTuple_New(t->num_strips);
for (i=0; i < t->num_strips; i++) {
vl = t->strip + i;
Expand Down

0 comments on commit 44bade9

Please sign in to comment.