git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35283 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-07-11 04:51:42 +00:00
parent 224d210918
commit 186f17482a
6 changed files with 33 additions and 8 deletions

View file

@ -1,3 +1,15 @@
2012-07-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyedArchiver.m:
* Source/NSCoder.m:
* Source/Additions/GSObjCRuntime.m:
* Source/NSArchiver.m:
* Headers/GNUstepBase/GSObjCRuntime.h:
Have leading type qualifiers and laout information skipped when
encoding a value of on ObjC type, rather than objecting that the
supplied type string is not a known type.
Fix for bug #36824
2012-07-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFFIInvocation.m: Fix for bug #36706

View file

@ -342,6 +342,12 @@ GSTypesFromSelector(SEL sel);
GS_EXPORT BOOL
GSSelectorTypesMatch(const char *types1, const char *types2);
/** Takes full type information and skips forward to the actual type
* as specified in the _C_... constants.
*/
GS_EXPORT const char *
GSSkipTypeQualifierAndLayoutInfo(const char *types);
/**
* Returns a protocol object with the corresponding name.
* This function searches the registered classes for any protocol

View file

@ -627,8 +627,8 @@ GSGetMethod(Class cls, SEL sel,
}
static inline const char *
gs_skip_type_qualifier_and_layout_info (const char *types)
GS_EXPORT const char *
GSSkipTypeQualifierAndLayoutInfo(const char *types)
{
while (*types == '+'
|| *types == '-'
@ -657,8 +657,8 @@ GSSelectorTypesMatch(const char *types1, const char *types2)
while (*types1 && *types2)
{
types1 = gs_skip_type_qualifier_and_layout_info (types1);
types2 = gs_skip_type_qualifier_and_layout_info (types2);
types1 = GSSkipTypeQualifierAndLayoutInfo (types1);
types2 = GSSkipTypeQualifierAndLayoutInfo (types2);
/* Reached the end of the selector. */
if (! *types1 && ! *types2)
@ -681,8 +681,8 @@ GSSelectorTypesMatch(const char *types1, const char *types2)
types2++;
}
types1 = gs_skip_type_qualifier_and_layout_info (types1);
types2 = gs_skip_type_qualifier_and_layout_info (types2);
types1 = GSSkipTypeQualifierAndLayoutInfo (types1);
types2 = GSSkipTypeQualifierAndLayoutInfo (types2);
return (! *types1 && ! *types2);
}

View file

@ -260,10 +260,14 @@ static Class NSMutableDataMallocClass;
uint8_t byteCount = 0;
NSUInteger i;
NSUInteger offset = 0;
uint32_t size = objc_sizeof_type(type);
uint32_t version = [self systemVersion];
uint32_t size;
uint32_t version;
uchar info;
type = GSSkipTypeQualifierAndLayoutInfo(type);
size = objc_sizeof_type(type);
version = [self systemVersion];
if (12402 == version)
{
NSUInteger tmp = count;
@ -374,6 +378,7 @@ static Class NSMutableDataMallocClass;
- (void) encodeValueOfObjCType: (const char*)type
at: (const void*)buf
{
type = GSSkipTypeQualifierAndLayoutInfo(type);
switch (*type)
{
case _C_ID:

View file

@ -499,6 +499,7 @@ static unsigned systemVersion = MAX_SUPPORTED_SYSTEM_VERSION;
- (id) initWithObjCType: (const char*)t count: (NSInteger)c at: (const void*)a
{
t = GSSkipTypeQualifierAndLayoutInfo(t);
_t[0] = *t;
_t[1] = '\0';
_s = objc_sizeof_type(_t);

View file

@ -702,6 +702,7 @@ static NSDictionary *makeReference(unsigned ref)
NSString *aKey;
id o;
type = GSSkipTypeQualifierAndLayoutInfo(type);
if (*type == _C_ID || *type == _C_CLASS)
{
[self encodeObject: *(id*)address];