summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-03-06 16:34:49 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-03-06 16:34:49 (GMT)
commit6f3fceb8d8d05039c18439cec96158b585d737a8 (patch)
tree4e46c317d0057c948e7388af6d9d50f88dfa6897
parentbf3258308412de3402ab02cf193297ba88442fed (diff)
downloadcpython-6f3fceb8d8d05039c18439cec96158b585d737a8.zip
cpython-6f3fceb8d8d05039c18439cec96158b585d737a8.tar.gz
cpython-6f3fceb8d8d05039c18439cec96158b585d737a8.tar.bz2
Allow None as TimeBase value in TimeValue records (becomes NULL in C structure,
used for delta-t values by quicktime).
-rw-r--r--Mac/Modules/qt/Qtmodule.c18
-rw-r--r--Mac/Modules/qt/qtsupport.py18
2 files changed, 26 insertions, 10 deletions
diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c
index 36c3efa..d374b45 100644
--- a/Mac/Modules/qt/Qtmodule.c
+++ b/Mac/Modules/qt/Qtmodule.c
@@ -71,9 +71,12 @@ static PyObject *
QtTimeRecord_New(itself)
TimeRecord *itself;
{
-
- return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
}
static int
@@ -81,10 +84,15 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v;
TimeRecord *p_itself;
{
-
- if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale,
- TimeBaseObj_Convert, &p_itself->base) )
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
return 1;
}
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 2e26888..f4186f7 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -53,9 +53,12 @@ static PyObject *
QtTimeRecord_New(itself)
TimeRecord *itself;
{
-
- return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
}
static int
@@ -63,10 +66,15 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v;
TimeRecord *p_itself;
{
-
- if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale,
- TimeBaseObj_Convert, &p_itself->base) )
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
return 1;
}