From 5a9c65553f5d570188dd59a9b9a0e5a6972b0470 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Fri, 23 Mar 2018 10:02:31 +0000 Subject: [PATCH] Always use selector type for method type encodings. In the new ABI, we use the legacy type encoding in the selector and the extended type encoding in the types field. We want to only expose the legacy type encoding through existing APIs. --- encoding2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/encoding2.c b/encoding2.c index e6b5b2b..c794f57 100644 --- a/encoding2.c +++ b/encoding2.c @@ -386,7 +386,7 @@ void method_getReturnType(Method method, char *dst, size_t dst_len) { if (NULL == method) { return; } //TODO: Coped and pasted code. Factor it out. - const char *types = method->types; + const char *types = method_getTypeEncoding(method); size_t length = lengthOfTypeEncoding(types); if (length < dst_len) { @@ -402,7 +402,7 @@ void method_getReturnType(Method method, char *dst, size_t dst_len) const char *method_getTypeEncoding(Method method) { if (NULL == method) { return NULL; } - return method->types; + return sel_getType_np(method->selector); } @@ -412,7 +412,7 @@ void method_getArgumentType(Method method, size_t dst_len) { if (NULL == method) { return; } - const char *types = findParameterStart(method->types, index); + const char *types = findParameterStart(method_getTypeEncoding(method), index); if (NULL == types) { strncpy(dst, "", dst_len); @@ -433,7 +433,7 @@ void method_getArgumentType(Method method, unsigned method_getNumberOfArguments(Method method) { if (NULL == method) { return 0; } - const char *types = method->types; + const char *types = method_getTypeEncoding(method); unsigned int count = 0; while('\0' != *types) { @@ -452,7 +452,7 @@ unsigned method_get_number_of_arguments(struct objc_method *method) char* method_copyArgumentType(Method method, unsigned int index) { if (NULL == method) { return NULL; } - const char *types = findParameterStart(method->types, index); + const char *types = findParameterStart(method_getTypeEncoding(method), index); if (NULL == types) { return NULL; @@ -463,7 +463,7 @@ char* method_copyArgumentType(Method method, unsigned int index) char* method_copyReturnType(Method method) { if (NULL == method) { return NULL; } - return copyTypeEncoding(method->types); + return copyTypeEncoding(method_getTypeEncoding(method)); } unsigned objc_get_type_qualifiers (const char *type)