diff options
Diffstat (limited to 'Mac/Modules/ae/AEmodule.c')
-rw-r--r-- | Mac/Modules/ae/AEmodule.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index 5bb7f9c..d540197 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -795,6 +795,7 @@ static PyObject *AEDesc_getattr(self, name) return PyMac_BuildOSType(self->ob_itself.descriptorType); if (strcmp(name, "data") == 0) { PyObject *res; +#ifndef TARGET_API_MAC_CARBON char state; state = HGetState(self->ob_itself.dataHandle); HLock(self->ob_itself.dataHandle); @@ -803,6 +804,19 @@ static PyObject *AEDesc_getattr(self, name) GetHandleSize(self->ob_itself.dataHandle)); HUnlock(self->ob_itself.dataHandle); HSetState(self->ob_itself.dataHandle, state); +#else + Size size; + char *ptr; + OSErr err; + + size = AEGetDescDataSize(&self->ob_itself); + if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) + return NULL; + if ( (ptr = PyString_AsString(res)) == NULL ) + return NULL; + if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) + return PyMac_Error(err); +#endif return res; } if (strcmp(name, "__members__") == 0) @@ -1145,7 +1159,7 @@ static PyMethodDef AE_methods[] = { static pascal OSErr -GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon) +GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long refcon) { PyObject *handler = (PyObject *)refcon; AEDescObject *requestObject, *replyObject; |