mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
* Source/NSString.m (-initWithCoder:): In keyed coding the key
"NS.bytes" may contain either an NSData or an NSString object. Not sure about the encoding, I am using UTF8. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34010 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a6a481bead
commit
e6a75007c0
2 changed files with 31 additions and 11 deletions
|
@ -5036,20 +5036,34 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *string = nil;
|
||||
|
||||
if ([aCoder containsValueForKey: @"NS.string"])
|
||||
{
|
||||
string = (NSString*)[(NSKeyedUnarchiver*)aCoder
|
||||
_decodePropertyListForKey: @"NS.string"];
|
||||
}
|
||||
{
|
||||
NSString *string = nil;
|
||||
|
||||
string = (NSString*)[(NSKeyedUnarchiver*)aCoder
|
||||
_decodePropertyListForKey: @"NS.string"];
|
||||
self = [self initWithString: string];
|
||||
}
|
||||
else if ([aCoder containsValueForKey: @"NS.bytes"])
|
||||
{
|
||||
string = (NSString*)[(NSKeyedUnarchiver*)aCoder
|
||||
decodeObjectForKey: @"NS.bytes"];
|
||||
}
|
||||
id bytes = [(NSKeyedUnarchiver*)aCoder
|
||||
decodeObjectForKey: @"NS.bytes"];
|
||||
|
||||
self = [self initWithString: string];
|
||||
if ([bytes isKindOfClass: NSStringClass])
|
||||
{
|
||||
self = [self initWithString: (NSString*)bytes];
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [self initWithData: (NSData*)bytes
|
||||
encoding: NSUTF8StringEncoding];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// empty string
|
||||
self = [self initWithString: @""];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue