@@ -34,9 +34,9 @@ AEEventHandlerUPP upp_GenericEventHandler;
3434
3535static pascal Boolean AEIdleProc (EventRecord * theEvent , long * sleepTime , RgnHandle * mouseRgn )
3636{
37- if ( PyOS_InterruptOccurred () )
38- return 1 ;
39- return 0 ;
37+ if ( PyOS_InterruptOccurred () )
38+ return 1 ;
39+ return 0 ;
4040}
4141
4242AEIdleUPP upp_AEIdleProc ;
@@ -64,6 +64,7 @@ PyObject *AEDesc_New(AEDesc *itself)
6464 it -> ob_owned = 1 ;
6565 return (PyObject * )it ;
6666}
67+
6768int AEDesc_Convert (PyObject * v , AEDesc * p_itself )
6869{
6970 if (!AEDesc_Check (v ))
@@ -829,20 +830,20 @@ static PyObject *AEDesc_get_type(AEDescObject *self, void *closure)
829830static PyObject * AEDesc_get_data (AEDescObject * self , void * closure )
830831{
831832
832- PyObject * res ;
833- Size size ;
834- char * ptr ;
835- OSErr err ;
836-
837- size = AEGetDescDataSize (& self -> ob_itself );
838- if ( (res = PyString_FromStringAndSize (NULL , size )) == NULL )
839- return NULL ;
840- if ( (ptr = PyString_AsString (res )) == NULL )
841- return NULL ;
842- if ( (err = AEGetDescData (& self -> ob_itself , ptr , size )) < 0 )
843- return PyMac_Error (err );
844- return res ;
845-
833+ PyObject * res ;
834+ Size size ;
835+ char * ptr ;
836+ OSErr err ;
837+
838+ size = AEGetDescDataSize (& self -> ob_itself );
839+ if ( (res = PyString_FromStringAndSize (NULL , size )) == NULL )
840+ return NULL ;
841+ if ( (ptr = PyString_AsString (res )) == NULL )
842+ return NULL ;
843+ if ( (err = AEGetDescData (& self -> ob_itself , ptr , size )) < 0 )
844+ return PyMac_Error (err );
845+ return res ;
846+
846847}
847848
848849#define AEDesc_set_data NULL
@@ -863,16 +864,16 @@ static PyGetSetDef AEDesc_getsetlist[] = {
863864
864865#define AEDesc_tp_alloc PyType_GenericAlloc
865866
866- static PyObject * AEDesc_tp_new (PyTypeObject * type , PyObject * args , PyObject * kwds )
867+ static PyObject * AEDesc_tp_new (PyTypeObject * type , PyObject * _args , PyObject * _kwds )
867868{
868- PyObject * self ;
869+ PyObject * _self ;
869870 AEDesc itself ;
870871 char * kw [] = {"itself" , 0 };
871872
872- if (!PyArg_ParseTupleAndKeywords (args , kwds , "O&" , kw , AEDesc_Convert , & itself )) return NULL ;
873- if ((self = type -> tp_alloc (type , 0 )) == NULL ) return NULL ;
874- ((AEDescObject * )self )-> ob_itself = itself ;
875- return self ;
873+ if (!PyArg_ParseTupleAndKeywords (_args , _kwds , "O&" , kw , AEDesc_Convert , & itself )) return NULL ;
874+ if ((_self = type -> tp_alloc (type , 0 )) == NULL ) return NULL ;
875+ ((AEDescObject * )_self )-> ob_itself = itself ;
876+ return _self ;
876877}
877878
878879#define AEDesc_tp_free PyObject_Del
@@ -1383,44 +1384,44 @@ static PyMethodDef AE_methods[] = {
13831384static pascal OSErr
13841385GenericEventHandler (const AppleEvent * request , AppleEvent * reply , refcontype refcon )
13851386{
1386- PyObject * handler = (PyObject * )refcon ;
1387- AEDescObject * requestObject , * replyObject ;
1388- PyObject * args , * res ;
1389- if ((requestObject = (AEDescObject * )AEDesc_New ((AppleEvent * )request )) == NULL ) {
1390- return -1 ;
1391- }
1392- if ((replyObject = (AEDescObject * )AEDesc_New (reply )) == NULL ) {
1393- Py_DECREF (requestObject );
1394- return -1 ;
1395- }
1396- if ((args = Py_BuildValue ("OO" , requestObject , replyObject )) == NULL ) {
1397- Py_DECREF (requestObject );
1398- Py_DECREF (replyObject );
1399- return -1 ;
1400- }
1401- res = PyEval_CallObject (handler , args );
1402- requestObject -> ob_itself .descriptorType = 'null' ;
1403- requestObject -> ob_itself .dataHandle = NULL ;
1404- replyObject -> ob_itself .descriptorType = 'null' ;
1405- replyObject -> ob_itself .dataHandle = NULL ;
1406- Py_DECREF (args );
1407- if (res == NULL ) {
1408- PySys_WriteStderr ("Exception in AE event handler function\n" );
1409- PyErr_Print ();
1410- return -1 ;
1411- }
1412- Py_DECREF (res );
1413- return noErr ;
1387+ PyObject * handler = (PyObject * )refcon ;
1388+ AEDescObject * requestObject , * replyObject ;
1389+ PyObject * args , * res ;
1390+ if ((requestObject = (AEDescObject * )AEDesc_New ((AppleEvent * )request )) == NULL ) {
1391+ return -1 ;
1392+ }
1393+ if ((replyObject = (AEDescObject * )AEDesc_New (reply )) == NULL ) {
1394+ Py_DECREF (requestObject );
1395+ return -1 ;
1396+ }
1397+ if ((args = Py_BuildValue ("OO" , requestObject , replyObject )) == NULL ) {
1398+ Py_DECREF (requestObject );
1399+ Py_DECREF (replyObject );
1400+ return -1 ;
1401+ }
1402+ res = PyEval_CallObject (handler , args );
1403+ requestObject -> ob_itself .descriptorType = 'null' ;
1404+ requestObject -> ob_itself .dataHandle = NULL ;
1405+ replyObject -> ob_itself .descriptorType = 'null' ;
1406+ replyObject -> ob_itself .dataHandle = NULL ;
1407+ Py_DECREF (args );
1408+ if (res == NULL ) {
1409+ PySys_WriteStderr ("Exception in AE event handler function\n" );
1410+ PyErr_Print ();
1411+ return -1 ;
1412+ }
1413+ Py_DECREF (res );
1414+ return noErr ;
14141415}
14151416
14161417PyObject * AEDesc_NewBorrowed (AEDesc * itself )
14171418{
1418- PyObject * it ;
1419-
1420- it = AEDesc_New (itself );
1421- if (it )
1422- ((AEDescObject * )it )-> ob_owned = 0 ;
1423- return (PyObject * )it ;
1419+ PyObject * it ;
1420+
1421+ it = AEDesc_New (itself );
1422+ if (it )
1423+ ((AEDescObject * )it )-> ob_owned = 0 ;
1424+ return (PyObject * )it ;
14241425}
14251426
14261427
@@ -1432,11 +1433,11 @@ void init_AE(void)
14321433
14331434
14341435
1435- upp_AEIdleProc = NewAEIdleUPP (AEIdleProc );
1436- upp_GenericEventHandler = NewAEEventHandlerUPP (GenericEventHandler );
1437- PyMac_INIT_TOOLBOX_OBJECT_NEW (AEDesc * , AEDesc_New );
1438- PyMac_INIT_TOOLBOX_OBJECT_NEW (AEDesc * , AEDesc_NewBorrowed );
1439- PyMac_INIT_TOOLBOX_OBJECT_CONVERT (AEDesc , AEDesc_Convert );
1436+ upp_AEIdleProc = NewAEIdleUPP (AEIdleProc );
1437+ upp_GenericEventHandler = NewAEEventHandlerUPP (GenericEventHandler );
1438+ PyMac_INIT_TOOLBOX_OBJECT_NEW (AEDesc * , AEDesc_New );
1439+ PyMac_INIT_TOOLBOX_OBJECT_NEW (AEDesc * , AEDesc_NewBorrowed );
1440+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT (AEDesc , AEDesc_Convert );
14401441
14411442
14421443 m = Py_InitModule ("_AE" , AE_methods );
0 commit comments