diff --git a/ChangeLog b/ChangeLog index e396c6ac6..24af924e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,26 @@ +2011-05-12 Richard Frith-Macdonald + + * Source/NSPortCoder.m: + * Source/GSConcreteValueTemplate.m: + * Source/GSFFCallInvocation.m: + * Source/NSKeyedUnarchiver.m: + * Source/GSFFIInvocation.m: + * Source/NSUnarchiver.m: + * Source/NSCoder.m: + * Source/NSURL.m: + * Source/cifframe.m: + * Source/NSConnection.m: + * Source/NSData.m: + * Source/NSObjCRuntime.m: + * Source/GSValue.m: + * Source/NSValue.m: + * Source/NSArchiver.m: + updates for old/new objc api change. + 2011-05-12 Fred Kiefer - * Source/GSArray.m: Fix keyed decoding for GSMutableArray and GSPlaceholderArray. + * Source/GSArray.m: Fix keyed decoding for GSMutableArray and + GSPlaceholderArray. 2011-05-09 Richard Frith-Macdonald diff --git a/Source/GSConcreteValueTemplate.m b/Source/GSConcreteValueTemplate.m index aa044f5af..030c7b5f2 100644 --- a/Source/GSConcreteValueTemplate.m +++ b/Source/GSConcreteValueTemplate.m @@ -120,13 +120,15 @@ // Accessing Data - (void) getValue: (void *)value { + NSUInteger size; if (!value) { [NSException raise: NSInvalidArgumentException format: @"Cannot copy value into NULL buffer"]; /* NOT REACHED */ } - memcpy(value, &data, objc_sizeof_type([self objCType])); + NSGetSizeAndAlignment([self objCType], 0, &size); + memcpy(value, &data, size); } - (BOOL) isEqual: (id)other diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index b14749085..6c55267a8 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -22,6 +22,7 @@ Boston, MA 02111 USA. */ #import "common.h" +#import #import "Foundation/NSException.h" #import "Foundation/NSCoder.h" #import "Foundation/NSDistantObject.h" diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 9954c296f..96a835d02 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -23,6 +23,7 @@ */ #import "common.h" +#import #define EXPOSE_NSInvocation_IVARS 1 #import "Foundation/NSException.h" #import "Foundation/NSCoder.h" diff --git a/Source/GSValue.m b/Source/GSValue.m index 463d305ce..33761ad65 100644 --- a/Source/GSValue.m +++ b/Source/GSValue.m @@ -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]; diff --git a/Source/NSArchiver.m b/Source/NSArchiver.m index 4779b432b..5352b90a8 100644 --- a/Source/NSArchiver.m +++ b/Source/NSArchiver.m @@ -26,6 +26,7 @@ */ #import "common.h" +#import #define EXPOSE_NSArchiver_IVARS 1 #define EXPOSE_NSUnarchiver_IVARS 1 /* diff --git a/Source/NSCoder.m b/Source/NSCoder.m index cbe6e6202..14062b248 100644 --- a/Source/NSCoder.m +++ b/Source/NSCoder.m @@ -27,6 +27,7 @@ */ #import "common.h" +#import #define EXPOSE_NSCoder_IVARS 1 #import "Foundation/NSData.h" #import "Foundation/NSCoder.h" diff --git a/Source/NSConnection.m b/Source/NSConnection.m index bb079e726..12a62ff2a 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -30,6 +30,7 @@ */ #import "common.h" +#import #define GS_NSConnection_IVARS \ BOOL _isValid; \ diff --git a/Source/NSData.m b/Source/NSData.m index d6d50cc0a..774a54a3a 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -68,6 +68,7 @@ */ #import "common.h" +#import #import "GNUstepBase/GSObjCRuntime.h" #import "Foundation/NSByteOrder.h" #import "Foundation/NSCoder.h" diff --git a/Source/NSKeyedUnarchiver.m b/Source/NSKeyedUnarchiver.m index e5db84098..e5024795e 100644 --- a/Source/NSKeyedUnarchiver.m +++ b/Source/NSKeyedUnarchiver.m @@ -380,7 +380,8 @@ static NSMapTable *globalClassMap = 0; count: (NSUInteger)expected at: (void*)buf { - id o = [self decodeObject]; + id o = [self decodeObject]; + NSUInteger size; if ([o isKindOfClass: [_NSKeyedCoderOldStyleArray class]] == NO) { @@ -400,7 +401,8 @@ static NSMapTable *globalClassMap = 0; format: @"[%@ +%@]: count missmatch", NSStringFromClass([self class]), NSStringFromSelector(_cmd), o]; } - memcpy(buf, [o bytes], expected * objc_sizeof_type(type)); + NSGetSizeAndAlignment(type, 0, &size); + memcpy(buf, [o bytes], expected * size); } - (BOOL) decodeBoolForKey: (NSString*)aKey diff --git a/Source/NSObjCRuntime.m b/Source/NSObjCRuntime.m index e3b9b4e61..2226e58c6 100644 --- a/Source/NSObjCRuntime.m +++ b/Source/NSObjCRuntime.m @@ -26,6 +26,7 @@ */ #import "common.h" +#import #import "Foundation/NSException.h" #include diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 359bda8f4..aa1146f64 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -34,6 +34,7 @@ */ #import "common.h" +#import #define EXPOSE_NSPortCoder_IVARS 1 #import "Foundation/NSException.h" #import "Foundation/NSByteOrder.h" diff --git a/Source/NSURL.m b/Source/NSURL.m index f36bb0ef5..f50d2b020 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -574,7 +574,7 @@ static char *unescape(const char *from, char * to) */ @implementation NSURL -static unsigned urlAlign; +static NSUInteger urlAlign; /** * Create and return a file URL with the supplied path.
@@ -591,7 +591,7 @@ static unsigned urlAlign; { if (clientsLock == nil) { - urlAlign = objc_alignof_type(@encode(parsedURL)); + NSGetSizeAndAlignment(@encode(parsedURL), &urlAlign, 0); clientsLock = [NSLock new]; } } diff --git a/Source/NSUnarchiver.m b/Source/NSUnarchiver.m index 2cfafc92c..e1ee5d121 100644 --- a/Source/NSUnarchiver.m +++ b/Source/NSUnarchiver.m @@ -26,6 +26,7 @@ */ #import "common.h" +#import #define EXPOSE_NSUnarchiver_IVARS 1 #include #import "Foundation/NSDictionary.h" diff --git a/Source/NSValue.m b/Source/NSValue.m index 0b1a690e9..cc5229f65 100644 --- a/Source/NSValue.m +++ b/Source/NSValue.m @@ -383,6 +383,7 @@ static NSLock *placeholderLock; - (void) encodeWithCoder: (NSCoder *)coder { + NSUInteger tsize; unsigned size; const char *data; const char *objctype = [self objCType]; @@ -420,8 +421,8 @@ static NSLock *placeholderLock; return; } - size = objc_sizeof_type(objctype); - data = (void *)NSZoneMalloc([self zone], size); + NSGetSizeAndAlignment(objctype, 0, &tsize); + data = (void *)NSZoneMalloc([self zone], tsize); [self getValue: (void*)data]; d = [NSMutableData new]; [d serializeDataAt: data ofObjCType: objctype context: nil]; @@ -439,6 +440,7 @@ static NSLock *placeholderLock; const char *objctype; Class c; id o; + NSUInteger tsize; unsigned size; int ver; @@ -562,10 +564,10 @@ static NSLock *placeholderLock; * For performance, decode small values directly onto the stack, * For larger values we allocate and deallocate heap space. */ - size = objc_sizeof_type(objctype); - if (size <= 64) + NSGetSizeAndAlignment(objctype, 0, &tsize); + if (tsize <= 64) { - unsigned char data[size]; + unsigned char data[tsize]; [coder decodeValueOfObjCType: @encode(id) at: &d]; [d deserializeDataAt: data @@ -579,7 +581,7 @@ static NSLock *placeholderLock; { unsigned char *data; - data = (void *)NSZoneMalloc(NSDefaultMallocZone(), size); + data = (void *)NSZoneMalloc(NSDefaultMallocZone(), tsize); [coder decodeValueOfObjCType: @encode(id) at: &d]; [d deserializeDataAt: data ofObjCType: objctype @@ -604,10 +606,10 @@ static NSLock *placeholderLock; * For performance, decode small values directly onto the stack, * For larger values we allocate and deallocate heap space. */ - size = objc_sizeof_type(objctype); - if (size <= 64) + NSGetSizeAndAlignment(objctype, 0, &tsize); + if (tsize <= 64) { - unsigned char data[size]; + unsigned char data[tsize]; [coder decodeValueOfObjCType: @encode(unsigned) at: &size]; { @@ -628,7 +630,7 @@ static NSLock *placeholderLock; { void *data; - data = (void *)NSZoneMalloc(NSDefaultMallocZone(), size); + data = (void *)NSZoneMalloc(NSDefaultMallocZone(), tsize); [coder decodeValueOfObjCType: @encode(unsigned) at: &size]; { void *serialized; diff --git a/Source/cifframe.m b/Source/cifframe.m index ab468c7bf..bd52f3cfa 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -24,6 +24,7 @@ */ #import "common.h" +#import #ifdef HAVE_MALLOC_H #include