Skip to content

Fix some minor warnings in extensions #7514

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 7 commits into from
Nov 27, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix warnings about incorrect format specifiers.
  • Loading branch information
QuLogic committed Nov 26, 2016
commit ad050914b68cd32a8f40255f9bac9307a21553cd
10 changes: 5 additions & 5 deletions src/_backend_agg_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_image_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/py_converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down