Ronald Oussoren  committed 31e85b1

Python2.5 related cleanups

  • Participants
  • Parent commits f36c687
  • Branches pyobjc-ancient

Comments (0)

Files changed (15)

File Modules/objc/OC_PythonData.h

 @interface OC_PythonData : NSData
 	PyObject* value;
-	unsigned buffer_len;
+	Py_ssize_t buffer_len;
 	const void *buffer;

File Modules/objc/OC_PythonDictionary.h

  * XXX - document these, internal
--(BOOL)wrappedKey:(id*)keyPtr value:(id*)valuePtr atPosition:(int*)positionPtr;
+-(BOOL)wrappedKey:(id*)keyPtr value:(id*)valuePtr atPosition:(Py_ssize_t*)positionPtr;
 -(int)depythonify:(PyObject*)v toId:(id*)datum;

File Modules/objc/OC_PythonObject.h

 + newWithObject:(PyObject *) obj;
 + depythonifyTable;
 + pythonifyStructTable;
-+ (PyObject *)__pythonifyStruct:(PyObject *) obj withType:(const char *) type length:(int) length;
++ (PyObject *)__pythonifyStruct:(PyObject *) obj withType:(const char *) type length:(Py_ssize_t) length;
 + newWithCoercedObject:(PyObject *) obj;
 - initWithObject:(PyObject *) obj;

File Modules/objc/libffi_support.h

 typedef void (*PyObjCFFI_ClosureFunc)(ffi_cif*, void*, void**, void*);
 void PyObjCFFI_FreeCIF(ffi_cif* cif);
-ffi_cif* PyObjCFFI_CIFForSignature(PyObjCMethodSignature* signature, int* pArgOffset);
+ffi_cif* PyObjCFFI_CIFForSignature(PyObjCMethodSignature* signature, Py_ssize_t* pArgOffset);
 IMP PyObjCFFI_MakeClosure(PyObjCMethodSignature* signature,
 			PyObjCFFI_ClosureFunc func, void* userdata);
 void* PyObjCFFI_FreeClosure(IMP closure);
 PyObject *PyObjCFFI_Caller(PyObject *aMeth, PyObject* self, PyObject *args);
 int PyObjCFFI_CountArguments(
-	PyObjCMethodSignature* methinfo, int argOffset, 
-	int* byref_in_count,
-	int* byref_out_count,
-	int* plain_count,
-	int* argbuf_len);
+	PyObjCMethodSignature* methinfo, Py_ssize_t argOffset, 
+	Py_ssize_t* byref_in_count,
+	Py_ssize_t* byref_out_count,
+	Py_ssize_t* plain_count,
+	Py_ssize_t* argbuf_len);
 int PyObjCFFI_ParseArguments(
-	PyObjCMethodSignature* methinfo, int argOffset,
-	PyObject* args, int argbuf_cur, unsigned char* argbuf,
+	PyObjCMethodSignature* methinfo, Py_ssize_t argOffset,
+	PyObject* args, Py_ssize_t argbuf_cur, unsigned char* argbuf,
 	void** byref,
 	ffi_type** arglist, void** values);
 PyObject* PyObjCFFI_BuildResult(
-	PyObjCMethodSignature* methinfo, int argOffset,
-	void* pRetval, void** byref, int byref_out_count,
+	PyObjCMethodSignature* methinfo, Py_ssize_t argOffset,
+	void* pRetval, void** byref, Py_ssize_t byref_out_count,
 	PyObject* self, int flags);
 #endif /* PyObjC_FFI_SUPPORT_H */

File Modules/objc/method-signature.h

  * 	pointers point to substrings of signature.
 typedef struct {
-	int   retainCount;
-	int   nargs;
+	int retainCount;
+	Py_ssize_t nargs;
 	const char* rettype;
 	const char* signature;
 	const char* argtype[1];

File Modules/objc/objc-class.h

 	Class class;
 	PyObject* sel_to_py;
 	int method_magic;
-	int dictoffset;
+	Py_ssize_t dictoffset;
 	PyObject* delmethod;
 	int hasPythonImpl;
 	int generation;
 int PyObjCClass_IsSubClass(Class child, Class parent);
 int ObjC_RegisterClassProxy(Class cls, PyObject* classProxy);
 void PyObjCClass_CheckMethodList(PyObject* cls, int recursive);
-int PyObjCClass_DictOffset(PyObject* cls);
+Py_ssize_t PyObjCClass_DictOffset(PyObject* cls);
 PyObject* PyObjCClass_GetDelMethod(PyObject* cls);
 void PyObjCClass_SetDelMethod(PyObject* cls, PyObject* newval);
 int  PyObjCClass_HasPythonImplementation(PyObject* cls);

File Modules/objc/objc-runtime-apple.h

-extern struct objc_method_list* PyObjCRT_AllocMethodList(int);
-extern struct objc_protocol_list* PyObjCRT_AllocProtocolList(int);
+extern struct objc_method_list* PyObjCRT_AllocMethodList(Py_ssize_t);
+extern struct objc_protocol_list* PyObjCRT_AllocProtocolList(Py_ssize_t);
 typedef Method PyObjCRT_Method_t;
 typedef Ivar PyObjCRT_Ivar_t;

File Modules/objc/objc-runtime-gnu.h

-extern MethodList_t PyObjCRT_AllocMethodList(int);
-extern struct objc_protocol_list* PyObjCRT_AllocProtocolList(int);
+extern MethodList_t PyObjCRT_AllocMethodList(Py_ssize_t);
+extern struct objc_protocol_list* PyObjCRT_AllocProtocolList(Py_ssize_t);
 typedef Method_t PyObjCRT_Method_t;

File Modules/objc/objc_support.h

 					PyObject *arg,
 					void *datum);
-extern int PyObjCRT_SizeOfReturnType(const char* type);
-extern int PyObjCRT_SizeOfType(const char *type);
-extern int PyObjCRT_AlignOfType(const char *type);
+extern Py_ssize_t PyObjCRT_SizeOfReturnType(const char* type);
+extern Py_ssize_t PyObjCRT_SizeOfType(const char *type);
+extern Py_ssize_t PyObjCRT_AlignOfType(const char *type);
 extern const char *PyObjCRT_SkipTypeSpec (const char *type);
 extern const char* PyObjCRT_SkipTypeQualifiers (const char* type);
 extern int PyObjCRT_SetupClass(
-	Class, Class, const char*, Class, Class, int, struct objc_ivar_list*,
+	Class, Class, const char*, Class, Class, Py_ssize_t, struct objc_ivar_list*,
 	struct objc_protocol_list*);
 extern void PyObjCRT_ClearClass(Class cls);

File Modules/objc/objc_util.h

 void    PyObjC_FreeCArray(int, void*);
 int     PyObjC_PythonToCArray(const char*, PyObject*, PyObject*, void**, int*);
-PyObject* PyObjC_CArrayToPython(const char*, void*, int);
+PyObject* PyObjC_CArrayToPython(const char*, void*, Py_ssize_t);
 int     PyObjC_IsPythonKeyword(const char* word);

File Modules/objc/pyobjc-api.h

  * - Version 14 adds PyObjCObject_NewTransient, PyObjCObject_ReleaseTransient
  * - Version 15 changes the interface of PyObjCObject_New
  * - Version 16 adds PyObjC_PerformWeaklinking
+ * - Version 17 introduces Py_ssize_t support
 #define PYOBJC_API_NAME "__C_API__"
 	PyObject* (*objc_to_py)(const char*, void*);
 	/* PyObjC_SizeOfType */
-	int 	   (*sizeof_type)(const char*);
+	Py_ssize_t   (*sizeof_type)(const char*);
 	/* PyObjCSelector_GetClass */
 	Class	   (*sel_get_class)(PyObject* sel);
 	void (*err_python_to_objc_gil)(PyGILState_STATE* state);
 	/* PyObjCRT_AlignOfType */
-	int (*alignof_type)(const char* typestr);
+	Py_ssize_t (*alignof_type)(const char* typestr);
 	/* PyObjCRT_SELName */
 	const char* (*selname)(SEL sel);
 	int     (*py_to_c_array)(const char*, PyObject*, PyObject*, void**, int*);
 	/* PyObjC_CArrayToPython */
-	PyObject* (*c_array_to_py)(const char*, void*, int);
+	PyObject* (*c_array_to_py)(const char*, void*, Py_ssize_t);
 	/* PyObjC_RegisterStructType */
-	PyObject* (*register_struct)(const char*, const char*, const char*, initproc, int, const char**);
+	PyObject* (*register_struct)(const char*, const char*, const char*, initproc, Py_ssize_t, const char**);
 	/* PyObjCIMP_Type */
 	PyTypeObject* imp_type;

File Modules/objc/pyobjc-compat.h

+#if (PY_VERSION_HEX < 0x02050000)
+typedef int Py_ssize_t;
+#define PY_FORMAT_SIZE_T ""
+#define Py_ARG_SIZE_T "n"
+#define Py_ARG_SIZE_T "i"
 #endif /* PyObjC_COMPAT_H */

File Modules/objc/pyobjc.h

 // Loading in AppKit on Mac OS X 10.3 results in
 // a bit less than 1500 classes.
 #include <Python.h>
 #include "structmember.h"

File Modules/objc/struct-wrapper.h

 	const char* name,
 	const char* doc,
 	initproc tpinit,
-	int numFields,
+	Py_ssize_t numFields,
 	const char** fieldnames,
 	const char* typestr);
 	const char* name,
 	const char* doc,
 	initproc tpinit,
-	int numFields,
+	Py_ssize_t numFields,
 	const char** fieldnames);
  *     The returned instance is uninitialized, all fields are NULL. The 
  *     __init__ method has not been called.
-PyObject* PyObjC_CreateRegisteredStruct(const char* signature, int len);
+PyObject* PyObjC_CreateRegisteredStruct(const char* signature, Py_ssize_t len);
 #endif /* PyObjC_STRUCT_MEMBER */

File Modules/objc/super-call.h

  *     This value is used by the objc-class module to detect if the methods in
  *     a class should be regenerated.
-extern int PyObjC_MappingCount;
+extern Py_ssize_t PyObjC_MappingCount;