summaryrefslogtreecommitdiffstats
path: root/Modules/audioop.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-20 06:34:06 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-20 06:34:06 (GMT)
commit49c65d022f6e9a35ac1eaf5f602c260582cccf27 (patch)
treeb3444970f4caf0528f0f196d714e41b62cdf0b17 /Modules/audioop.c
parent3dd8be414eb00700965428902e12c073ab97728f (diff)
downloadcpython-49c65d022f6e9a35ac1eaf5f602c260582cccf27.zip
cpython-49c65d022f6e9a35ac1eaf5f602c260582cccf27.tar.gz
cpython-49c65d022f6e9a35ac1eaf5f602c260582cccf27.tar.bz2
Make some functions static, reformat function decl to be consistent and check for error from PyModule_GetDict()
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r--Modules/audioop.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 1b3af15..ed70cdf 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -50,7 +50,8 @@ static PyInt16 seg_aend[8] = {0x1F, 0x3F, 0x7F, 0xFF,
static PyInt16 seg_uend[8] = {0x3F, 0x7F, 0xFF, 0x1FF,
0x3FF, 0x7FF, 0xFFF, 0x1FFF};
-static PyInt16 search(PyInt16 val, PyInt16 *table, int size)
+static PyInt16
+search(PyInt16 val, PyInt16 *table, int size)
{
int i;
@@ -63,7 +64,7 @@ static PyInt16 search(PyInt16 val, PyInt16 *table, int size)
#define st_ulaw2linear16(uc) (_st_ulaw2linear16[uc])
#define st_alaw2linear16(uc) (_st_alaw2linear16[uc])
-PyInt16 _st_ulaw2linear16[256] = {
+static PyInt16 _st_ulaw2linear16[256] = {
-32124, -31100, -30076, -29052, -28028, -27004, -25980,
-24956, -23932, -22908, -21884, -20860, -19836, -18812,
-17788, -16764, -15996, -15484, -14972, -14460, -13948,
@@ -135,8 +136,8 @@ PyInt16 _st_ulaw2linear16[256] = {
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
-unsigned char st_14linear2ulaw(
- PyInt16 pcm_val) /* 2's complement (14-bit range) */
+static unsigned char
+st_14linear2ulaw(PyInt16 pcm_val) /* 2's complement (14-bit range) */
{
PyInt16 mask;
PyInt16 seg;
@@ -172,7 +173,7 @@ unsigned char st_14linear2ulaw(
}
-PyInt16 _st_alaw2linear16[256] = {
+static PyInt16 _st_alaw2linear16[256] = {
-5504, -5248, -6016, -5760, -4480, -4224, -4992,
-4736, -7552, -7296, -8064, -7808, -6528, -6272,
-7040, -6784, -2752, -2624, -3008, -2880, -2240,
@@ -232,8 +233,8 @@ PyInt16 _st_alaw2linear16[256] = {
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
-unsigned char st_linear2alaw(
- PyInt16 pcm_val) /* 2's complement (13-bit range) */
+static unsigned char
+st_linear2alaw(PyInt16 pcm_val) /* 2's complement (13-bit range) */
{
PyInt16 mask;
short seg;
@@ -1597,6 +1598,8 @@ initaudioop(void)
if (m == NULL)
return;
d = PyModule_GetDict(m);
+ if (d == NULL)
+ return;
AudioopError = PyErr_NewException("audioop.error", NULL, NULL);
if (AudioopError != NULL)
PyDict_SetItemString(d,"error",AudioopError);