Shut up many more gcc warnings.

This commit is contained in:
Jack Jansen 2001-09-05 10:31:52 +00:00
parent 5a1516bce5
commit fd064863eb
31 changed files with 186 additions and 110 deletions

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -158,7 +162,6 @@ static PyObject *AEDesc_AEPutPtr(AEDescObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -302,7 +305,6 @@ static PyObject *AEDesc_AEPutParamPtr(AEDescObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -517,7 +519,6 @@ static PyObject *AEDesc_AEPutAttributePtr(AEDescObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -827,7 +828,6 @@ static PyObject *AE_AECoercePtr(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &result);
dataPtr__error__: ;
return _res;
}
@ -851,7 +851,6 @@ static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &result);
dataPtr__error__: ;
return _res;
}
@ -875,7 +874,6 @@ static PyObject *AE_AECreateList(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &resultList);
factoringPtr__error__: ;
return _res;
}
@ -930,7 +928,6 @@ static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &theAEDesc);
dataPtr__error__: ;
return _res;
}
#endif

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -272,7 +276,7 @@ static int CFTypeRefObj_compare(CFTypeRefObject *self, CFTypeRefObject *other)
static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
{
char buf[100];
sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", CFGetTypeID(self->ob_itself), (unsigned long)self, (unsigned long)self->ob_itself);
sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -422,7 +426,7 @@ static int CFArrayRefObj_compare(CFArrayRefObject *self, CFArrayRefObject *other
static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
{
char buf[100];
sprintf(buf, "<CFArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -575,7 +579,7 @@ static int CFMutableArrayRefObj_compare(CFMutableArrayRefObject *self, CFMutable
static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -707,7 +711,7 @@ static int CFDictionaryRefObj_compare(CFDictionaryRefObject *self, CFDictionaryR
static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
{
char buf[100];
sprintf(buf, "<CFDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -823,7 +827,7 @@ static int CFMutableDictionaryRefObj_compare(CFMutableDictionaryRefObject *self,
static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -973,7 +977,7 @@ static int CFDataRefObj_compare(CFDataRefObject *self, CFDataRefObject *other)
static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
{
char buf[100];
sprintf(buf, "<CFDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -1096,7 +1100,6 @@ static PyObject *CFMutableDataRefObj_CFDataAppendBytes(CFMutableDataRefObject *_
bytes__in__, bytes__len__);
Py_INCREF(Py_None);
_res = Py_None;
bytes__error__: ;
return _res;
}
@ -1118,7 +1121,6 @@ static PyObject *CFMutableDataRefObj_CFDataReplaceBytes(CFMutableDataRefObject *
newBytes__in__, newBytes__len__);
Py_INCREF(Py_None);
_res = Py_None;
newBytes__error__: ;
return _res;
}
@ -1171,7 +1173,7 @@ static int CFMutableDataRefObj_compare(CFMutableDataRefObject *self, CFMutableDa
static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -1774,7 +1776,7 @@ static int CFStringRefObj_compare(CFStringRefObject *self, CFStringRefObject *ot
static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
{
char buf[100];
sprintf(buf, "<CFStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -2061,7 +2063,7 @@ static int CFMutableStringRefObj_compare(CFMutableStringRefObject *self, CFMutab
static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
{
char buf[100];
sprintf(buf, "<CFMutableStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -2433,7 +2435,7 @@ static int CFURLRefObj_compare(CFURLRefObject *self, CFURLRefObject *other)
static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
{
char buf[100];
sprintf(buf, "<CFURL object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -2590,7 +2592,6 @@ static PyObject *CF_CFDataCreate(PyObject *_self, PyObject *_args)
bytes__in__, bytes__len__);
_res = Py_BuildValue("O&",
CFDataRefObj_New, _rv);
bytes__error__: ;
return _res;
}
@ -2611,7 +2612,6 @@ static PyObject *CF_CFDataCreateWithBytesNoCopy(PyObject *_self, PyObject *_args
(CFAllocatorRef)NULL);
_res = Py_BuildValue("O&",
CFDataRefObj_New, _rv);
bytes__error__: ;
return _res;
}
@ -2848,7 +2848,6 @@ static PyObject *CF_CFStringCreateWithBytes(PyObject *_self, PyObject *_args)
isExternalRepresentation);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
bytes__error__: ;
return _res;
}
@ -3038,7 +3037,6 @@ static PyObject *CF_CFURLCreateWithBytes(PyObject *_self, PyObject *_args)
baseURL);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
URLBytes__error__: ;
return _res;
}

View File

@ -190,7 +190,7 @@ class MyGlobalObjectDefinition(GlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFTypeRef type-%%d object at 0x%%8.8x for 0x%%8.8x>", CFGetTypeID(self->ob_itself), (unsigned long)self, (unsigned long)self->ob_itself);""")
Output("""sprintf(buf, "<CFTypeRef type-%%d object at 0x%%8.8x for 0x%%8.8x>", CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -205,7 +205,7 @@ class CFArrayRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFArrayRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -217,7 +217,7 @@ class CFMutableArrayRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFMutableArrayRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFMutableArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -229,7 +229,7 @@ class CFDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFDictionaryRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -241,7 +241,7 @@ class CFMutableDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFMutableDictionaryRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFMutableDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -253,7 +253,7 @@ class CFDataRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFDataRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -265,7 +265,7 @@ class CFMutableDataRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFMutableDataRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFMutableDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -296,7 +296,7 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFStringRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -312,7 +312,7 @@ class CFMutableStringRefObjectDefinition(CFStringRefObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFMutableStringRef object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFMutableStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -324,7 +324,7 @@ class CFURLRefObjectDefinition(MyGlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<CFURL object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<CFURL object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -1676,7 +1680,8 @@ static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_a
if (_err != noErr) {
return PyMac_Error(_err);
}
return Py_BuildValue("O&", OptResObj_New, hdl);
_res = Py_BuildValue("O&", OptResObj_New, hdl);
return _res;
}
@ -2526,6 +2531,7 @@ settrackfunc(PyObject *obj)
}
tracker = obj;
Py_INCREF(tracker);
return 1;
}
static void
@ -2575,7 +2581,7 @@ setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr
if ( (self->ob_callbackdict = PyDict_New()) == NULL )
return -1;
/* And store the Python callback */
sprintf(keybuf, "%x", which);
sprintf(keybuf, "%x", (unsigned)which);
if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
return -1;
return 0;
@ -2587,7 +2593,7 @@ callcallback(ControlObject *self, OSType which, PyObject *arglist)
char keybuf[9];
PyObject *func, *rv;
sprintf(keybuf, "%x", which);
sprintf(keybuf, "%x", (unsigned)which);
if ( self->ob_callbackdict == NULL ||
(func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
PySys_WriteStderr("Control callback %x without callback object\n", which);

View File

@ -169,6 +169,7 @@ settrackfunc(PyObject *obj)
}
tracker = obj;
Py_INCREF(tracker);
return 1;
}
static void
@ -218,7 +219,7 @@ setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr
if ( (self->ob_callbackdict = PyDict_New()) == NULL )
return -1;
/* And store the Python callback */
sprintf(keybuf, "%x", which);
sprintf(keybuf, "%x", (unsigned)which);
if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
return -1;
return 0;
@ -230,7 +231,7 @@ callcallback(ControlObject *self, OSType which, PyObject *arglist)
char keybuf[9];
PyObject *func, *rv;
sprintf(keybuf, "%x", which);
sprintf(keybuf, "%x", (unsigned)which);
if ( self->ob_callbackdict == NULL ||
(func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
PySys_WriteStderr("Control callback %x without callback object\\n", which);
@ -554,7 +555,8 @@ _err = GetControlData(_self->ob_itself,
if (_err != noErr) {
return PyMac_Error(_err);
}
return Py_BuildValue("O&", OptResObj_New, hdl);
_res = Py_BuildValue("O&", OptResObj_New, hdl);
return _res;
"""
f = ManualGenerator("GetControlData_Handle", getcontroldata_handle_body);

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -121,7 +125,6 @@ static PyObject *DragObj_AddDragItemFlavor(DragObjObject *_self, PyObject *_args
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -150,7 +153,6 @@ static PyObject *DragObj_SetDragItemFlavorData(DragObjObject *_self, PyObject *_
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -801,7 +803,8 @@ static PyObject *Drag_InstallTrackingHandler(PyObject *_self, PyObject *_args)
_err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}
@ -819,7 +822,8 @@ static PyObject *Drag_InstallReceiveHandler(PyObject *_self, PyObject *_args)
_err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}
@ -835,7 +839,8 @@ static PyObject *Drag_RemoveTrackingHandler(PyObject *_self, PyObject *_args)
_err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}
@ -851,7 +856,8 @@ static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args)
_err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}

View File

@ -236,7 +236,8 @@ installtracking_body = """
_err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
installtracking = ManualGenerator("InstallTrackingHandler", installtracking_body)
module.add(installtracking)
@ -252,7 +253,8 @@ installreceive_body = """
_err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
installreceive = ManualGenerator("InstallReceiveHandler", installreceive_body)
module.add(installreceive)
@ -266,7 +268,8 @@ removetracking_body = """
_err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
removetracking = ManualGenerator("RemoveTrackingHandler", removetracking_body)
module.add(removetracking)
@ -280,7 +283,8 @@ removereceive_body = """
_err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
removereceive = ManualGenerator("RemoveReceiveHandler", removereceive_body)
module.add(removereceive)

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -106,7 +110,6 @@ static PyObject *Evt_GetKeys(PyObject *_self, PyObject *_args)
GetKeys(theKeys__out__);
_res = Py_BuildValue("s#",
(char *)&theKeys__out__, (int)sizeof(KeyMap));
theKeys__error__: ;
return _res;
}

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -361,7 +365,6 @@ static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args)
_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -439,7 +442,6 @@ static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args)
_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
dataPtr__error__: ;
return _res;
}
@ -929,7 +931,8 @@ static PyObject *List_as_List(PyObject *_self, PyObject *_args)
return NULL;
l = (ListObject *)ListObj_New(as_List(h));
l->ob_must_be_disposed = 0;
return Py_BuildValue("O", l);
_res = Py_BuildValue("O", l);
return _res;
}

View File

@ -176,7 +176,8 @@ if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h))
return NULL;
l = (ListObject *)ListObj_New(as_List(h));
l->ob_must_be_disposed = 0;
return Py_BuildValue("O", l);
_res = Py_BuildValue("O", l);
return _res;
"""
f = ManualGenerator("as_List", as_List_body)
f.docstring = lambda: "(Resource)->List.\nReturns List object (which is not auto-freed!)"

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -683,7 +687,6 @@ static PyObject *TXNObj_TXNSetData(TXNObjectObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
iDataPtr__error__: ;
return _res;
}

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -442,7 +446,8 @@ static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
return NULL;
cp = _self->ob_itself->baseAddr+from;
return PyString_FromStringAndSize(cp, length);
_res = PyString_FromStringAndSize(cp, length);
return _res;
}
@ -458,7 +463,8 @@ static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
cp = _self->ob_itself->baseAddr+from;
memcpy(cp, icp, length);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}
@ -912,7 +918,6 @@ static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
GetPenState(&pnState__out__);
_res = Py_BuildValue("s#",
(char *)&pnState__out__, (int)sizeof(PenState));
pnState__error__: ;
return _res;
}
@ -3470,7 +3475,6 @@ static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
index);
_res = Py_BuildValue("s#",
(char *)&thePat__out__, (int)sizeof(Pattern));
thePat__error__: ;
return _res;
}
@ -4116,7 +4120,6 @@ static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args)
GetQDGlobalsArrow(&arrow__out__);
_res = Py_BuildValue("s#",
(char *)&arrow__out__, (int)sizeof(Cursor));
arrow__error__: ;
return _res;
}
@ -4129,7 +4132,6 @@ static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args)
GetQDGlobalsDarkGray(&dkGray__out__);
_res = Py_BuildValue("s#",
(char *)&dkGray__out__, (int)sizeof(Pattern));
dkGray__error__: ;
return _res;
}
@ -4142,7 +4144,6 @@ static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args)
GetQDGlobalsLightGray(&ltGray__out__);
_res = Py_BuildValue("s#",
(char *)&ltGray__out__, (int)sizeof(Pattern));
ltGray__error__: ;
return _res;
}
@ -4155,7 +4156,6 @@ static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args)
GetQDGlobalsGray(&gray__out__);
_res = Py_BuildValue("s#",
(char *)&gray__out__, (int)sizeof(Pattern));
gray__error__: ;
return _res;
}
@ -4168,7 +4168,6 @@ static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args)
GetQDGlobalsBlack(&black__out__);
_res = Py_BuildValue("s#",
(char *)&black__out__, (int)sizeof(Pattern));
black__error__: ;
return _res;
}
@ -4181,7 +4180,6 @@ static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args)
GetQDGlobalsWhite(&white__out__);
_res = Py_BuildValue("s#",
(char *)&white__out__, (int)sizeof(Pattern));
white__error__: ;
return _res;
}
@ -4448,7 +4446,6 @@ static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
char *textBuf__in__;
int textBuf__len__;
int textBuf__in_len__;
short firstByte;
short byteCount;
@ -4457,12 +4454,13 @@ static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
&firstByte,
&byteCount))
return NULL;
/* Fool compiler warnings */
textBuf__in_len__ = textBuf__in_len__;
MacDrawText(textBuf__in__,
firstByte,
byteCount);
Py_INCREF(Py_None);
_res = Py_None;
textBuf__error__: ;
return _res;
}
@ -4499,7 +4497,6 @@ static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
PyObject *_res = NULL;
short _rv;
char *textBuf__in__;
int textBuf__len__;
int textBuf__in_len__;
short firstByte;
short byteCount;
@ -4508,12 +4505,13 @@ static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
&firstByte,
&byteCount))
return NULL;
/* Fool compiler warnings */
textBuf__in_len__ = textBuf__in_len__;
_rv = TextWidth(textBuf__in__,
firstByte,
byteCount);
_res = Py_BuildValue("h",
_rv);
textBuf__error__: ;
return _res;
}
@ -4977,7 +4975,6 @@ static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
char *textBuf__in__;
int textBuf__len__;
int textBuf__in_len__;
short firstByte;
short byteCount;
@ -4986,12 +4983,13 @@ static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
&firstByte,
&byteCount))
return NULL;
/* Fool compiler warnings */
textBuf__in_len__ = textBuf__in_len__;
DrawText(textBuf__in__,
firstByte,
byteCount);
Py_INCREF(Py_None);
_res = Py_None;
textBuf__error__: ;
return _res;
}

View File

@ -24,7 +24,11 @@ from macsupport import *
class TextThingieClass(FixedInputBufferType):
def getargsCheck(self, name):
pass
Output("/* Fool compiler warnings */")
Output("%s__in_len__ = %s__in_len__;", name, name)
def declareSize(self, name):
Output("int %s__in_len__;", name)
TextThingie = TextThingieClass(None)
@ -566,7 +570,8 @@ char *cp;
if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
return NULL;
cp = _self->ob_itself->baseAddr+from;
return PyString_FromStringAndSize(cp, length);
_res = PyString_FromStringAndSize(cp, length);
return _res;
"""
f = ManualGenerator("getdata", getdata_body)
f.docstring = lambda: """(int start, int size) -> string. Return bytes from the bitmap"""
@ -582,7 +587,8 @@ if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
cp = _self->ob_itself->baseAddr+from;
memcpy(cp, icp, length);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
f = ManualGenerator("putdata", putdata_body)
f.docstring = lambda: """(int start, string data). Store bytes into the bitmap"""

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -503,7 +507,8 @@ static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args)
if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
return NULL;
cp = GetPixBaseAddr(pm)+from;
return PyString_FromStringAndSize(cp, length);
_res = PyString_FromStringAndSize(cp, length);
return _res;
}
@ -520,7 +525,8 @@ static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
cp = GetPixBaseAddr(pm)+from;
memcpy(cp, icp, length);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
}

View File

@ -105,7 +105,8 @@ char *cp;
if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
return NULL;
cp = GetPixBaseAddr(pm)+from;
return PyString_FromStringAndSize(cp, length);
_res = PyString_FromStringAndSize(cp, length);
return _res;
"""
f = ManualGenerator("GetPixMapBytes", pixmapgetbytes_body)
f.docstring = lambda: """(pixmap, int start, int size) -> string. Return bytes from the pixmap"""
@ -122,7 +123,8 @@ if ( !PyArg_ParseTuple(_args, "O&is#", ResObj_Convert, &pm, &from, &icp, &length
cp = GetPixBaseAddr(pm)+from;
memcpy(cp, icp, length);
Py_INCREF(Py_None);
return Py_None;
_res = Py_None;
return _res;
"""
f = ManualGenerator("PutPixMapBytes", pixmapputbytes_body)
f.docstring = lambda: """(pixmap, int start, string data). Store bytes into the pixmap"""

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -394,7 +398,8 @@ static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
return CtlObj_New((ControlHandle)_self->ob_itself);
_res = CtlObj_New((ControlHandle)_self->ob_itself);
return _res;
}
@ -402,7 +407,8 @@ static PyObject *ResObj_as_Menu(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
return MenuObj_New((MenuHandle)_self->ob_itself);
_res = MenuObj_New((MenuHandle)_self->ob_itself);
return _res;
}
@ -1533,7 +1539,7 @@ PyObject *OptResObj_New(Handle itself)
return ResObj_New(itself);
}
OptResObj_Convert(PyObject *v, Handle *p_itself)
int OptResObj_Convert(PyObject *v, Handle *p_itself)
{
PyObject *tmp;

View File

@ -58,7 +58,8 @@ functions.append(f)
# Convert resources to other things.
as_xxx_body = """
return %sObj_New((%sHandle)_self->ob_itself);
_res = %sObj_New((%sHandle)_self->ob_itself);
return _res;
"""
def genresconverter(longname, shortname):

View File

@ -61,7 +61,7 @@ PyObject *OptResObj_New(Handle itself)
return ResObj_New(itself);
}
OptResObj_Convert(PyObject *v, Handle *p_itself)
int OptResObj_Convert(PyObject *v, Handle *p_itself)
{
PyObject *tmp;

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -23,13 +27,14 @@
#include <Carbon/Carbon.h>
#endif
#if !TARGET_API_MAC_CARBON
/* Create a SndCommand object (an (int, int, int) tuple) */
static PyObject *
SndCmd_New(SndCommand *pc)
{
return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2);
}
#endif
/* Convert a SndCommand argument */
static int
@ -80,16 +85,6 @@ static PyObject *SndCh_New(SndChannelPtr itself)
it->ob_A5 = SetCurrentA5();
return (PyObject *)it;
}
static int SndCh_Convert(PyObject *v, SndChannelPtr *p_itself)
{
if (!SndCh_Check(v))
{
PyErr_SetString(PyExc_TypeError, "SndChannel required");
return 0;
}
*p_itself = ((SndChannelObject *)v)->ob_itself;
return 1;
}
static void SndCh_dealloc(SndChannelObject *self)
{
@ -233,7 +228,6 @@ static PyObject *SndCh_SndChannelStatus(SndChannelObject *_self, PyObject *_args
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s#",
(char *)&theStatus__out__, (int)sizeof(SCStatus));
theStatus__error__: ;
return _res;
}
@ -372,7 +366,7 @@ static PyObject *SPBObj_New(void)
it->ob_spb.userLong = (long)it;
return (PyObject *)it;
}
static SPBObj_Convert(PyObject *v, SPBPtr *p_itself)
static int SPBObj_Convert(PyObject *v, SPBPtr *p_itself)
{
if (!SPBObj_Check(v))
{
@ -474,7 +468,7 @@ staticforward PyTypeObject SPB_Type = {
static PyObject *Snd_SPB(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
return SPBObj_New();
_res = SPBObj_New(); return _res;
}
static PyObject *Snd_SysBeep(PyObject *_self, PyObject *_args)
@ -572,7 +566,6 @@ static PyObject *Snd_SndManagerStatus(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s#",
(char *)&theStatus__out__, (int)sizeof(SMStatus));
theStatus__error__: ;
return _res;
}
@ -896,7 +889,6 @@ static PyObject *Snd_GetCompressionInfo(PyObject *_self, PyObject *_args)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s#",
(char *)&cp__out__, (int)sizeof(CompressionInfo));
cp__error__: ;
return _res;
}

View File

@ -95,13 +95,14 @@ SMStatus = StructOutputBufferType('SMStatus')
CompressionInfo = StructOutputBufferType('CompressionInfo')
includestuff = includestuff + """
#if !TARGET_API_MAC_CARBON
/* Create a SndCommand object (an (int, int, int) tuple) */
static PyObject *
SndCmd_New(SndCommand *pc)
{
return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2);
}
#endif
/* Convert a SndCommand argument */
static int
@ -230,6 +231,9 @@ class SndObjectDefinition(ObjectDefinition):
def outputFreeIt(self, itselfname):
Output("SndDisposeChannel(%s, 1);", itselfname)
def outputConvert(self):
pass # Not needed
#
class SpbObjectDefinition(ObjectDefinition):
@ -270,7 +274,7 @@ class SpbObjectDefinition(ObjectDefinition):
Output("Py_XDECREF(self->ob_interrupt);")
def outputConvert(self):
Output("%s%s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, self.itselftype)
Output("%sint %s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, self.itselftype)
OutLbrace()
self.outputCheckConvertArg()
Output("if (!%s_Check(v))", self.prefix)
@ -333,7 +337,7 @@ class SpbObjectDefinition(ObjectDefinition):
sndobject = SndObjectDefinition('SndChannel', 'SndCh', 'SndChannelPtr')
spbobject = SpbObjectDefinition('SPB', 'SPBObj', 'SPBPtr')
spbgenerator = ManualGenerator("SPB", "return SPBObj_New();")
spbgenerator = ManualGenerator("SPB", "_res = SPBObj_New(); return _res;")
module = MacModule('_Snd', 'Snd', includestuff, finalstuff, initstuff)
module.addobject(sndobject)
module.addobject(spbobject)

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -113,7 +117,6 @@ static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args)
_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
text__error__: ;
return _res;
}
@ -251,7 +254,6 @@ static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args)
_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
text__error__: ;
return _res;
}
@ -531,7 +533,6 @@ static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args)
_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
text__error__: ;
return _res;
}
@ -873,7 +874,6 @@ static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args)
just);
Py_INCREF(Py_None);
_res = Py_None;
text__error__: ;
return _res;
}

View File

@ -5,8 +5,12 @@
#ifdef _WIN32
#include "pywintoolbox.h"
#else
#include "macglue.h"
#include "pymactoolbox.h"
#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@ -2125,7 +2129,7 @@ static int WinObj_compare(WindowObject *self, WindowObject *other)
static PyObject * WinObj_repr(WindowObject *self)
{
char buf[100];
sprintf(buf, "<Window object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
return PyString_FromString(buf);
}
@ -2643,7 +2647,8 @@ static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
if ( !PyArg_ParseTuple(_args, "i", &ptr) )
return NULL;
return WinObj_WhichWindow((WindowPtr)ptr);
_res = WinObj_WhichWindow((WindowPtr)ptr);
return _res;
}

View File

@ -179,7 +179,7 @@ class MyObjectDefinition(GlobalObjectDefinition):
Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("char buf[100];")
Output("""sprintf(buf, "<Window object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""")
Output("""sprintf(buf, "<Window object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
Output("return PyString_FromString(buf);")
OutRbrace()
@ -208,7 +208,8 @@ long ptr;
if ( !PyArg_ParseTuple(_args, "i", &ptr) )
return NULL;
return WinObj_WhichWindow((WindowPtr)ptr);
_res = WinObj_WhichWindow((WindowPtr)ptr);
return _res;
"""
f = ManualGenerator("WhichWindow", whichwin_body)