Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3a2e5ce5
Commit
3a2e5ce5
authored
Jul 20, 2007
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make audioop and its tests use bytes throughout.
parent
b1a9f277
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
64 deletions
+65
-64
Lib/test/test_audioop.py
Lib/test/test_audioop.py
+31
-29
Modules/audioop.c
Modules/audioop.c
+34
-35
No files found.
Lib/test/test_audioop.py
View file @
3a2e5ce5
...
@@ -3,23 +3,23 @@ import audioop
...
@@ -3,23 +3,23 @@ import audioop
from
test.test_support
import
verbose
from
test.test_support
import
verbose
def
gendata1
():
def
gendata1
():
return
'
\
0
\
1
\
2
'
return
b
'
\
0
\
1
\
2
'
def
gendata2
():
def
gendata2
():
if
verbose
:
if
verbose
:
print
(
'getsample'
)
print
(
'getsample'
)
if
audioop
.
getsample
(
'
\
0
\
1
'
,
2
,
0
)
==
1
:
if
audioop
.
getsample
(
b
'
\
0
\
1
'
,
2
,
0
)
==
1
:
return
'
\
0
\
0
\
0
\
1
\
0
\
2
'
return
b
'
\
0
\
0
\
0
\
1
\
0
\
2
'
else
:
else
:
return
'
\
0
\
0
\
1
\
0
\
2
\
0
'
return
b
'
\
0
\
0
\
1
\
0
\
2
\
0
'
def
gendata4
():
def
gendata4
():
if
verbose
:
if
verbose
:
print
(
'getsample'
)
print
(
'getsample'
)
if
audioop
.
getsample
(
'
\
0
\
0
\
0
\
1
'
,
4
,
0
)
==
1
:
if
audioop
.
getsample
(
b
'
\
0
\
0
\
0
\
1
'
,
4
,
0
)
==
1
:
return
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
1
\
0
\
0
\
0
\
2
'
return
b
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
1
\
0
\
0
\
0
\
2
'
else
:
else
:
return
'
\
0
\
0
\
0
\
0
\
1
\
0
\
0
\
0
\
2
\
0
\
0
\
0
'
return
b
'
\
0
\
0
\
0
\
0
\
1
\
0
\
0
\
0
\
2
\
0
\
0
\
0
'
def
testmax
(
data
):
def
testmax
(
data
):
if
verbose
:
if
verbose
:
...
@@ -87,9 +87,9 @@ def testadd(data):
...
@@ -87,9 +87,9 @@ def testadd(data):
print
(
'add'
)
print
(
'add'
)
data2
=
[]
data2
=
[]
for
d
in
data
:
for
d
in
data
:
str
=
''
str
=
bytes
(
len
(
d
))
for
s
in
d
:
for
i
,
b
in
enumerate
(
d
)
:
str
=
str
+
chr
(
ord
(
s
)
*
2
)
str
[
i
]
=
2
*
b
data2
.
append
(
str
)
data2
.
append
(
str
)
if
audioop
.
add
(
data
[
0
],
data
[
0
],
1
)
!=
data2
[
0
]
or
\
if
audioop
.
add
(
data
[
0
],
data
[
0
],
1
)
!=
data2
[
0
]
or
\
audioop
.
add
(
data
[
1
],
data
[
1
],
2
)
!=
data2
[
1
]
or
\
audioop
.
add
(
data
[
1
],
data
[
1
],
2
)
!=
data2
[
1
]
or
\
...
@@ -124,7 +124,7 @@ def testlin2lin(data):
...
@@ -124,7 +124,7 @@ def testlin2lin(data):
def
testadpcm2lin
(
data
):
def
testadpcm2lin
(
data
):
# Very cursory test
# Very cursory test
if
audioop
.
adpcm2lin
(
'
\
0
\
0
'
,
1
,
None
)
!=
(
'
\
0
\
0
\
0
\
0
'
,
(
0
,
0
)):
if
audioop
.
adpcm2lin
(
b'
\
0
\
0
'
,
1
,
None
)
!=
(
b
'
\
0
\
0
\
0
\
0
'
,
(
0
,
0
)):
return
0
return
0
return
1
return
1
...
@@ -132,16 +132,16 @@ def testlin2adpcm(data):
...
@@ -132,16 +132,16 @@ def testlin2adpcm(data):
if
verbose
:
if
verbose
:
print
(
'lin2adpcm'
)
print
(
'lin2adpcm'
)
# Very cursory test
# Very cursory test
if
audioop
.
lin2adpcm
(
'
\
0
\
0
\
0
\
0
'
,
1
,
None
)
!=
(
'
\
0
\
0
'
,
(
0
,
0
)):
if
audioop
.
lin2adpcm
(
b'
\
0
\
0
\
0
\
0
'
,
1
,
None
)
!=
(
b
'
\
0
\
0
'
,
(
0
,
0
)):
return
0
return
0
return
1
return
1
def
testlin2alaw
(
data
):
def
testlin2alaw
(
data
):
if
verbose
:
if
verbose
:
print
(
'lin2alaw'
)
print
(
'lin2alaw'
)
if
audioop
.
lin2alaw
(
data
[
0
],
1
)
!=
'
\
xd5
\
xc5
\
xf5
'
or
\
if
audioop
.
lin2alaw
(
data
[
0
],
1
)
!=
b
'
\
xd5
\
xc5
\
xf5
'
or
\
audioop
.
lin2alaw
(
data
[
1
],
2
)
!=
'
\
xd5
\
xd5
\
xd5
'
or
\
audioop
.
lin2alaw
(
data
[
1
],
2
)
!=
b
'
\
xd5
\
xd5
\
xd5
'
or
\
audioop
.
lin2alaw
(
data
[
2
],
4
)
!=
'
\
xd5
\
xd5
\
xd5
'
:
audioop
.
lin2alaw
(
data
[
2
],
4
)
!=
b
'
\
xd5
\
xd5
\
xd5
'
:
return
0
return
0
return
1
return
1
...
@@ -157,9 +157,9 @@ def testalaw2lin(data):
...
@@ -157,9 +157,9 @@ def testalaw2lin(data):
def
testlin2ulaw
(
data
):
def
testlin2ulaw
(
data
):
if
verbose
:
if
verbose
:
print
(
'lin2ulaw'
)
print
(
'lin2ulaw'
)
if
audioop
.
lin2ulaw
(
data
[
0
],
1
)
!=
'
\
xff
\
xe7
\
xdb
'
or
\
if
audioop
.
lin2ulaw
(
data
[
0
],
1
)
!=
b
'
\
xff
\
xe7
\
xdb
'
or
\
audioop
.
lin2ulaw
(
data
[
1
],
2
)
!=
'
\
xff
\
xff
\
xff
'
or
\
audioop
.
lin2ulaw
(
data
[
1
],
2
)
!=
b
'
\
xff
\
xff
\
xff
'
or
\
audioop
.
lin2ulaw
(
data
[
2
],
4
)
!=
'
\
xff
\
xff
\
xff
'
:
audioop
.
lin2ulaw
(
data
[
2
],
4
)
!=
b
'
\
xff
\
xff
\
xff
'
:
return
0
return
0
return
1
return
1
...
@@ -177,9 +177,9 @@ def testmul(data):
...
@@ -177,9 +177,9 @@ def testmul(data):
print
(
'mul'
)
print
(
'mul'
)
data2
=
[]
data2
=
[]
for
d
in
data
:
for
d
in
data
:
str
=
''
str
=
bytes
(
len
(
d
))
for
s
in
d
:
for
i
,
b
in
enumerate
(
d
)
:
str
=
str
+
chr
(
ord
(
s
)
*
2
)
str
[
i
]
=
2
*
b
data2
.
append
(
str
)
data2
.
append
(
str
)
if
audioop
.
mul
(
data
[
0
],
1
,
2
)
!=
data2
[
0
]
or
\
if
audioop
.
mul
(
data
[
0
],
1
,
2
)
!=
data2
[
0
]
or
\
audioop
.
mul
(
data
[
1
],
2
,
2
)
!=
data2
[
1
]
or
\
audioop
.
mul
(
data
[
1
],
2
,
2
)
!=
data2
[
1
]
or
\
...
@@ -193,23 +193,24 @@ def testratecv(data):
...
@@ -193,23 +193,24 @@ def testratecv(data):
state
=
None
state
=
None
d1
,
state
=
audioop
.
ratecv
(
data
[
0
],
1
,
1
,
8000
,
16000
,
state
)
d1
,
state
=
audioop
.
ratecv
(
data
[
0
],
1
,
1
,
8000
,
16000
,
state
)
d2
,
state
=
audioop
.
ratecv
(
data
[
0
],
1
,
1
,
8000
,
16000
,
state
)
d2
,
state
=
audioop
.
ratecv
(
data
[
0
],
1
,
1
,
8000
,
16000
,
state
)
if
d1
+
d2
!=
'
\
000
\
000
\
001
\
001
\
002
\
001
\
000
\
000
\
001
\
001
\
002
'
:
if
d1
+
d2
!=
b
'
\
000
\
000
\
001
\
001
\
002
\
001
\
000
\
000
\
001
\
001
\
002
'
:
return
0
return
0
return
1
return
1
def
testreverse
(
data
):
def
testreverse
(
data
):
if
verbose
:
if
verbose
:
print
(
'reverse'
)
print
(
'reverse'
)
if
audioop
.
reverse
(
data
[
0
],
1
)
!=
'
\
2
\
1
\
0
'
:
if
audioop
.
reverse
(
data
[
0
],
1
)
!=
b
'
\
2
\
1
\
0
'
:
return
0
return
0
return
1
return
1
def
testtomono
(
data
):
def
testtomono
(
data
):
if
verbose
:
if
verbose
:
print
(
'tomono'
)
print
(
'tomono'
)
data2
=
''
data2
=
b
''
for
d
in
data
[
0
]:
for
d
in
data
[
0
]:
data2
=
data2
+
d
+
d
data2
.
append
(
d
)
data2
.
append
(
d
)
if
audioop
.
tomono
(
data2
,
1
,
0.5
,
0.5
)
!=
data
[
0
]:
if
audioop
.
tomono
(
data2
,
1
,
0.5
,
0.5
)
!=
data
[
0
]:
return
0
return
0
return
1
return
1
...
@@ -217,9 +218,10 @@ def testtomono(data):
...
@@ -217,9 +218,10 @@ def testtomono(data):
def
testtostereo
(
data
):
def
testtostereo
(
data
):
if
verbose
:
if
verbose
:
print
(
'tostereo'
)
print
(
'tostereo'
)
data2
=
''
data2
=
b
''
for
d
in
data
[
0
]:
for
d
in
data
[
0
]:
data2
=
data2
+
d
+
d
data2
.
append
(
d
)
data2
.
append
(
d
)
if
audioop
.
tostereo
(
data
[
0
],
1
,
1
,
1
)
!=
data2
:
if
audioop
.
tostereo
(
data
[
0
],
1
,
1
,
1
)
!=
data2
:
return
0
return
0
return
1
return
1
...
@@ -263,8 +265,8 @@ def testone(name, data):
...
@@ -263,8 +265,8 @@ def testone(name, data):
return
return
try
:
try
:
rv
=
func
(
data
)
rv
=
func
(
data
)
except
'xx'
:
except
Exception
as
e
:
print
(
'Test FAILED for audioop.'
+
name
+
'() (with
an exception)'
)
print
(
'Test FAILED for audioop.'
+
name
+
'() (with
%s)'
%
repr
(
e
)
)
return
return
if
not
rv
:
if
not
rv
:
print
(
'Test FAILED for audioop.'
+
name
+
'()'
)
print
(
'Test FAILED for audioop.'
+
name
+
'()'
)
...
...
Modules/audioop.c
View file @
3a2e5ce5
...
@@ -759,10 +759,10 @@ audioop_mul(PyObject *self, PyObject *args)
...
@@ -759,10 +759,10 @@ audioop_mul(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
...
@@ -801,10 +801,10 @@ audioop_tomono(PyObject *self, PyObject *args)
...
@@ -801,10 +801,10 @@ audioop_tomono(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
/
2
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
/
2
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
*
2
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
*
2
)
{
...
@@ -846,10 +846,10 @@ audioop_tostereo(PyObject *self, PyObject *args)
...
@@ -846,10 +846,10 @@ audioop_tostereo(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
*
2
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
*
2
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
...
@@ -903,10 +903,10 @@ audioop_add(PyObject *self, PyObject *args)
...
@@ -903,10 +903,10 @@ audioop_add(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len1
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len1
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len1
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len1
;
i
+=
size
)
{
if
(
size
==
1
)
val1
=
(
int
)
*
CHARP
(
cp1
,
i
);
if
(
size
==
1
)
val1
=
(
int
)
*
CHARP
(
cp1
,
i
);
...
@@ -949,10 +949,10 @@ audioop_bias(PyObject *self, PyObject *args)
...
@@ -949,10 +949,10 @@ audioop_bias(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
...
@@ -985,10 +985,10 @@ audioop_reverse(PyObject *self, PyObject *args)
...
@@ -985,10 +985,10 @@ audioop_reverse(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
unsigned
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
unsigned
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
...
@@ -1023,10 +1023,10 @@ audioop_lin2lin(PyObject *self, PyObject *args)
...
@@ -1023,10 +1023,10 @@ audioop_lin2lin(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
(
len
/
size
)
*
size2
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
(
len
/
size
)
*
size2
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
unsigned
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
unsigned
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
,
j
=
0
;
i
<
len
;
i
+=
size
,
j
+=
size2
)
{
for
(
i
=
0
,
j
=
0
;
i
<
len
;
i
+=
size
,
j
+=
size2
)
{
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
...
@@ -1157,7 +1157,7 @@ audioop_ratecv(PyObject *self, PyObject *args)
...
@@ -1157,7 +1157,7 @@ audioop_ratecv(PyObject *self, PyObject *args)
nbytes
/
bytes_per_frame
!=
ceiling
)
nbytes
/
bytes_per_frame
!=
ceiling
)
str
=
NULL
;
str
=
NULL
;
else
else
str
=
Py
String
_FromStringAndSize
(
NULL
,
nbytes
);
str
=
Py
Bytes
_FromStringAndSize
(
NULL
,
nbytes
);
if
(
str
==
NULL
)
{
if
(
str
==
NULL
)
{
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
...
@@ -1165,7 +1165,7 @@ audioop_ratecv(PyObject *self, PyObject *args)
...
@@ -1165,7 +1165,7 @@ audioop_ratecv(PyObject *self, PyObject *args)
goto
exit
;
goto
exit
;
}
}
}
}
ncp
=
Py
String
_AsString
(
str
);
ncp
=
Py
Bytes
_AsString
(
str
);
for
(;;)
{
for
(;;)
{
while
(
d
<
0
)
{
while
(
d
<
0
)
{
...
@@ -1182,13 +1182,12 @@ audioop_ratecv(PyObject *self, PyObject *args)
...
@@ -1182,13 +1182,12 @@ audioop_ratecv(PyObject *self, PyObject *args)
goto
exit
;
goto
exit
;
/* We have checked before that the length
/* We have checked before that the length
* of the string fits into int. */
* of the string fits into int. */
len
=
(
int
)(
ncp
-
PyString_AsString
(
str
));
len
=
(
int
)(
ncp
-
PyBytes_AsString
(
str
));
if
(
len
==
0
)
{
rv
=
PyBytes_FromStringAndSize
/*don't want to resize to zero length*/
(
PyBytes_AsString
(
str
),
len
);
rv
=
PyString_FromStringAndSize
(
""
,
0
);
Py_DECREF
(
str
);
Py_DECREF
(
str
);
str
=
rv
;
str
=
rv
;
}
else
if
(
_PyString_Resize
(
&
str
,
len
)
<
0
)
if
(
str
==
NULL
)
goto
exit
;
goto
exit
;
rv
=
Py_BuildValue
(
"(O(iO))"
,
str
,
d
,
samps
);
rv
=
Py_BuildValue
(
"(O(iO))"
,
str
,
d
,
samps
);
Py_DECREF
(
samps
);
Py_DECREF
(
samps
);
...
@@ -1255,10 +1254,10 @@ audioop_lin2ulaw(PyObject *self, PyObject *args)
...
@@ -1255,10 +1254,10 @@ audioop_lin2ulaw(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
/
size
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
/
size
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
unsigned
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
unsigned
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
...
@@ -1289,10 +1288,10 @@ audioop_ulaw2lin(PyObject *self, PyObject *args)
...
@@ -1289,10 +1288,10 @@ audioop_ulaw2lin(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
*
size
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
*
size
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
*
size
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
*
size
;
i
+=
size
)
{
cval
=
*
cp
++
;
cval
=
*
cp
++
;
...
@@ -1323,10 +1322,10 @@ audioop_lin2alaw(PyObject *self, PyObject *args)
...
@@ -1323,10 +1322,10 @@ audioop_lin2alaw(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
/
size
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
/
size
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
unsigned
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
unsigned
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
size
)
{
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
if
(
size
==
1
)
val
=
((
int
)
*
CHARP
(
cp
,
i
))
<<
8
;
...
@@ -1357,10 +1356,10 @@ audioop_alaw2lin(PyObject *self, PyObject *args)
...
@@ -1357,10 +1356,10 @@ audioop_alaw2lin(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
rv
=
Py
String
_FromStringAndSize
(
NULL
,
len
*
size
);
rv
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
*
size
);
if
(
rv
==
0
)
if
(
rv
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
rv
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
rv
);
for
(
i
=
0
;
i
<
len
*
size
;
i
+=
size
)
{
for
(
i
=
0
;
i
<
len
*
size
;
i
+=
size
)
{
cval
=
*
cp
++
;
cval
=
*
cp
++
;
...
@@ -1393,10 +1392,10 @@ audioop_lin2adpcm(PyObject *self, PyObject *args)
...
@@ -1393,10 +1392,10 @@ audioop_lin2adpcm(PyObject *self, PyObject *args)
return
0
;
return
0
;
}
}
str
=
Py
String
_FromStringAndSize
(
NULL
,
len
/
(
size
*
2
));
str
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
/
(
size
*
2
));
if
(
str
==
0
)
if
(
str
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
str
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
str
);
/* Decode state, should have (value, step) */
/* Decode state, should have (value, step) */
if
(
state
==
Py_None
)
{
if
(
state
==
Py_None
)
{
...
@@ -1509,10 +1508,10 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
...
@@ -1509,10 +1508,10 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
}
else
if
(
!
PyArg_ParseTuple
(
state
,
"ii"
,
&
valpred
,
&
index
)
)
}
else
if
(
!
PyArg_ParseTuple
(
state
,
"ii"
,
&
valpred
,
&
index
)
)
return
0
;
return
0
;
str
=
Py
String
_FromStringAndSize
(
NULL
,
len
*
size
*
2
);
str
=
Py
Bytes
_FromStringAndSize
(
NULL
,
len
*
size
*
2
);
if
(
str
==
0
)
if
(
str
==
0
)
return
0
;
return
0
;
ncp
=
(
signed
char
*
)
Py
String
_AsString
(
str
);
ncp
=
(
signed
char
*
)
Py
Bytes
_AsString
(
str
);
step
=
stepsizeTable
[
index
];
step
=
stepsizeTable
[
index
];
bufferstep
=
0
;
bufferstep
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment