Ronald Oussoren avatar Ronald Oussoren committed f2948d2

Update for GNUstep. With this change test_methods2.py passes for the first time.

Comments (0)

Files changed (1)

pyobjc/Modules/objc/libffi_support.m

 	}
 }
 
+
 static ffi_type*
 signature_to_ffi_type(const char* argtype)
 {
 	}
 }
 
+/*
+ * arg_signature_to_ffi_type: Make the ffi_type for the call to the method IMP,
+ * on MacOS X this is the same as the normal signature_to_ffi_type, but on
+ * Linux/GNUstep we need a slightly different function.
+ */
+#ifdef MACOSX
+#define arg_signature_to_ffi_type signature_to_ffi_type
+
+#else
+
+static inline ffi_type*
+arg_signature_to_ffi_type(const char* argtype)
+{
+	/* NOTE: This is the minimal change to pass the unittests, it is not
+	 * based on analysis of the calling conventions.
+	 */
+	switch (*argtype) {
+	case _C_CHR: return &ffi_type_sint;
+	case _C_UCHR: return &ffi_type_uint;
+	case _C_SHT: return &ffi_type_sint;
+	case _C_USHT: return &ffi_type_uint;
+	default: return signature_to_ffi_type(argtype);
+	}
+}
+
+#endif
+
 /* This function decodes its arguments into Python values, then
  * calls the python method and finally encodes the return value
  */
 	}
 
 	for (i = 0; i < methinfo->nargs; i++) {
-		cl_arg_types[i+argOffset] = signature_to_ffi_type(
+		cl_arg_types[i+argOffset] = arg_signature_to_ffi_type(
 			methinfo->argtype[i]);
 		if (cl_arg_types[i+argOffset] == NULL) {
 			PyObjCMethodSignature_Free(methinfo);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.