From 80632b32c77283777b8b65ca00963ed4e1f6babc Mon Sep 17 00:00:00 2001 From: wlux Date: Tue, 6 Apr 2010 16:49:44 +0000 Subject: [PATCH] Fix the defunct test for the standard structure types in cifframe_type. The failure to detect those types was causing a substantial space leak in some gui applications. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30093 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/cifframe.m | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d8f49b69..f17a9123f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-06 Wolfgang Lux + + * Source/cifframe.m (cifframe_type): Fix the defunct test for the + standard structure types. The failure to detect those types was + causing a substantial space leak in some gui applications. + 2010-03-29 Richard Frith-Macdonald * config/config.ffi.c: add test for libffi functionality diff --git a/Source/cifframe.m b/Source/cifframe.m index 3a35e55d5..4e64c0bfc 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -340,8 +340,13 @@ cifframe_type(const char *typePtr, const char **advance) unsigned align = __alignof(double); /* Standard structures can be handled using cached type information. + Since the switch statement has already skipped the _C_STRUCT_B + character, we must use typePtr-1 below to successfully match the + type encoding with one of the standard type encodings. The same + holds for skipping past the whole structure type's encoding with + objc_skip_typespec. */ - if (GSSelectorTypesMatch(typePtr, @encode(NSRange))) + if (GSSelectorTypesMatch(typePtr - 1, @encode(NSRange))) { static ffi_type *elems[3]; static ffi_type stype = { 0 }; @@ -368,10 +373,10 @@ cifframe_type(const char *typePtr, const char **advance) stype.type = FFI_TYPE_STRUCT; } ftype = &stype; - typePtr = objc_skip_typespec (typePtr); + typePtr = objc_skip_typespec (typePtr - 1); break; } - else if (GSSelectorTypesMatch(typePtr, @encode(NSSize))) + else if (GSSelectorTypesMatch(typePtr - 1, @encode(NSSize))) { static ffi_type *elems[3]; static ffi_type stype = { 0 }; @@ -392,10 +397,10 @@ cifframe_type(const char *typePtr, const char **advance) stype.type = FFI_TYPE_STRUCT; } ftype = &stype; - typePtr = objc_skip_typespec (typePtr); + typePtr = objc_skip_typespec (typePtr - 1); break; } - else if (GSSelectorTypesMatch(typePtr, @encode(NSRect))) + else if (GSSelectorTypesMatch(typePtr - 1, @encode(NSRect))) { static ffi_type *elems[3]; static ffi_type stype = { 0 }; @@ -412,7 +417,7 @@ cifframe_type(const char *typePtr, const char **advance) stype.type = FFI_TYPE_STRUCT; } ftype = &stype; - typePtr = objc_skip_typespec (typePtr); + typePtr = objc_skip_typespec (typePtr - 1); break; }