diff --git a/extern/agg24-svn/include/agg_span_gouraud_rgba.h b/extern/agg24-svn/include/agg_span_gouraud_rgba.h index 89192d227bee..1b2857202971 100644 --- a/extern/agg24-svn/include/agg_span_gouraud_rgba.h +++ b/extern/agg24-svn/include/agg_span_gouraud_rgba.h @@ -198,10 +198,10 @@ namespace agg vg = g.y(); vb = b.y(); va = a.y(); - if(vr < 0) vr = 0; if(vr > lim) vr = lim; - if(vg < 0) vg = 0; if(vg > lim) vg = lim; - if(vb < 0) vb = 0; if(vb > lim) vb = lim; - if(va < 0) va = 0; if(va > lim) va = lim; + if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; }; + if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; }; + if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; }; + if(va < 0) { va = 0; }; if(va > lim) { va = lim; }; span->r = (value_type)vr; span->g = (value_type)vg; span->b = (value_type)vb; @@ -245,10 +245,10 @@ namespace agg vg = g.y(); vb = b.y(); va = a.y(); - if(vr < 0) vr = 0; if(vr > lim) vr = lim; - if(vg < 0) vg = 0; if(vg > lim) vg = lim; - if(vb < 0) vb = 0; if(vb > lim) vb = lim; - if(va < 0) va = 0; if(va > lim) va = lim; + if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; }; + if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; }; + if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; }; + if(va < 0) { va = 0; }; if(va > lim) { va = lim; }; span->r = (value_type)vr; span->g = (value_type)vg; span->b = (value_type)vb; diff --git a/setupext.py b/setupext.py index f77e24555d40..d19cdee35237 100644 --- a/setupext.py +++ b/setupext.py @@ -3,6 +3,7 @@ from distutils import sysconfig from distutils import version from distutils.core import Extension +import distutils.command.build_ext import glob import multiprocessing import os @@ -228,8 +229,8 @@ def print_line(*args, **kwargs): print_status = print_message = print_raw = print_line -# Remove the -Wstrict-prototypesoption, is it's not valid for C++ -customize_compiler = sysconfig.customize_compiler +# Remove the -Wstrict-prototypes option, is it's not valid for C++ +customize_compiler = distutils.command.build_ext.customize_compiler def my_customize_compiler(compiler): @@ -240,7 +241,7 @@ def my_customize_compiler(compiler): pass return retval -sysconfig.customize_compiler = my_customize_compiler +distutils.command.build_ext.customize_compiler = my_customize_compiler def make_extension(name, files, *args, **kwargs): @@ -897,6 +898,9 @@ def add_flags(self, ext): ext.define_macros.append(('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')) + # Allow NumPy's printf format specifiers in C++. + ext.define_macros.append(('__STDC_FORMAT_MACROS', 1)) + def get_setup_requires(self): return ['numpy>=1.7.1'] diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index 1b6bdc4cb463..f6ed42bcd277 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -459,14 +459,14 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec if (points.dim(0) != 3 || points.dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "points must be a 3x2 array, got %dx%d", + "points must be a 3x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT, points.dim(0), points.dim(1)); return NULL; } if (colors.dim(0) != 3 || colors.dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "colors must be a 3x4 array, got %dx%d", + "colors must be a 3x4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT, colors.dim(0), colors.dim(1)); return NULL; } @@ -500,21 +500,21 @@ PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObje if (points.size() != 0 && (points.dim(1) != 3 || points.dim(2) != 2)) { PyErr_Format(PyExc_ValueError, - "points must be a Nx3x2 array, got %dx%dx%d", + "points must be a Nx3x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, points.dim(0), points.dim(1), points.dim(2)); return NULL; } if (colors.size() != 0 && (colors.dim(1) != 3 || colors.dim(2) != 4)) { PyErr_Format(PyExc_ValueError, - "colors must be a Nx3x4 array, got %dx%dx%d", + "colors must be a Nx3x4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, colors.dim(0), colors.dim(1), colors.dim(2)); return NULL; } if (points.size() != colors.size()) { PyErr_Format(PyExc_ValueError, - "points and colors arrays must be the same length, got %d and %d", + "points and colors arrays must be the same length, got %" NPY_INTP_FMT " and %" NPY_INTP_FMT, points.dim(0), colors.dim(0)); return NULL; } diff --git a/src/_gtkagg.cpp b/src/_gtkagg.cpp index 0b0f8ef4b0de..f8244b799804 100644 --- a/src/_gtkagg.cpp +++ b/src/_gtkagg.cpp @@ -1,10 +1,10 @@ /* -*- mode: c++; c-basic-offset: 4 -*- */ -#include - #include #include +#include + #include "agg_basics.h" #include "agg_pixfmt_rgba.h" #include "agg_renderer_base.h" diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index ed7cb50e4a10..5fdd3170154c 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -273,7 +273,7 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) } else { PyErr_Format( PyExc_ValueError, - "If 3-dimensional, array must be RGBA. Got %d planes.", + "If 3-dimensional, array must be RGBA. Got %" NPY_INTP_FMT " planes.", PyArray_DIM(input_array, 2)); goto error; } diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index 28fbaf282b57..047e8c5c3107 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -8,7 +8,6 @@ PyObject *convert_polygon_vector(std::vector &polygons) { PyObject *pyresult = PyList_New(polygons.size()); - bool fix_endpoints; for (size_t i = 0; i < polygons.size(); ++i) { Polygon poly = polygons[i]; @@ -202,7 +201,7 @@ static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject if (minpos.dim(0) != 2) { PyErr_Format(PyExc_ValueError, - "minpos must be of length 2, got %d", + "minpos must be of length 2, got %" NPY_INTP_FMT, minpos.dim(0)); return NULL; } diff --git a/src/py_converters.cpp b/src/py_converters.cpp index b4fc84032685..b65e1c844061 100644 --- a/src/py_converters.cpp +++ b/src/py_converters.cpp @@ -537,7 +537,7 @@ int convert_points(PyObject *obj, void *pointsp) if (points->dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "Points must be Nx2 array, got %dx%d", + "Points must be Nx2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT, points->dim(0), points->dim(1)); return 0; } @@ -561,7 +561,7 @@ int convert_transforms(PyObject *obj, void *transp) if (trans->dim(1) != 3 || trans->dim(2) != 3) { PyErr_Format(PyExc_ValueError, - "Transforms must be Nx3x3 array, got %dx%dx%d", + "Transforms must be Nx3x3 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, trans->dim(0), trans->dim(1), trans->dim(2)); return 0; } @@ -585,7 +585,7 @@ int convert_bboxes(PyObject *obj, void *bboxp) if (bbox->dim(1) != 2 || bbox->dim(2) != 2) { PyErr_Format(PyExc_ValueError, - "Bbox array must be Nx2x2 array, got %dx%dx%d", + "Bbox array must be Nx2x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, bbox->dim(0), bbox->dim(1), bbox->dim(2)); return 0; } @@ -609,7 +609,7 @@ int convert_colors(PyObject *obj, void *colorsp) if (colors->dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "Colors array must be Nx4 array, got %dx%d", + "Colors array must be Nx4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT, colors->dim(0), colors->dim(1)); return 0; } diff --git a/src/qhull_wrap.c b/src/qhull_wrap.c index 3a24a7514551..06d278ebdd57 100644 --- a/src/qhull_wrap.c +++ b/src/qhull_wrap.c @@ -310,7 +310,7 @@ delaunay(PyObject *self, PyObject *args) /* Return qhull version string for assistance in debugging. */ static PyObject* -version() +version(void) { return PyBytes_FromString(qh_version); }