summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-03-01 22:45:36 (GMT)
committerThomas Wouters <thomas@python.org>2006-03-01 22:45:36 (GMT)
commit3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0 (patch)
tree93be57d8395938d5710f610d4cac5a28c9bfc9cd
parent7464b43e41acb08f02f3b7ec2db12747737952d1 (diff)
downloadcpython-3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0.zip
cpython-3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0.tar.gz
cpython-3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0.tar.bz2
Rework channelnumber/samplesize detetion code's output variables a bit to
convince gcc (4.0.x) the variables are never used uninitialized (and raising a proper exception if they ever are.)
-rw-r--r--Modules/linuxaudiodev.c13
-rw-r--r--Modules/ossaudiodev.c13
2 files changed, 12 insertions, 14 deletions
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c
index f6d5b7d..769451a 100644
--- a/Modules/linuxaudiodev.c
+++ b/Modules/linuxaudiodev.c
@@ -332,7 +332,6 @@ _ssize(lad_t *self, int *nchannels, int *ssize)
default:
return -EOPNOTSUPP;
}
- *nchannels = 0;
if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, nchannels) < 0)
return -errno;
return 0;
@@ -345,11 +344,11 @@ static PyObject *
lad_bufsize(lad_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":bufsize")) return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
PyErr_SetFromErrno(LinuxAudioError);
return NULL;
}
@@ -366,12 +365,12 @@ static PyObject *
lad_obufcount(lad_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":obufcount"))
return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
PyErr_SetFromErrno(LinuxAudioError);
return NULL;
}
@@ -389,12 +388,12 @@ static PyObject *
lad_obuffree(lad_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":obuffree"))
return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
PyErr_SetFromErrno(LinuxAudioError);
return NULL;
}
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 4c22b07..ce8a0d0 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -569,7 +569,6 @@ _ssize(oss_audio_t *self, int *nchannels, int *ssize)
default:
return -EOPNOTSUPP;
}
- *nchannels = 0;
if (ioctl(self->fd, SNDCTL_DSP_CHANNELS, nchannels) < 0)
return -errno;
return 0;
@@ -582,11 +581,11 @@ static PyObject *
oss_bufsize(oss_audio_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":bufsize")) return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
@@ -603,12 +602,12 @@ static PyObject *
oss_obufcount(oss_audio_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":obufcount"))
return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
@@ -626,12 +625,12 @@ static PyObject *
oss_obuffree(oss_audio_t *self, PyObject *args)
{
audio_buf_info ai;
- int nchannels, ssize;
+ int nchannels=0, ssize=0;
if (!PyArg_ParseTuple(args, ":obuffree"))
return NULL;
- if (_ssize(self, &nchannels, &ssize) < 0) {
+ if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}