Kaydet (Commit) b734adef authored tarafından Jack Jansen's avatar Jack Jansen

Added PyMac_BuildOptStr255, which returns None on a null pointer.

üst a07431f0
......@@ -105,6 +105,7 @@ PyObject *PyMac_BuildNumVersion(NumVersion); /* Convert NumVersion to PyObject *
int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */
PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */
PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject, NULL to None */
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
......
......@@ -826,6 +826,20 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf)
PyObject *
PyMac_BuildStr255(Str255 s)
{
if ( s == NULL ) {
PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL");
return NULL;
}
return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
}
PyObject *
PyMac_BuildOptStr255(Str255 s)
{
if ( s == NULL ) {
Py_INCREF(Py_None);
return Py_None;
}
return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment