mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fixed coding/decoding autorelease problem.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2949 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ffa804ba28
commit
8b48a4f469
8 changed files with 22 additions and 17 deletions
|
@ -244,7 +244,7 @@ static BOOL debug_coder = NO;
|
|||
references. */
|
||||
id o;
|
||||
[self decodeObjectAt: &o withName: NULL];
|
||||
return o;
|
||||
return [o autorelease];
|
||||
}
|
||||
|
||||
- (unsigned int) systemVersion
|
||||
|
|
|
@ -156,8 +156,8 @@ static id long_day[7] = {@"Sunday",
|
|||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
self = [super initWithCoder: aCoder];
|
||||
calendar_format = [aCoder decodeObject];
|
||||
time_zone = [aCoder decodeObject];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &calendar_format];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &time_zone];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,9 +147,9 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception)
|
|||
- (id)initWithCoder: aDecoder
|
||||
{
|
||||
self = [super initWithCoder:aDecoder];
|
||||
e_name = [[aDecoder decodeObject] retain];
|
||||
e_reason = [[aDecoder decodeObject] retain];
|
||||
e_info = [[aDecoder decodeObject] retain];
|
||||
[aDecoder decodeObjectAt: &e_name];
|
||||
[aDecoder decodeObjectAt: &e_reason];
|
||||
[aDecoder decodeObjectAt: &e_info];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,9 +176,9 @@ NSDictionary *_attributesAtIndexEffectiveRange(
|
|||
- initWithCoder: aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
textChars = [[aCoder decodeObject] retain];
|
||||
attributeArray = [[aCoder decodeObject] retain];
|
||||
locateArray = [[aCoder decodeObject] retain];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &textChars];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &attributeArray];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &locateArray];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -241,9 +241,9 @@ NSDictionary *_attributesAtIndexEffectiveRange(
|
|||
- initWithCoder: aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
textChars = [[aCoder decodeObject] retain];
|
||||
attributeArray = [[aCoder decodeObject] retain];
|
||||
locateArray = [[aCoder decodeObject] retain];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &textChars];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &attributeArray];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &locateArray];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ static NSMutableDictionary *_hostCache = nil;
|
|||
+ (void)initialize
|
||||
{
|
||||
_hostCacheLock = [[NSConditionLock alloc] init];
|
||||
_hostCache = [[NSMutableDictionary dictionary] retain];
|
||||
_hostCache = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
+ (NSHost *)currentHost
|
||||
|
@ -246,7 +246,6 @@ static NSMutableDictionary *_hostCache = nil;
|
|||
[super initWithCoder: aCoder];
|
||||
address = [aCoder decodeObject];
|
||||
addresses = [NSArray arrayWithObject: address];
|
||||
[address release];
|
||||
return self;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <unistd.h>
|
||||
|
@ -52,6 +53,7 @@ NSLog (NSString* format, ...)
|
|||
void
|
||||
NSLogv (NSString* format, va_list args)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSString* prefix;
|
||||
NSString* message;
|
||||
|
||||
|
@ -72,5 +74,6 @@ NSLogv (NSString* format, va_list args)
|
|||
|
||||
prefix = [prefix stringByAppendingString: message];
|
||||
_NSLog_printf_handler (prefix);
|
||||
[arp release];
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
/* This error message should be called only if the private main function
|
||||
* was not executed successfully. This may heppen ONLY if onother library
|
||||
|
@ -138,6 +139,7 @@ static NSMutableArray* _debug_array = nil;
|
|||
static void
|
||||
_gnu_process_args(int argc, char *argv[], char *env[])
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
int i;
|
||||
|
||||
/* Getting the process name */
|
||||
|
@ -187,6 +189,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
[keys release];
|
||||
[values release];
|
||||
}
|
||||
[arp release];
|
||||
}
|
||||
|
||||
/* Place the _gnu_process_args function in the _libc_subinit section so
|
||||
|
|
|
@ -344,7 +344,7 @@ decode (const void *ptr)
|
|||
- initWithDecoder: aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
name = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &name];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ decode (const void *ptr)
|
|||
- initWithCoder: aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
name = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &name];
|
||||
offset = [name intValue];
|
||||
return self;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ decode (const void *ptr)
|
|||
- initWithCoder: aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
abbrev = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &abbrev];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &offset];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_dst];
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue