Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -21,6 +21,7 @@ PyAubio_CFvecToArray (fvec_t * self) · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | int |
| 23 | 23 | PyAubio_IsValidVector (PyObject * input) { |
| 24 | + npy_intp length; | |
| 24 | 25 | if (input == NULL) { |
| 25 | 26 | PyErr_SetString (PyExc_ValueError, "input array is not a python object"); |
| 26 | 27 | return 0; |
| @@ -46,7 +47,7 @@ PyAubio_IsValidVector (PyObject * input) { · 19 unmodified lines | ||
| 46 | 47 | return 0; |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | − npy_intp length = PyArray_SIZE ((PyArrayObject *)input); | |
| 50 | + length = PyArray_SIZE ((PyArrayObject *)input); | |
| 50 | 51 | if (length <= 0) { |
| 51 | 52 | PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0"); |
| 52 | 53 | return 0; |
| @@ -93,7 +94,8 @@ PyAubio_CFmatToArray (fmat_t * input) · 40 unmodified lines | ||
| 93 | 94 | |
| 94 | 95 | int |
| 95 | 96 | PyAubio_ArrayToCFmat (PyObject *input, fmat_t *mat) { |
| 96 | − uint_t i; | |
| 97 | + uint_t i, new_height; | |
| 98 | + npy_intp length, height; | |
| 97 | 99 | if (input == NULL) { |
| 98 | 100 | PyErr_SetString (PyExc_ValueError, "input array is not a python object"); |
| 99 | 101 | return 0; |
| @@ -120,12 +122,12 @@ PyAubio_ArrayToCFmat (PyObject *input, fmat_t *mat) { · 20 unmodified lines | ||
| 120 | 122 | } |
| 121 | 123 | |
| 122 | 124 | // no need to really allocate fvec, just its struct member |
| 123 | − npy_intp length = PyArray_DIM ((PyArrayObject *)input, 1); | |
| 125 | + length = PyArray_DIM ((PyArrayObject *)input, 1); | |
| 124 | 126 | if (length <= 0) { |
| 125 | 127 | PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0"); |
| 126 | 128 | return 0; |
| 127 | 129 | } |
| 128 | − npy_intp height = PyArray_DIM ((PyArrayObject *)input, 0); | |
| 130 | + height = PyArray_DIM ((PyArrayObject *)input, 0); | |
| 129 | 131 | if (height <= 0) { |
| 130 | 132 | PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0"); |
| 131 | 133 | return 0; |
| @@ -139,7 +141,7 @@ PyAubio_ArrayToCFmat (PyObject *input, fmat_t *mat) { · 7 unmodified lines | ||
| 139 | 141 | return 0; |
| 140 | 142 | } |
| 141 | 143 | |
| 142 | − uint_t new_height = (uint_t)PyArray_DIM ((PyArrayObject *)input, 0); | |
| 144 | + new_height = (uint_t)PyArray_DIM ((PyArrayObject *)input, 0); | |
| 143 | 145 | if (mat->height != new_height) { |
| 144 | 146 | if (mat->data) { |
| 145 | 147 | free(mat->data); |