mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* Source/NSAttributedString.m: Fix keyeded encodgin decoding for
both NSAttributedString and NSMutableAttributedString. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f1d2144948
commit
523ae77842
2 changed files with 63 additions and 34 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-08-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSAttributedString.m: Fix keyeded encodgin decoding for
|
||||
both NSAttributedString and NSMutableAttributedString.
|
||||
|
||||
2009-08-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSData.m: Fix memory leak introduced with GC changes.
|
||||
|
|
|
@ -151,6 +151,18 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: [self string] forKey: @"NSString"];
|
||||
if ([self length] > 0)
|
||||
{
|
||||
NSDictionary* attrs = [self attributesAtIndex: 0 effectiveRange: NULL];
|
||||
|
||||
[aCoder encodeObject: attrs forKey: @"NSAttributes"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRange r = NSMakeRange(0, 0);
|
||||
unsigned index = NSMaxRange(r);
|
||||
|
@ -167,6 +179,7 @@ static Class GSMutableAttributedStringClass;
|
|||
[aCoder encodeObject: attrs];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
|
@ -626,6 +639,15 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *string = [aDecoder decodeObjectForKey: @"NSString"];
|
||||
NSDictionary *attributes = [aDecoder decodeObjectForKey: @"NSAttributes"];
|
||||
|
||||
self = [self initWithString: string attributes: attributes];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *string = [aDecoder decodeObject];
|
||||
unsigned length = [string length];
|
||||
|
@ -663,6 +685,8 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue