mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Fix various minor errors in passing arguments to
PyArg_ParseTuple.
This commit is contained in:
parent
aac1316222
commit
a811c38d8e
4 changed files with 27 additions and 16 deletions
|
@ -472,8 +472,12 @@ audioop_findfit(PyObject *self, PyObject *args)
|
|||
double aj_m1, aj_lm1;
|
||||
double sum_ri_2, sum_aij_2, sum_aij_ri, result, best_result, factor;
|
||||
|
||||
/* Passing a short** for an 's' argument is correct only
|
||||
if the string contents is aligned for interpretation
|
||||
as short[]. Due to the definition of PyStringObject,
|
||||
this is currently (Python 2.6) the case. */
|
||||
if ( !PyArg_ParseTuple(args, "s#s#:findfit",
|
||||
&cp1, &len1, &cp2, &len2) )
|
||||
(char**)&cp1, &len1, (char**)&cp2, &len2) )
|
||||
return 0;
|
||||
if ( len1 & 1 || len2 & 1 ) {
|
||||
PyErr_SetString(AudioopError, "Strings should be even-sized");
|
||||
|
@ -530,7 +534,7 @@ audioop_findfactor(PyObject *self, PyObject *args)
|
|||
double sum_ri_2, sum_aij_ri, result;
|
||||
|
||||
if ( !PyArg_ParseTuple(args, "s#s#:findfactor",
|
||||
&cp1, &len1, &cp2, &len2) )
|
||||
(char**)&cp1, &len1, (char**)&cp2, &len2) )
|
||||
return 0;
|
||||
if ( len1 & 1 || len2 & 1 ) {
|
||||
PyErr_SetString(AudioopError, "Strings should be even-sized");
|
||||
|
@ -562,7 +566,8 @@ audioop_findmax(PyObject *self, PyObject *args)
|
|||
double aj_m1, aj_lm1;
|
||||
double result, best_result;
|
||||
|
||||
if ( !PyArg_ParseTuple(args, "s#i:findmax", &cp1, &len1, &len2) )
|
||||
if ( !PyArg_ParseTuple(args, "s#i:findmax",
|
||||
(char**)&cp1, &len1, &len2) )
|
||||
return 0;
|
||||
if ( len1 & 1 ) {
|
||||
PyErr_SetString(AudioopError, "Strings should be even-sized");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue