8000 Fix some compiler warnings by mdboom · Pull Request #5285 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix some compiler warnings #5285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,8 @@ void VoronoiDiagramGenerator::out_vertex(struct Site *v)

void VoronoiDiagramGenerator::out_site(struct Site *s)
{
if(!triangulate & plot & !debug)
if(!triangulate && plot && !debug)
circle (s->coord.x, s->coord.y, cradius);

}


Expand Down Expand Up @@ -932,7 +931,10 @@ bool VoronoiDiagramGenerator::voronoi(int triangulate)

if(!retval)
return false;


newintstar.x = 0;
newintstar.y = 0;

newsite = nextone();
while(1)
{
Expand Down
10 changes: 1 addition & 9 deletions lib/matplotlib/tri/_tri_wrapper.cpp
8000
Original file line number Diff line number Diff line change
Expand Up @@ -478,20 +478,12 @@ static PyTypeObject* PyTrapezoidMapTriFinder_init_type(PyObject* m, PyTypeObject

extern "C" {

struct module_state
{
/* The Sun compiler can't handle empty structs */
#if defined(__SUNPRO_C) || defined(_MSC_VER)
int _dummy;
#endif
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment referring to the module_state struct itself or the allocation that occurs at some other point? Because I don't see why this can't be remove entirely and just a straightforward 0 passed for the size.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

"_tri",
NULL,
sizeof(struct module_state),
0,
NULL,
NULL,
NULL,
Expand Down
7 changes: 1 addition & 6 deletions src/_backend_agg_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,17 +725,12 @@ static PyTypeObject *PyRendererAgg_init_type(PyObject *m, PyTypeObject *type)

extern "C" {

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_backend_agg",
NULL,
sizeof(struct module_state),
0,
NULL,
NULL,
NULL,
Expand Down
10 changes: 1 addition & 9 deletions src/_contour_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,12 @@ static PyTypeObject* PyQuadContourGenerator_init_type(PyObject* m, PyTypeObject*

extern "C" {

struct module_state
{
/* The Sun compiler can't handle empty structs */
#if defined(__SUNPRO_C) || defined(_MSC_VER)
int _dummy;
#endif
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_contour",
NULL,
sizeof(struct module_state),
0,
NULL,
NULL,
NULL,
Expand Down
7 changes: 1 addition & 6 deletions src/_gtkagg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,12 @@ static PyMethodDef module_methods[] = {

extern "C" {

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_gtkagg",
NULL,
sizeof(struct module_state),
0,
module_methods,
NULL,
NULL,
Expand Down
7 changes: 1 addition & 6 deletions src/_image_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,12 @@ static PyMethodDef module_functions[] = {

extern "C" {

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_image",
NULL,
sizeof(struct module_state),
0,
module_functions,
NULL,
NULL,
Expand Down
15 changes: 5 additions & 10 deletions src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static PyObject *Py_points_in_path(PyObject *self, PyObject *args, PyObject *kwd
return NULL;
}

npy_intp dims[] = { points.size() };
npy_intp dims[] = { (npy_intp)points.size() };
numpy::array_view<bool, 1> results(dims);

CALL_CPP("points_in_path", (points_in_path(points, r, path, trans, results)));
Expand Down Expand Up @@ -138,7 +138,7 @@ static PyObject *Py_points_on_path(PyObject *self, PyObject *args, PyObject *kwd
return NULL;
}

npy_intp dims[] = { points.size() };
npy_intp dims[] = { (npy_intp)points.size() };
numpy::array_view<bool, 1> results(dims);

CALL_CPP("points_on_path", (points_on_path(points, r, path, trans, results)));
Expand Down Expand Up @@ -437,15 +437,15 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *k

try {
numpy::array_view<double, 2> vertices(vertices_obj);
npy_intp dims[] = { vertices.size(), 2 };
npy_intp dims[] = { (npy_intp)vertices.size(), 2 };
numpy::array_view<double, 2> result(dims);
CALL_CPP("affine_transform", (affine_transform_2d(vertices, trans, result)));
return result.pyobj();
} catch (py::exception) {
PyErr_Clear();
try {
numpy::array_view<double, 1> vertices(vertices_obj);
npy_intp dims[] = { vertices.size() };
npy_intp dims[] = { (npy_intp)vertices.size() };
numpy::array_view<double, 1> result(dims);
CALL_CPP("affine_transform", (affine_transform_1d(vertices, trans, result)));
return result.pyobj();
Expand Down Expand Up @@ -730,17 +730,12 @@ extern "C" {
{NULL}
};

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_path",
NULL,
sizeof(struct module_state),
0,
module_functions,
NULL,
NULL,
Expand Down
7 changes: 1 addition & 6 deletions src/_png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,17 +520,12 @@ static PyMethodDef module_methods[] = {

extern "C" {

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_png",
NULL,
sizeof(struct module_state),
0,
module_methods,
NULL,
NULL,
Expand Down
19 changes: 11 additions & 8 deletions src/ft2font_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1640,15 +1640,18 @@ static PyTypeObject *PyFT2Font_init_type(PyObject *m, PyTypeObject *type)

extern "C" {

struct module_state
{
int _dummy;
};

#if PY3K
static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "ft2font", NULL,
sizeof(struct module_state), NULL, NULL,
NULL, NULL, NULL };
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"ft2font",
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL
};

#define INITERROR return NULL

Expand Down
0