[xiph-commits] r18767 - trunk/ao-python/src
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Jan 15 12:22:51 PST 2013
Author: xiphmont
Date: 2013-01-15 12:22:51 -0800 (Tue, 15 Jan 2013)
New Revision: 18767
Modified:
trunk/ao-python/src/aomodule.c
trunk/ao-python/src/aomodule.h
Log:
Apply patch from Trac #1925 to fix ao-python build warning and error
Modified: trunk/ao-python/src/aomodule.c
===================================================================
--- trunk/ao-python/src/aomodule.c 2013-01-15 20:09:04 UTC (rev 18766)
+++ trunk/ao-python/src/aomodule.c 2013-01-15 20:22:51 UTC (rev 18767)
@@ -4,7 +4,7 @@
static ao_option *
dict_to_options(PyObject *dict)
{
- int pos = 0;
+ Py_ssize_t pos = 0;
PyObject *key, *val;
ao_option *head = NULL;
int ret;
@@ -144,6 +144,7 @@
retobj = (ao_Object *) PyObject_NEW(ao_Object, &ao_Type);
retobj->dev = dev;
+ retobj->driver_id = driver_id;
return (PyObject *) retobj;
}
@@ -160,11 +161,16 @@
int driver_id;
char *str = NULL;
- if (!PyArg_ParseTuple(args, "s", &str))
- return NULL;
+ if (self != NULL) {
+ ao_Object *ao_self = (ao_Object *) self;
+ driver_id = ao_self->driver_id;
+ } else {
+ if (!PyArg_ParseTuple(args, "s", &str))
+ return NULL;
- driver_id = ao_driver_id(str);
-
+ driver_id = ao_driver_id(str);
+ }
+
if (driver_id == -1) {
PyErr_SetString(Py_aoError, "No such driver");
return NULL;
@@ -185,7 +191,7 @@
/* It's a method */
ao_Object *ao_self = (ao_Object *) self;
- info = ao_driver_info(ao_self->dev->driver_id);
+ info = ao_driver_info(ao_self->driver_id);
} else {
Modified: trunk/ao-python/src/aomodule.h
===================================================================
--- trunk/ao-python/src/aomodule.h 2013-01-15 20:09:04 UTC (rev 18766)
+++ trunk/ao-python/src/aomodule.h 2013-01-15 20:22:51 UTC (rev 18767)
@@ -9,6 +9,7 @@
typedef struct {
PyObject_HEAD
ao_device *dev;
+ int driver_id;
} ao_Object;
static PyObject *Py_aoError;
More information about the commits
mailing list