History

python/ext/{aubioproxy,py-cvec}.c: use npy_intp, not long

Paul Brossier committed 10 years ago

Commit bb4af3a1 parent 770f7b42 files · +5 −5Browse files

Showing the changes to python/ext (2 of 2 files). Show all

Unified · Split

2 files
  1. python/ext/aubioproxy.c +3 −3
  2. python/ext/py-cvec.c +2 −2
python/ext/aubioproxy.c+3−3
@@ -46,7 +46,7 @@ PyAubio_IsValidVector (PyObject * input) { · 45 unmodified lines
46 return 0;46 return 0;
47 }47 }
48 48
49 long length = PyArray_SIZE ((PyArrayObject *)input);49 npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
50 if (length <= 0) {50 if (length <= 0) {
51 PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0");51 PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0");
52 return 0;52 return 0;
@@ -120,12 +120,12 @@ PyAubio_ArrayToCFmat (PyObject *input, fmat_t *mat) { · 67 unmodified lines
120 }120 }
121 121
122 // no need to really allocate fvec, just its struct member122 // no need to really allocate fvec, just its struct member
123 long length = PyArray_DIM ((PyArrayObject *)input, 1);123 npy_intp length = PyArray_DIM ((PyArrayObject *)input, 1);
124 if (length <= 0) {124 if (length <= 0) {
125 PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0");125 PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0");
126 return 0;126 return 0;
127 }127 }
128 long height = PyArray_DIM ((PyArrayObject *)input, 0);128 npy_intp height = PyArray_DIM ((PyArrayObject *)input, 0);
129 if (height <= 0) {129 if (height <= 0) {
130 PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0");130 PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0");
131 return 0;131 return 0;
python/ext/py-cvec.c+2−2
@@ -143,7 +143,7 @@ Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure) · 142 unmodified lines
143 if (!PyAubio_IsValidVector(input)) {143 if (!PyAubio_IsValidVector(input)) {
144 return 1;144 return 1;
145 }145 }
146 long length = PyArray_SIZE ((PyArrayObject *)input);146 npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
147 if (length != vec->length) {147 if (length != vec->length) {
148 PyErr_Format (PyExc_ValueError,148 PyErr_Format (PyExc_ValueError,
149 "input array has length %ld, but cvec has length %d", length,149 "input array has length %ld, but cvec has length %d", length,
@@ -163,7 +163,7 @@ Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) · 13 unmodified lines
163 if (!PyAubio_IsValidVector(input)) {163 if (!PyAubio_IsValidVector(input)) {
164 return 1;164 return 1;
165 }165 }
166 long length = PyArray_SIZE ((PyArrayObject *)input);166 npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
167 if (length != vec->length) {167 if (length != vec->length) {
168 PyErr_Format (PyExc_ValueError,168 PyErr_Format (PyExc_ValueError,
169 "input array has length %ld, but cvec has length %d", length,169 "input array has length %ld, but cvec has length %d", length,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t