old/new objc api updates

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33027 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-05-12 16:03:08 +00:00
parent ac3f2c5095
commit b2649e0526
16 changed files with 62 additions and 18 deletions

View file

@ -66,7 +66,13 @@ typeSize(const char* type)
case _C_BFLD:
case _C_ARY_B:
case _C_UNION_B:
case _C_STRUCT_B: return objc_sizeof_type(type);
case _C_STRUCT_B:
{
NSUInteger size;
NSGetSizeAndAlignment(type, &size, 0);
return (int)size;
}
case _C_VOID: return 0;
default: return -1;
}
@ -242,13 +248,15 @@ typeSize(const char* type)
- (void) encodeWithCoder: (NSCoder *)coder
{
NSUInteger tsize;
unsigned size;
NSMutableData *d;
size = strlen(objctype)+1;
[coder encodeValueOfObjCType: @encode(unsigned) at: &size];
[coder encodeArrayOfObjCType: @encode(signed char) count: size at: objctype];
size = objc_sizeof_type(objctype);
NSGetSizeAndAlignment(objctype, 0, &tsize);
size = tsize;
d = [NSMutableData new];
[d serializeDataAt: data ofObjCType: objctype context: nil];
size = [d length];