From b5dd8fa3672d939a7a4b6ca6ea4cc4f5a8bacc96 Mon Sep 17 00:00:00 2001 From: ayers Date: Fri, 31 Oct 2003 17:10:45 +0000 Subject: [PATCH] * Source/NSCharacterSet.m ([NSCharacterSet _bitmapForSet:number:]): Insure only instances of NSCharacterSet a stored in the cache but return instances of the receivers class. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18014 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Source/NSCharacterSet.m | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9e3e2634..222face4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-31 David Ayers + + * Source/NSCharacterSet.m + ([NSCharacterSet _bitmapForSet:number:]): Insure only instances of + NSCharacterSet a stored in the cache but return instances of the + receivers class. + 2003-10-30 David Ayers * Headers/Additions/GNUstepBase/GSLock.h: Added missing forward diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index 418b57f8b..401b5709f 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -113,9 +113,14 @@ static NSLock* cache_lock = nil; if (set_path != nil) { NS_DURING - /* Load the character set file */ - set = [self characterSetWithBitmapRepresentation: - [NSData dataWithContentsOfFile: set_path]]; + { + NSData *data; + + /* Load the character set file */ + data = [NSData dataWithContentsOfFile: set_path]; + set = [NSCharacterSet characterSetWithBitmapRepresentation: + data]; + } NS_HANDLER NSLog(@"Unable to read NSCharacterSet file %@", set_path); set = nil; @@ -145,6 +150,14 @@ static NSLock* cache_lock = nil; set = cache_set[number]; [cache_lock unlock]; + + if ([self isSubclassOfClass: [NSCharacterSet class]]) + { + NSData *data; + data = [set bitmapRepresentation]; + set = [self characterSetWithBitmapRepresentation: data]; + } + return set; }