shithub: aubio

Download patch

ref: a138975bd09a621619506c28f359036035c323d6
parent: 911c22f5b2085e7e09cfc8da719e4be333898429
author: Paul Brossier <[email protected]>
date: Wed May 11 11:10:02 EDT 2016

ext/: build with -Wdeclaration-after-statement -Werror

--- a/python/ext/py-cvec.c
+++ b/python/ext/py-cvec.c
@@ -140,10 +140,11 @@
 static int
 Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure)
 {
+  npy_intp length;
   if (!PyAubio_IsValidVector(input)) {
     return 1;
   }
-  npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
+  length = PyArray_SIZE ((PyArrayObject *)input);
   if (length != vec->length) {
     PyErr_Format (PyExc_ValueError,
         "input array has length %ld, but cvec has length %d", length,
@@ -160,10 +161,11 @@
 static int
 Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure)
 {
+  npy_intp length;
   if (!PyAubio_IsValidVector(input)) {
     return 1;
   }
-  npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
+  length = PyArray_SIZE ((PyArrayObject *)input);
   if (length != vec->length) {
     PyErr_Format (PyExc_ValueError,
         "input array has length %ld, but cvec has length %d", length,
--- a/python/ext/py-fft.c
+++ b/python/ext/py-fft.c
@@ -80,6 +80,7 @@
 Py_fft_do(Py_fft * self, PyObject * args)
 {
   PyObject *input;
+  cvec_t c_out;
 
   if (!PyArg_ParseTuple (args, "O", &input)) {
     return NULL;
@@ -96,7 +97,6 @@
     return NULL;
   }
 
-  cvec_t c_out;
   Py_INCREF(self->doout);
   if (!PyAubio_PyCvecToCCvec(self->doout, &c_out)) {
     return NULL;
@@ -116,6 +116,7 @@
 Py_fft_rdo(Py_fft * self, PyObject * args)
 {
   PyObject *input;
+  fvec_t out;
 
   if (!PyArg_ParseTuple (args, "O", &input)) {
     return NULL;
@@ -132,7 +133,6 @@
     return NULL;
   }
 
-  fvec_t out;
   Py_INCREF(self->rdoout);
   if (!PyAubio_ArrayToCFvec(self->rdoout, &out) ) {
     return NULL;
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -173,6 +173,7 @@
 static PyObject *
 Py_source_do(Py_source * self, PyObject * args)
 {
+  PyObject *outputs;
   uint_t read;
   read = 0;
 
@@ -183,7 +184,7 @@
   /* compute _do function */
   aubio_source_do (self->o, &(self->c_read_to), &read);
 
-  PyObject *outputs = PyTuple_New(2);
+  outputs = PyTuple_New(2);
   PyTuple_SetItem( outputs, 0, self->read_to );
   PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read));
   return outputs;
@@ -193,6 +194,7 @@
 static PyObject *
 Py_source_do_multi(Py_source * self, PyObject * args)
 {
+  PyObject *outputs;
   uint_t read;
   read = 0;
 
@@ -203,7 +205,7 @@
   /* compute _do function */
   aubio_source_do_multi (self->o, &(self->c_mread_to), &read);
 
-  PyObject *outputs = PyTuple_New(2);
+  outputs = PyTuple_New(2);
   PyTuple_SetItem( outputs, 0, self->mread_to);
   PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read));
   return outputs;
--- a/python/ext/ufuncs.c
+++ b/python/ext/ufuncs.c
@@ -84,6 +84,7 @@
 void add_ufuncs ( PyObject *m )
 {
   int err = 0;
+  PyObject *dict, *f, *g, *h;
 
   err = _import_umath ();
   if (err != 0) {
@@ -91,7 +92,6 @@
         "Unable to import Numpy umath from aubio module (error %d)\n", err);
   }
 
-  PyObject *f, *dict;
   dict = PyModule_GetDict(m);
   f = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_unwrap2pi_data, Py_aubio_unary_types,
           Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
@@ -99,7 +99,6 @@
   PyDict_SetItemString(dict, "unwrap2pi", f);
   Py_DECREF(f);
 
-  PyObject *g;
   g = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_freqtomidi_data, Py_aubio_unary_types,
           Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
           PyUFunc_None, "freqtomidi", Py_freqtomidi_doc, 0);
@@ -106,7 +105,6 @@
   PyDict_SetItemString(dict, "freqtomidi", g);
   Py_DECREF(g);
 
-  PyObject *h;
   h = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_miditofreq_data, Py_aubio_unary_types,
           Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
           PyUFunc_None, "miditofreq", Py_miditofreq_doc, 0);