mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Cleanup some deprecated code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29730 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bea3004de9
commit
c3a2504688
9 changed files with 182 additions and 212 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2010-02-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSAssertionHandler.m:
|
||||||
|
* Source/NSObject.m:
|
||||||
|
* Source/Additions/NSDebug+GNUstepBase.m:
|
||||||
|
* Source/Additions/GSMime.m:
|
||||||
|
* Source/Additions/NSObject+GNUstepBase.m:
|
||||||
|
* Headers/Foundation/NSObject.h:
|
||||||
|
* Headers/Additions/GNUstepBase/NSObject+GNUstepBase.h:
|
||||||
|
Remove a few old deprecated methods and move others to the
|
||||||
|
additions library.
|
||||||
|
|
||||||
2010-02-23 Riccardo Mottola <rmottola@users.sf.net>
|
2010-02-23 Riccardo Mottola <rmottola@users.sf.net>
|
||||||
|
|
||||||
* Source/ObjectiveC2/runtime.h: provide gcc-style macros
|
* Source/ObjectiveC2/runtime.h: provide gcc-style macros
|
||||||
|
|
|
@ -37,6 +37,38 @@ extern "C" {
|
||||||
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
|
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
|
||||||
|
|
||||||
@interface NSObject (GNUstepBase)
|
@interface NSObject (GNUstepBase)
|
||||||
|
|
||||||
|
/**
|
||||||
|
WARNING: The -compare: method for NSObject is deprecated
|
||||||
|
due to subclasses declaring the same selector with
|
||||||
|
conflicting signatures.
|
||||||
|
Comparision of arbitrary objects is not just meaningless
|
||||||
|
but also dangerous as most concrete implementations
|
||||||
|
expect comparable objects as arguments often accessing
|
||||||
|
instance variables directly.
|
||||||
|
This method will be removed in a future release.
|
||||||
|
*/
|
||||||
|
- (NSComparisonResult) compare: (id)anObject;
|
||||||
|
|
||||||
|
/** For backward compatibility only ... use class_isMetaClass() on the
|
||||||
|
* class of the receiver instead.
|
||||||
|
*/
|
||||||
|
- (BOOL) isInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transmutes the receiver into an immutable version of the same object
|
||||||
|
* and returns the result.<br />
|
||||||
|
* If the receiver is not a mutable object or cannot be simply transmuted,
|
||||||
|
* then this method either returns the receiver unchanged or,
|
||||||
|
* if the force flag is set to YES, returns an autoreleased copy of the
|
||||||
|
* receiver.<br />
|
||||||
|
* Mutable classes should override this default implementation.<br />
|
||||||
|
* This method is used in methods which are declared to return immutable
|
||||||
|
* objects (eg. an NSArray), but which create and build mutable ones
|
||||||
|
* internally.
|
||||||
|
*/
|
||||||
|
- (id) makeImmutableCopyOnFail: (BOOL)force;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message sent when an implementation wants to explicitly exclude a method
|
* Message sent when an implementation wants to explicitly exclude a method
|
||||||
* (but cannot due to compiler constraint), and wants to make sure it is not
|
* (but cannot due to compiler constraint), and wants to make sure it is not
|
||||||
|
@ -61,17 +93,7 @@ extern "C" {
|
||||||
* implementation will not be called, so this is not a perfect mechanism.
|
* implementation will not be called, so this is not a perfect mechanism.
|
||||||
*/
|
*/
|
||||||
- (id) shouldNotImplement: (SEL)aSel;
|
- (id) shouldNotImplement: (SEL)aSel;
|
||||||
/**
|
|
||||||
WARNING: The -compare: method for NSObject is deprecated
|
|
||||||
due to subclasses declaring the same selector with
|
|
||||||
conflicting signatures.
|
|
||||||
Comparision of arbitrary objects is not just meaningless
|
|
||||||
but also dangerous as most concrete implementations
|
|
||||||
expect comparable objects as arguments often accessing
|
|
||||||
instance variables directly.
|
|
||||||
This method will be removed in a future release.
|
|
||||||
*/
|
|
||||||
- (NSComparisonResult) compare: (id)anObject;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* OS_API_VERSION */
|
#endif /* OS_API_VERSION */
|
||||||
|
|
|
@ -365,11 +365,6 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
|
|
||||||
#if GS_API_VERSION(GS_API_NONE, 011700)
|
#if GS_API_VERSION(GS_API_NONE, 011700)
|
||||||
@interface NSObject (GNUstep)
|
@interface NSObject (GNUstep)
|
||||||
- (BOOL) isInstance;
|
|
||||||
- (id) makeImmutableCopyOnFail: (BOOL)force;
|
|
||||||
- (Class) transmuteClassTo: (Class)aClassObject;
|
|
||||||
+ (Class) autoreleaseClass;
|
|
||||||
+ (void) setAutoreleaseClass: (Class)aClass;
|
|
||||||
+ (void) enableDoubleReleaseCheck: (BOOL)enable;
|
+ (void) enableDoubleReleaseCheck: (BOOL)enable;
|
||||||
- (id) read: (TypedStream*)aStream;
|
- (id) read: (TypedStream*)aStream;
|
||||||
- (id) write: (TypedStream*)aStream;
|
- (id) write: (TypedStream*)aStream;
|
||||||
|
|
|
@ -64,13 +64,14 @@ NSString*
|
||||||
GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
|
GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
|
||||||
{
|
{
|
||||||
NSString *message;
|
NSString *message;
|
||||||
Class cls = (Class)obj;
|
Class cls = [obj class];
|
||||||
char c = '+';
|
char c = '-';
|
||||||
|
|
||||||
if ([obj isInstance] == YES)
|
cls = [obj class];
|
||||||
|
if (class_isMetaClass(cls))
|
||||||
{
|
{
|
||||||
c = '-';
|
c = '+';
|
||||||
cls = [obj class];
|
cls = (Class)obj;
|
||||||
}
|
}
|
||||||
message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
|
message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
|
||||||
file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
|
file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
#import "GNUstepBase/GSMime.h"
|
#import "GNUstepBase/GSMime.h"
|
||||||
#import "GNUstepBase/GSXML.h"
|
#import "GNUstepBase/GSXML.h"
|
||||||
#import "GNUstepBase/NSData+GNUstepBase.h"
|
#import "GNUstepBase/NSData+GNUstepBase.h"
|
||||||
|
#import "GNUstepBase/NSDebug+GNUstepBase.h"
|
||||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||||
#import "GNUstepBase/Unicode.h"
|
#import "GNUstepBase/Unicode.h"
|
||||||
|
|
||||||
|
@ -213,7 +214,7 @@ decodeWord(unsigned char *dst, unsigned char *src, unsigned char *end, WE enc)
|
||||||
else if (enc == WE_BASE64)
|
else if (enc == WE_BASE64)
|
||||||
{
|
{
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
unsigned pos = 0;
|
NSUInteger pos = 0;
|
||||||
|
|
||||||
while (*src && (src != end))
|
while (*src && (src != end))
|
||||||
{
|
{
|
||||||
|
@ -265,7 +266,7 @@ decodeWord(unsigned char *dst, unsigned char *src, unsigned char *end, WE enc)
|
||||||
|
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
unsigned i;
|
NSUInteger i;
|
||||||
|
|
||||||
for (i = pos; i < 4; i++)
|
for (i = pos; i < 4; i++)
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
|
@ -358,11 +359,13 @@ wordData(NSString *word)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int len = [charset cStringLength];
|
int len = [charset length];
|
||||||
char buf[len+1];
|
char buf[len+1];
|
||||||
NSMutableData *md;
|
NSMutableData *md;
|
||||||
|
|
||||||
[charset getCString: buf];
|
[charset getCString: buf
|
||||||
|
maxLength: len
|
||||||
|
encoding: NSASCIIStringEncoding];
|
||||||
md = [NSMutableData dataWithCapacity: [d length]*4/3 + len + 8];
|
md = [NSMutableData dataWithCapacity: [d length]*4/3 + len + 8];
|
||||||
d = [documentClass encodeBase64: d];
|
d = [documentClass encodeBase64: d];
|
||||||
[md appendBytes: "=?" length: 2];
|
[md appendBytes: "=?" length: 2];
|
||||||
|
@ -406,7 +409,7 @@ wordData(NSString *word)
|
||||||
length: (NSUInteger)length
|
length: (NSUInteger)length
|
||||||
intoData: (NSMutableData*)dData
|
intoData: (NSMutableData*)dData
|
||||||
{
|
{
|
||||||
unsigned size = [dData length];
|
NSUInteger size = [dData length];
|
||||||
|
|
||||||
[dData setLength: size + length];
|
[dData setLength: size + length];
|
||||||
memcpy([dData mutableBytes] + size, sData, length);
|
memcpy([dData mutableBytes] + size, sData, length);
|
||||||
|
@ -426,7 +429,7 @@ wordData(NSString *word)
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
unsigned pos;
|
NSUInteger pos;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
@implementation GSMimeBase64DecoderContext
|
@implementation GSMimeBase64DecoderContext
|
||||||
|
@ -434,7 +437,7 @@ wordData(NSString *word)
|
||||||
length: (NSUInteger)length
|
length: (NSUInteger)length
|
||||||
intoData: (NSMutableData*)dData
|
intoData: (NSMutableData*)dData
|
||||||
{
|
{
|
||||||
unsigned size = [dData length];
|
NSUInteger size = [dData length];
|
||||||
unsigned char *src = (unsigned char*)sData;
|
unsigned char *src = (unsigned char*)sData;
|
||||||
unsigned char *end = src + length;
|
unsigned char *end = src + length;
|
||||||
unsigned char *beg;
|
unsigned char *beg;
|
||||||
|
@ -507,7 +510,7 @@ wordData(NSString *word)
|
||||||
*/
|
*/
|
||||||
if ([self atEnd] == YES && pos > 0)
|
if ([self atEnd] == YES && pos > 0)
|
||||||
{
|
{
|
||||||
unsigned len = pos - 1;
|
NSUInteger len = pos - 1;
|
||||||
|
|
||||||
while (pos < 4)
|
while (pos < 4)
|
||||||
{
|
{
|
||||||
|
@ -526,7 +529,7 @@ wordData(NSString *word)
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
unsigned pos;
|
NSUInteger pos;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
@implementation GSMimeQuotedDecoderContext
|
@implementation GSMimeQuotedDecoderContext
|
||||||
|
@ -534,7 +537,7 @@ wordData(NSString *word)
|
||||||
length: (NSUInteger)length
|
length: (NSUInteger)length
|
||||||
intoData: (NSMutableData*)dData
|
intoData: (NSMutableData*)dData
|
||||||
{
|
{
|
||||||
unsigned size = [dData length];
|
NSUInteger size = [dData length];
|
||||||
unsigned char *src = (unsigned char*)sData;
|
unsigned char *src = (unsigned char*)sData;
|
||||||
unsigned char *end = src + length;
|
unsigned char *end = src + length;
|
||||||
unsigned char *beg;
|
unsigned char *beg;
|
||||||
|
@ -592,7 +595,7 @@ wordData(NSString *word)
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
unsigned char buf[8];
|
unsigned char buf[8];
|
||||||
unsigned pos;
|
NSUInteger pos;
|
||||||
enum {
|
enum {
|
||||||
ChunkSize, // Reading chunk size
|
ChunkSize, // Reading chunk size
|
||||||
ChunkExt, // Reading chunk extensions
|
ChunkExt, // Reading chunk extensions
|
||||||
|
@ -602,7 +605,7 @@ wordData(NSString *word)
|
||||||
ChunkFoot, // Reading chunk footer after newline
|
ChunkFoot, // Reading chunk footer after newline
|
||||||
ChunkFootA // Reading chunk footer
|
ChunkFootA // Reading chunk footer
|
||||||
} state;
|
} state;
|
||||||
unsigned size; // Size of buffer required.
|
NSUInteger size; // Size of buffer required.
|
||||||
NSMutableData *data;
|
NSMutableData *data;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -853,7 +856,7 @@ wordData(NSString *word)
|
||||||
intoData: (NSMutableData*)dData
|
intoData: (NSMutableData*)dData
|
||||||
withContext: (GSMimeCodingContext*)con
|
withContext: (GSMimeCodingContext*)con
|
||||||
{
|
{
|
||||||
unsigned len = [sData length];
|
NSUInteger len = [sData length];
|
||||||
BOOL result = YES;
|
BOOL result = YES;
|
||||||
|
|
||||||
if (dData == nil || [con isKindOfClass: [GSMimeCodingContext class]] == NO)
|
if (dData == nil || [con isKindOfClass: [GSMimeCodingContext class]] == NO)
|
||||||
|
@ -873,7 +876,7 @@ wordData(NSString *word)
|
||||||
if ([con class] == [GSMimeChunkedDecoderContext class])
|
if ([con class] == [GSMimeChunkedDecoderContext class])
|
||||||
{
|
{
|
||||||
GSMimeChunkedDecoderContext *ctxt;
|
GSMimeChunkedDecoderContext *ctxt;
|
||||||
unsigned size = [dData length];
|
NSUInteger size = [dData length];
|
||||||
unsigned char *beg;
|
unsigned char *beg;
|
||||||
unsigned char *dst;
|
unsigned char *dst;
|
||||||
const char *src;
|
const char *src;
|
||||||
|
@ -922,8 +925,8 @@ wordData(NSString *word)
|
||||||
src++;
|
src++;
|
||||||
if (ctxt->state != ChunkSize)
|
if (ctxt->state != ChunkSize)
|
||||||
{
|
{
|
||||||
unsigned int val = 0;
|
NSUInteger val = 0;
|
||||||
unsigned int index;
|
NSUInteger index;
|
||||||
|
|
||||||
for (index = 0; index < ctxt->pos; index++)
|
for (index = 0; index < ctxt->pos; index++)
|
||||||
{
|
{
|
||||||
|
@ -1315,7 +1318,7 @@ wordData(NSString *word)
|
||||||
{
|
{
|
||||||
NSDictionary *info;
|
NSDictionary *info;
|
||||||
GSMimeHeader *hdr;
|
GSMimeHeader *hdr;
|
||||||
unsigned l = [d length];
|
NSUInteger l = [d length];
|
||||||
|
|
||||||
if (flags.complete == 1 || flags.inBody == 1)
|
if (flags.complete == 1 || flags.inBody == 1)
|
||||||
{
|
{
|
||||||
|
@ -1579,18 +1582,20 @@ wordData(NSString *word)
|
||||||
DESTROY(boundary);
|
DESTROY(boundary);
|
||||||
if (tmp != nil)
|
if (tmp != nil)
|
||||||
{
|
{
|
||||||
unsigned int l = [tmp cStringLength] + 2;
|
NSUInteger l = [tmp length] + 2;
|
||||||
unsigned char *b;
|
unsigned char *b;
|
||||||
|
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
b = NSAllocateCollectable(l + 1, 0);
|
b = NSAllocateCollectable(l + 3, 0);
|
||||||
#else
|
#else
|
||||||
b = NSZoneMalloc(NSDefaultMallocZone(), l + 1);
|
b = NSZoneMalloc(NSDefaultMallocZone(), l + 3);
|
||||||
#endif
|
#endif
|
||||||
b[0] = '-';
|
b[0] = '-';
|
||||||
b[1] = '-';
|
b[1] = '-';
|
||||||
[tmp getCString: (char*)&b[2]];
|
[tmp getCString: (char*)&b[2]
|
||||||
boundary = [[NSData alloc] initWithBytesNoCopy: b length: l];
|
maxLength: l
|
||||||
|
encoding: NSASCIIStringEncoding];
|
||||||
|
boundary = [[NSData alloc] initWithBytesNoCopy: b length: l + 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
type = [info objectForKey: @"Type"];
|
type = [info objectForKey: @"Type"];
|
||||||
|
@ -1740,7 +1745,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
int major;
|
int major;
|
||||||
int minor;
|
int minor;
|
||||||
int status;
|
int status;
|
||||||
unsigned count;
|
NSUInteger count;
|
||||||
NSArray *hdrs;
|
NSArray *hdrs;
|
||||||
|
|
||||||
if ([scanner scanInt: &major] == NO || major < 0)
|
if ([scanner scanInt: &major] == NO || major < 0)
|
||||||
|
@ -1928,7 +1933,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
- (NSString*) scanSpecial: (NSScanner*)scanner
|
- (NSString*) scanSpecial: (NSScanner*)scanner
|
||||||
{
|
{
|
||||||
NSCharacterSet *specials;
|
NSCharacterSet *specials;
|
||||||
unsigned location;
|
NSUInteger location;
|
||||||
unichar c;
|
unichar c;
|
||||||
|
|
||||||
[self scanPastSpace: scanner];
|
[self scanPastSpace: scanner];
|
||||||
|
@ -1973,8 +1978,8 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
if ([scanner scanString: @"\"" intoString: 0] == YES) // Quoted
|
if ([scanner scanString: @"\"" intoString: 0] == YES) // Quoted
|
||||||
{
|
{
|
||||||
NSString *string = [scanner string];
|
NSString *string = [scanner string];
|
||||||
unsigned length = [string length];
|
NSUInteger length = [string length];
|
||||||
unsigned start = [scanner scanLocation];
|
NSUInteger start = [scanner scanLocation];
|
||||||
NSRange r = NSMakeRange(start, length - start);
|
NSRange r = NSMakeRange(start, length - start);
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
|
|
||||||
|
@ -2366,7 +2371,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
*/
|
*/
|
||||||
- (BOOL) _decodeBody: (NSData*)d
|
- (BOOL) _decodeBody: (NSData*)d
|
||||||
{
|
{
|
||||||
unsigned l = [d length];
|
NSUInteger l = [d length];
|
||||||
BOOL needsMore = YES;
|
BOOL needsMore = YES;
|
||||||
|
|
||||||
rawBodyLength += l;
|
rawBodyLength += l;
|
||||||
|
@ -2435,7 +2440,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned dLength = [d length];
|
NSUInteger dLength = [d length];
|
||||||
|
|
||||||
if (expect > 0 && rawBodyLength > expect)
|
if (expect > 0 && rawBodyLength > expect)
|
||||||
{
|
{
|
||||||
|
@ -2551,7 +2556,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int bLength = [boundary length];
|
NSUInteger bLength = [boundary length];
|
||||||
unsigned char *bBytes = (unsigned char*)[boundary bytes];
|
unsigned char *bBytes = (unsigned char*)[boundary bytes];
|
||||||
unsigned char bInit = bBytes[0];
|
unsigned char bInit = bBytes[0];
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
|
@ -2577,7 +2582,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
|| bytes[lineStart-1] == '\n')
|
|| bytes[lineStart-1] == '\n')
|
||||||
{
|
{
|
||||||
BOOL lastPart = NO;
|
BOOL lastPart = NO;
|
||||||
unsigned eol;
|
NSUInteger eol;
|
||||||
|
|
||||||
lineEnd = lineStart + bLength;
|
lineEnd = lineStart + bLength;
|
||||||
eol = lineEnd;
|
eol = lineEnd;
|
||||||
|
@ -2648,7 +2653,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSData *d;
|
NSData *d;
|
||||||
unsigned pos;
|
NSUInteger pos;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Found boundary at the end of a section.
|
* Found boundary at the end of a section.
|
||||||
|
@ -2779,7 +2784,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
}
|
}
|
||||||
if (input < dataEnd || (c == '\n' && lineEnd == lineStart))
|
if (input < dataEnd || (c == '\n' && lineEnd == lineStart))
|
||||||
{
|
{
|
||||||
unsigned length = lineEnd - lineStart;
|
NSUInteger length = lineEnd - lineStart;
|
||||||
|
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
{
|
{
|
||||||
|
@ -2788,7 +2793,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
}
|
}
|
||||||
else if ((c = bytes[input]) != '\r' && c != '\n' && isspace(c))
|
else if ((c = bytes[input]) != '\r' && c != '\n' && isspace(c))
|
||||||
{
|
{
|
||||||
unsigned diff = input - lineEnd;
|
NSUInteger diff = input - lineEnd;
|
||||||
|
|
||||||
bytes[input] = ' ';
|
bytes[input] = ' ';
|
||||||
memmove(&bytes[lineStart + diff], &bytes[lineStart], length);
|
memmove(&bytes[lineStart + diff], &bytes[lineStart], length);
|
||||||
|
@ -2808,7 +2813,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
||||||
{
|
{
|
||||||
if (lineEnd == lineStart)
|
if (lineEnd == lineStart)
|
||||||
{
|
{
|
||||||
unsigned lengthRemaining;
|
NSUInteger lengthRemaining;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overwrite the header data with the body, ready to start
|
* Overwrite the header data with the body, ready to start
|
||||||
|
@ -2926,8 +2931,8 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
+ (NSString*) makeQuoted: (NSString*)v always: (BOOL)flag
|
+ (NSString*) makeQuoted: (NSString*)v always: (BOOL)flag
|
||||||
{
|
{
|
||||||
NSRange r;
|
NSRange r;
|
||||||
unsigned pos = 0;
|
NSUInteger pos = 0;
|
||||||
unsigned l = [v length];
|
NSUInteger l = [v length];
|
||||||
|
|
||||||
r = [v rangeOfCharacterFromSet: nonToken
|
r = [v rangeOfCharacterFromSet: nonToken
|
||||||
options: NSLiteralSearch
|
options: NSLiteralSearch
|
||||||
|
@ -3072,7 +3077,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
NSEnumerator *e;
|
NSEnumerator *e;
|
||||||
NSString *k;
|
NSString *k;
|
||||||
|
|
||||||
m = [value mutableCopy];
|
m = [[value mutableCopy] autorelease];
|
||||||
e = [params keyEnumerator];
|
e = [params keyEnumerator];
|
||||||
while ((k = [e nextObject]) != nil)
|
while ((k = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
|
@ -3084,8 +3089,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
[m appendString: @"="];
|
[m appendString: @"="];
|
||||||
[m appendString: v];
|
[m appendString: v];
|
||||||
}
|
}
|
||||||
k = [m makeImmutableCopyOnFail: YES];
|
return [m makeImmutableCopyOnFail: YES];
|
||||||
return AUTORELEASE(k);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3216,7 +3220,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
[m setObject: [params objectForKey: k] forKey: [k lowercaseString]];
|
[m setObject: [params objectForKey: k] forKey: [k lowercaseString]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [m makeImmutableCopyOnFail: NO];
|
return [m makeImmutableCopyOnFail: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3228,13 +3232,13 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
return [self rawMimeDataPreservingCase: NO];
|
return [self rawMimeDataPreservingCase: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static NSUInteger
|
||||||
appendBytes(NSMutableData *m, unsigned offset, unsigned fold,
|
appendBytes(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
||||||
const char *bytes, unsigned size)
|
const char *bytes, NSUInteger size)
|
||||||
{
|
{
|
||||||
if (offset + size > fold && size + 8 <= fold)
|
if (offset + size > fold && size + 8 <= fold)
|
||||||
{
|
{
|
||||||
unsigned len = [m length];
|
NSUInteger len = [m length];
|
||||||
|
|
||||||
/* This would take the line beyond the folding limit,
|
/* This would take the line beyond the folding limit,
|
||||||
* so we fold at this point.
|
* so we fold at this point.
|
||||||
|
@ -3268,12 +3272,12 @@ appendBytes(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static NSUInteger
|
||||||
appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
||||||
NSString *str, BOOL *ok)
|
NSString *str, BOOL *ok)
|
||||||
{
|
{
|
||||||
unsigned pos = 0;
|
NSUInteger pos = 0;
|
||||||
unsigned size = [str length];
|
NSUInteger size = [str length];
|
||||||
|
|
||||||
*ok = YES;
|
*ok = YES;
|
||||||
while (pos < size)
|
while (pos < size)
|
||||||
|
@ -3348,8 +3352,8 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
NSString *k;
|
NSString *k;
|
||||||
NSString *n;
|
NSString *n;
|
||||||
NSData *d;
|
NSData *d;
|
||||||
unsigned fold = 78; // Maybe pass as a parameter in a later release?
|
NSUInteger fold = 78; // Maybe pass as a parameter in a later release?
|
||||||
unsigned offset = 0;
|
NSUInteger offset = 0;
|
||||||
BOOL conv = YES;
|
BOOL conv = YES;
|
||||||
BOOL ok = YES;
|
BOOL ok = YES;
|
||||||
|
|
||||||
|
@ -3374,9 +3378,9 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned l = [d length];
|
NSUInteger l = [d length];
|
||||||
char buf[l];
|
char buf[l];
|
||||||
unsigned i = 0;
|
NSUInteger i = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Capitalise the header name. However, the version header is a special
|
* Capitalise the header name. However, the version header is a special
|
||||||
|
@ -3524,7 +3528,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
- (void) setParameters: (NSDictionary*)d
|
- (void) setParameters: (NSDictionary*)d
|
||||||
{
|
{
|
||||||
NSMutableDictionary *m = nil;
|
NSMutableDictionary *m = nil;
|
||||||
unsigned c = [d count];
|
NSUInteger c = [d count];
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
|
@ -3604,14 +3608,14 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
*/
|
*/
|
||||||
+ (NSString*) charsetForXml: (NSData*)xml
|
+ (NSString*) charsetForXml: (NSData*)xml
|
||||||
{
|
{
|
||||||
unsigned int length = [xml length];
|
NSUInteger length = [xml length];
|
||||||
const unsigned char *ptr = (const unsigned char*)[xml bytes];
|
const unsigned char *ptr = (const unsigned char*)[xml bytes];
|
||||||
const unsigned char *end = ptr + length;
|
const unsigned char *end = ptr + length;
|
||||||
unsigned int offset = 0;
|
NSUInteger offset = 0;
|
||||||
unsigned int size = 1;
|
NSUInteger size = 1;
|
||||||
unsigned char quote = 0;
|
unsigned char quote = 0;
|
||||||
unsigned char buffer[30];
|
unsigned char buffer[30];
|
||||||
unsigned int buflen = 0;
|
NSUInteger buflen = 0;
|
||||||
BOOL found = NO;
|
BOOL found = NO;
|
||||||
|
|
||||||
if (length < 4)
|
if (length < 4)
|
||||||
|
@ -3785,7 +3789,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
unsigned char *result;
|
unsigned char *result;
|
||||||
unsigned char *dst;
|
unsigned char *dst;
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
unsigned pos = 0;
|
NSUInteger pos = 0;
|
||||||
|
|
||||||
if (source == nil)
|
if (source == nil)
|
||||||
{
|
{
|
||||||
|
@ -3858,7 +3862,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
|
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
unsigned i;
|
NSUInteger i;
|
||||||
|
|
||||||
for (i = pos; i < 4; i++)
|
for (i = pos; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -4352,7 +4356,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
|| [name isEqualToString: @"content-type"] == YES
|
|| [name isEqualToString: @"content-type"] == YES
|
||||||
|| [name isEqualToString: @"subject"] == YES)
|
|| [name isEqualToString: @"subject"] == YES)
|
||||||
{
|
{
|
||||||
unsigned index = [self _indexOfHeaderNamed: name];
|
NSUInteger index = [self _indexOfHeaderNamed: name];
|
||||||
|
|
||||||
if (index != NSNotFound)
|
if (index != NSNotFound)
|
||||||
{
|
{
|
||||||
|
@ -4360,7 +4364,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
}
|
}
|
||||||
else if ([name isEqualToString: @"mime-version"] == YES)
|
else if ([name isEqualToString: @"mime-version"] == YES)
|
||||||
{
|
{
|
||||||
unsigned tmp;
|
NSUInteger tmp;
|
||||||
|
|
||||||
index = [headers count];
|
index = [headers count];
|
||||||
tmp = [self _indexOfHeaderNamed: @"content-disposition"];
|
tmp = [self _indexOfHeaderNamed: @"content-disposition"];
|
||||||
|
@ -4872,7 +4876,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
{
|
{
|
||||||
if ([content isKindOfClass: [NSMutableArray class]] == YES)
|
if ([content isKindOfClass: [NSMutableArray class]] == YES)
|
||||||
{
|
{
|
||||||
unsigned count = [content count];
|
NSUInteger count = [content count];
|
||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -4897,7 +4901,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
*/
|
*/
|
||||||
- (void) deleteHeader: (GSMimeHeader*)aHeader
|
- (void) deleteHeader: (GSMimeHeader*)aHeader
|
||||||
{
|
{
|
||||||
unsigned count = [headers count];
|
NSUInteger count = [headers count];
|
||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -4914,7 +4918,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
*/
|
*/
|
||||||
- (void) deleteHeaderNamed: (NSString*)name
|
- (void) deleteHeaderNamed: (NSString*)name
|
||||||
{
|
{
|
||||||
unsigned count = [headers count];
|
NSUInteger count = [headers count];
|
||||||
|
|
||||||
name = [name lowercaseString];
|
name = [name lowercaseString];
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
|
@ -4960,8 +4964,8 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
*/
|
*/
|
||||||
- (NSArray*) headersNamed: (NSString*)name
|
- (NSArray*) headersNamed: (NSString*)name
|
||||||
{
|
{
|
||||||
unsigned count = [headers count];
|
NSUInteger count = [headers count];
|
||||||
unsigned index;
|
NSUInteger index;
|
||||||
NSMutableArray *array;
|
NSMutableArray *array;
|
||||||
|
|
||||||
name = [GSMimeHeader makeToken: name];
|
name = [GSMimeHeader makeToken: name];
|
||||||
|
@ -5121,8 +5125,8 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
NSData *boundary = 0;
|
NSData *boundary = 0;
|
||||||
BOOL contentIsBinary = NO;
|
BOOL contentIsBinary = NO;
|
||||||
BOOL contentIs7bit = YES;
|
BOOL contentIs7bit = YES;
|
||||||
unsigned int count;
|
NSUInteger count;
|
||||||
unsigned int i;
|
NSUInteger i;
|
||||||
CREATE_AUTORELEASE_POOL(arp);
|
CREATE_AUTORELEASE_POOL(arp);
|
||||||
|
|
||||||
if (isOuter == YES)
|
if (isOuter == YES)
|
||||||
|
@ -5403,10 +5407,10 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
|| [encoding isEqualToString: @"8bit"] == YES)
|
|| [encoding isEqualToString: @"8bit"] == YES)
|
||||||
{
|
{
|
||||||
unsigned char *bytes = (unsigned char*)[d bytes];
|
unsigned char *bytes = (unsigned char*)[d bytes];
|
||||||
unsigned length = [d length];
|
NSUInteger length = [d length];
|
||||||
BOOL hadCarriageReturn = NO;
|
BOOL hadCarriageReturn = NO;
|
||||||
unsigned lineLength = 0;
|
NSUInteger lineLength = 0;
|
||||||
unsigned i;
|
NSUInteger i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
|
@ -5521,8 +5525,8 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
if ([[enc value] isEqualToString: @"base64"] == YES)
|
if ([[enc value] isEqualToString: @"base64"] == YES)
|
||||||
{
|
{
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
unsigned len;
|
NSUInteger len;
|
||||||
unsigned pos = 0;
|
NSUInteger pos = 0;
|
||||||
|
|
||||||
d = [documentClass encodeBase64: d];
|
d = [documentClass encodeBase64: d];
|
||||||
ptr = [d bytes];
|
ptr = [d bytes];
|
||||||
|
@ -5583,7 +5587,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
{
|
{
|
||||||
if (newContent != content)
|
if (newContent != content)
|
||||||
{
|
{
|
||||||
unsigned c = [newContent count];
|
NSUInteger c = [newContent count];
|
||||||
|
|
||||||
while (c-- > 0)
|
while (c-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -5758,7 +5762,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
|
|
||||||
if (name != nil)
|
if (name != nil)
|
||||||
{
|
{
|
||||||
unsigned count = [headers count];
|
NSUInteger count = [headers count];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove any existing headers with this name.
|
* Remove any existing headers with this name.
|
||||||
|
@ -5807,8 +5811,8 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
|
||||||
*/
|
*/
|
||||||
- (NSUInteger) _indexOfHeaderNamed: (NSString*)name
|
- (NSUInteger) _indexOfHeaderNamed: (NSString*)name
|
||||||
{
|
{
|
||||||
unsigned count = [headers count];
|
NSUInteger count = [headers count];
|
||||||
unsigned index;
|
NSUInteger index;
|
||||||
|
|
||||||
for (index = 0; index < count; index++)
|
for (index = 0; index < count; index++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,13 +43,13 @@ NSString*
|
||||||
GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
|
GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
|
||||||
{
|
{
|
||||||
NSString *message;
|
NSString *message;
|
||||||
Class cls = (Class)obj;
|
Class cls = [obj class];
|
||||||
char c = '+';
|
char c = '-';
|
||||||
|
|
||||||
if ([obj isInstance] == YES)
|
if (class_isMetaClass(cls))
|
||||||
{
|
{
|
||||||
c = '-';
|
cls = (Class)obj;
|
||||||
cls = [obj class];
|
c = '+';
|
||||||
}
|
}
|
||||||
message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
|
message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
|
||||||
file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
|
file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
|
||||||
|
|
|
@ -40,9 +40,51 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSComparisonResult) compare: (id)anObject
|
||||||
|
{
|
||||||
|
NSLog(@"WARNING: The -compare: method for NSObject is deprecated.");
|
||||||
|
|
||||||
|
if (anObject == self)
|
||||||
|
{
|
||||||
|
return NSOrderedSame;
|
||||||
|
}
|
||||||
|
if (anObject == nil)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"nil argument for compare:"];
|
||||||
|
}
|
||||||
|
if ([self isEqual: anObject])
|
||||||
|
{
|
||||||
|
return NSOrderedSame;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Ordering objects by their address is pretty useless,
|
||||||
|
* so subclasses should override this is some useful way.
|
||||||
|
*/
|
||||||
|
if ((id)self > anObject)
|
||||||
|
{
|
||||||
|
return NSOrderedDescending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NSOrderedAscending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) isInstance
|
- (BOOL) isInstance
|
||||||
{
|
{
|
||||||
return GSObjCIsInstance(self);
|
GSOnceMLog(@"Warning, the -isInstance method is deprecated. "
|
||||||
|
@"Use 'class_isMetaClass([self class]) ? NO : YES' instead");
|
||||||
|
return class_isMetaClass([self class]) ? NO : YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) makeImmutableCopyOnFail: (BOOL)force
|
||||||
|
{
|
||||||
|
if (force == YES)
|
||||||
|
{
|
||||||
|
return AUTORELEASE([self copy]);
|
||||||
|
}
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) notImplemented: (SEL)aSel
|
- (id) notImplemented: (SEL)aSel
|
||||||
|
@ -77,45 +119,4 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* WARNING: The -compare: method for NSObject is deprecated
|
|
||||||
* due to subclasses declaring the same selector with
|
|
||||||
* conflicting signatures.
|
|
||||||
* Comparison of arbitrary objects is not just meaningless
|
|
||||||
* but also dangerous as most concrete implementations
|
|
||||||
* expect comparable objects as arguments often accessing
|
|
||||||
* instance variables directly.
|
|
||||||
* This method will be removed in a future release.
|
|
||||||
*/
|
|
||||||
- (NSComparisonResult) compare: (id)anObject
|
|
||||||
{
|
|
||||||
NSLog(@"WARNING: The -compare: method for NSObject is deprecated.");
|
|
||||||
|
|
||||||
if (anObject == self)
|
|
||||||
{
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
if (anObject == nil)
|
|
||||||
{
|
|
||||||
[NSException raise: NSInvalidArgumentException
|
|
||||||
format: @"nil argument for compare:"];
|
|
||||||
}
|
|
||||||
if ([self isEqual: anObject])
|
|
||||||
{
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Ordering objects by their address is pretty useless,
|
|
||||||
* so subclasses should override this is some useful way.
|
|
||||||
*/
|
|
||||||
if ((id)self > anObject)
|
|
||||||
{
|
|
||||||
return NSOrderedDescending;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NSOrderedAscending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -124,7 +124,7 @@ static NSString *dict_key = @"NSAssertionHandler";
|
||||||
[NSString
|
[NSString
|
||||||
stringWithFormat: @"%@:%d Assertion failed in %@(%@), method %@. %@",
|
stringWithFormat: @"%@:%d Assertion failed in %@(%@), method %@. %@",
|
||||||
fileName, line, NSStringFromClass([object class]),
|
fileName, line, NSStringFromClass([object class]),
|
||||||
[object isInstance] ? @"instance" : @"class",
|
class_isMetaClass([object class]) ? @"class" : @"instance",
|
||||||
NSStringFromSelector(aSelector), format];
|
NSStringFromSelector(aSelector), format];
|
||||||
NSLogv(message, ap);
|
NSLogv(message, ap);
|
||||||
|
|
||||||
|
|
|
@ -2199,25 +2199,6 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
||||||
*/
|
*/
|
||||||
@implementation NSObject (GNUstep)
|
@implementation NSObject (GNUstep)
|
||||||
|
|
||||||
/* GNU Object class compatibility */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to change the class used for autoreleasing objects.
|
|
||||||
*/
|
|
||||||
+ (void) setAutoreleaseClass: (Class)aClass
|
|
||||||
{
|
|
||||||
autorelease_class = aClass;
|
|
||||||
autorelease_imp = [self instanceMethodForSelector: autorelease_sel];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the class used to autorelease objects.
|
|
||||||
*/
|
|
||||||
+ (Class) autoreleaseClass
|
|
||||||
{
|
|
||||||
return autorelease_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables runtime checking of retain/release/autorelease operations.<br />
|
* Enables runtime checking of retain/release/autorelease operations.<br />
|
||||||
* <p>Whenever either -autorelease or -release is called, the contents of any
|
* <p>Whenever either -autorelease or -release is called, the contents of any
|
||||||
|
@ -2285,12 +2266,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
||||||
|
|
||||||
- (BOOL) isClass
|
- (BOOL) isClass
|
||||||
{
|
{
|
||||||
return GSObjCIsClass((Class)self);
|
return class_isMetaClass(object_getClass(self));
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) isInstance
|
|
||||||
{
|
|
||||||
return GSObjCIsInstance(self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isMemberOfClassNamed: (const char*)aClassName
|
- (BOOL) isMemberOfClassNamed: (const char*)aClassName
|
||||||
|
@ -2323,47 +2299,6 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
||||||
YES));
|
YES));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Transmutes the receiver into an immutable version of the same object
|
|
||||||
* and returns the result.<br />
|
|
||||||
* If the receiver is not a mutable object or cannot be simply transmuted,
|
|
||||||
* then this method either returns the receiver unchanged or,
|
|
||||||
* if the force flag is set to YES, returns an autoreleased copy of the
|
|
||||||
* receiver.<br />
|
|
||||||
* Mutable classes should override this default implementation.<br />
|
|
||||||
* This method is used in methods which are declared to return immutable
|
|
||||||
* objects (eg. an NSArray), but which create and build mutable ones
|
|
||||||
* internally.
|
|
||||||
*/
|
|
||||||
- (id) makeImmutableCopyOnFail: (BOOL)force
|
|
||||||
{
|
|
||||||
if (force == YES)
|
|
||||||
{
|
|
||||||
return AUTORELEASE([self copy]);
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the class of the receiver (the 'isa' pointer) to be aClassObject,
|
|
||||||
* but only if the receiver is an instance of a subclass of aClassObject
|
|
||||||
* which has not added extra instance variables.<br />
|
|
||||||
* Returns zero on failure, or the old class on success.
|
|
||||||
*/
|
|
||||||
- (Class) transmuteClassTo: (Class)aClassObject
|
|
||||||
{
|
|
||||||
if (GSObjCIsInstance(self) == YES)
|
|
||||||
if (class_is_class(aClassObject))
|
|
||||||
if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
|
|
||||||
if ([self isKindOfClass: aClassObject])
|
|
||||||
{
|
|
||||||
Class old_isa = isa;
|
|
||||||
isa = aClassObject;
|
|
||||||
return old_isa;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSInteger) streamVersion: (TypedStream*)aStream
|
+ (NSInteger) streamVersion: (TypedStream*)aStream
|
||||||
{
|
{
|
||||||
#ifndef NeXT_RUNTIME
|
#ifndef NeXT_RUNTIME
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue