[Python-checkins] r42752 - python/trunk/Modules/linuxaudiodev.c python/trunk/Modules/ossaudiodev.c
thomas.wouters
python-checkins at python.org
Wed Mar 1 23:45:36 CET 2006
Author: thomas.wouters
Date: Wed Mar 1 23:45:36 2006
New Revision: 42752
Modified:
python/trunk/Modules/linuxaudiodev.c
python/trunk/Modules/ossaudiodev.c
Log:
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.)
Modified: python/trunk/Modules/linuxaudiodev.c
==============================================================================
--- python/trunk/Modules/linuxaudiodev.c (original)
+++ python/trunk/Modules/linuxaudiodev.c Wed Mar 1 23:45:36 2006
@@ -332,7 +332,6 @@
default:
return -EOPNOTSUPP;
}
- *nchannels = 0;
if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, nchannels) < 0)
return -errno;
return 0;
@@ -345,11 +344,11 @@
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 @@
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 @@
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;
}
Modified: python/trunk/Modules/ossaudiodev.c
==============================================================================
--- python/trunk/Modules/ossaudiodev.c (original)
+++ python/trunk/Modules/ossaudiodev.c Wed Mar 1 23:45:36 2006
@@ -569,7 +569,6 @@
default:
return -EOPNOTSUPP;
}
- *nchannels = 0;
if (ioctl(self->fd, SNDCTL_DSP_CHANNELS, nchannels) < 0)
return -errno;
return 0;
@@ -582,11 +581,11 @@
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 @@
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 @@
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;
}
More information about the Python-checkins
mailing list