summaryrefslogtreecommitdiffstats
path: root/Modules/cdmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-08-03 19:06:59 (GMT)
committerGuido van Rossum <guido@python.org>1992-08-03 19:06:59 (GMT)
commitf16eda5ff86f0b38cc3b0012b6d23b779b9ecfcc (patch)
tree71f58a6b74987cf88ec8bf886363ac26fc16c2b1 /Modules/cdmodule.c
parente10a19ea6d710ee495160682e60e37240562e92c (diff)
downloadcpython-f16eda5ff86f0b38cc3b0012b6d23b779b9ecfcc.zip
cpython-f16eda5ff86f0b38cc3b0012b6d23b779b9ecfcc.tar.gz
cpython-f16eda5ff86f0b38cc3b0012b6d23b779b9ecfcc.tar.bz2
cdmodule.c: 2 minor changes by Sjoerd.
Diffstat (limited to 'Modules/cdmodule.c')
-rw-r--r--Modules/cdmodule.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c
index 4f11867..332b54b 100644
--- a/Modules/cdmodule.c
+++ b/Modules/cdmodule.c
@@ -334,7 +334,7 @@ CD_readda(self, args)
n = CDreadda(self->ob_cdplayer, (CDFRAME *) getstringvalue(result), numframes);
if (n == -1) {
DECREF(result);
- err_errno(IOError); /* XXX - ??? (seems to work) */
+ err_errno(IOError);
return NULL;
}
if (n < numframes)
@@ -685,6 +685,11 @@ CD_removecallback(self, args)
if (!getargs(args, "i", &type))
return NULL;
+ if (type < 0 || type >= NCALLBACKS) {
+ err_setstr(RuntimeError, "bad type");
+ return NULL;
+ }
+
CDremovecallback(self->ob_cdparser, (CDDATATYPES) type);
XDECREF(self->ob_cdcallbacks[type].ob_cdcallback);
@@ -714,7 +719,7 @@ CD_resetparser(self, args)
}
static object *
-CD_setcallback(self, args)
+CD_addcallback(self, args)
cdparserobject *self;
object *args;
{
@@ -732,7 +737,11 @@ CD_setcallback(self, args)
return NULL;
}
+#ifdef IRIX_405
+ CDaddcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, (void *) self);
+#else
CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, (void *) self);
+#endif
XDECREF(self->ob_cdcallbacks[type].ob_cdcallback);
INCREF(funcobject);
self->ob_cdcallbacks[type].ob_cdcallback = funcobject;
@@ -745,11 +754,12 @@ CD_setcallback(self, args)
}
static struct methodlist cdparser_methods[] = {
+ {"addcallback", CD_addcallback},
{"deleteparser", CD_deleteparser},
{"parseframe", CD_parseframe},
{"removecallback", CD_removecallback},
{"resetparser", CD_resetparser},
- {"setcallback", CD_setcallback},
+ {"setcallback", CD_addcallback}, /* backward compatibility */
{NULL, NULL} /* sentinel */
};