Commits

Ronald Oussoren committed 1f034e7

Fix test_protocols test failure on Mac OS X 10.5

  • Participants
  • Parent commits 6de1ba7
  • Branches pyobjc-2.5.x

Comments (0)

Files changed (3)

pyobjc-core/Modules/objc/formal-protocol.m

 	struct objc_method_description * methods;
 	unsigned int method_count, i;
 
+
 	methods = protocol_copyMethodDescriptionList(protocol, isRequired, isInstance, &method_count);
 	if (!methods) {
 		return 0;

pyobjc-core/Modules/objc/objc-runtime-compat.h

 extern ptrdiff_t    (*PyObjC_ivar_getOffset)(Ivar);
 
 extern Protocol** (*PyObjC_objc_copyProtocolList)(unsigned int* outCount);
-extern Protocol*  (*PyObjC_objc_getProtocol)(char* name);
+extern Protocol*  (*PyObjC_objc_getProtocol)(const char* name);
 extern struct objc_method_description_list* (*PyObjC_protocol_copyInstanceMethodDescriptionList)(Protocol* proto);
 extern struct objc_method_description_list* (*PyObjC_protocol_copyClassMethodDescriptionList)(Protocol *proto);
 extern struct objc_method_description_list* (*PyObjC_protocol_copyOptionalInstanceMethodDescriptionList)(Protocol *proto);

pyobjc-core/Modules/objc/objc-runtime-compat.m

 	return protocols;
 }
 
-static Protocol*  compat_objc_getProtocol(char* name)
+static Protocol*  compat_objc_getProtocol(const char* name)
 {
 	uint32_t image_count, image_index;
 	image_count = _dyld_image_count();
 		result[*outCount].types = list->list[i].types;
 		(*outCount)++;
 	}
-
 	return result;
 }
 
 void (*PyObjC_objc_registerClassPair)(Class) = NULL;
 void (*PyObjC_objc_disposeClassPair)(Class) = NULL;
 Protocol** (*PyObjC_objc_copyProtocolList)(unsigned int*) = NULL;
-Protocol*  (*PyObjC_objc_getProtocol)(char* name) = NULL;
+Protocol*  (*PyObjC_objc_getProtocol)(const char* name) = NULL;
 
 BOOL (*PyObjC_preclass_addMethod)(Class, SEL, IMP, const char*) = NULL;
 BOOL (*PyObjC_preclass_addIvar)(Class cls, 
 
 #ifndef __LP64__
 struct Protocol_struct {
+	Class _isa;
 	char *protocol_name;
 	struct objc_protocol_list *protocol_list;
 	struct objc_method_description_list *instance_methods, *class_methods;
 		(*plist)->count = 0;
 	} else {
 		*plist = realloc(*plist, sizeof(struct objc_method_description_list) + (2+((*plist)->count)*sizeof(struct objc_method_description)));
+		if (*plist == NULL) {
+			/* Cannot report errors */
+			abort();
+		}
 	}
 	(*plist)->list[(*plist)->count].name = sel;
 	(*plist)->list[(*plist)->count].types = strdup(types);
 		/* Cannot report errors */
 		abort();
 	}
+	(*plist)->count++;
 
-	(*plist)->list[(*plist)->count+1].name = NULL;
-	(*plist)->list[(*plist)->count+1].types = NULL;
-	(*plist)->count++;
+	(*plist)->list[(*plist)->count].name = NULL;
+	(*plist)->list[(*plist)->count].types = NULL;
 }
 
 static void compat_protocol_addProtocol(Protocol* proto, Protocol* newProto)