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; }