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

@ -1,6 +1,26 @@
2011-05-12 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <FredKiefer@gmx.de>
* 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 <rfm@gnu.org>

View file

@ -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

View file

@ -22,6 +22,7 @@
Boston, MA 02111 USA.
*/
#import "common.h"
#import <objc/encoding.h>
#import "Foundation/NSException.h"
#import "Foundation/NSCoder.h"
#import "Foundation/NSDistantObject.h"

View file

@ -23,6 +23,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define EXPOSE_NSInvocation_IVARS 1
#import "Foundation/NSException.h"
#import "Foundation/NSCoder.h"

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];

View file

@ -26,6 +26,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define EXPOSE_NSArchiver_IVARS 1
#define EXPOSE_NSUnarchiver_IVARS 1
/*

View file

@ -27,6 +27,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define EXPOSE_NSCoder_IVARS 1
#import "Foundation/NSData.h"
#import "Foundation/NSCoder.h"

View file

@ -30,6 +30,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define GS_NSConnection_IVARS \
BOOL _isValid; \

View file

@ -68,6 +68,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#import "GNUstepBase/GSObjCRuntime.h"
#import "Foundation/NSByteOrder.h"
#import "Foundation/NSCoder.h"

View file

@ -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

View file

@ -26,6 +26,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#import "Foundation/NSException.h"
#include <string.h>

View file

@ -34,6 +34,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define EXPOSE_NSPortCoder_IVARS 1
#import "Foundation/NSException.h"
#import "Foundation/NSByteOrder.h"

View file

@ -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.<br />
@ -591,7 +591,7 @@ static unsigned urlAlign;
{
if (clientsLock == nil)
{
urlAlign = objc_alignof_type(@encode(parsedURL));
NSGetSizeAndAlignment(@encode(parsedURL), &urlAlign, 0);
clientsLock = [NSLock new];
}
}

View file

@ -26,6 +26,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#define EXPOSE_NSUnarchiver_IVARS 1
#include <string.h>
#import "Foundation/NSDictionary.h"

View file

@ -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;

View file

@ -24,6 +24,7 @@
*/
#import "common.h"
#import <objc/encoding.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>