Revision: 29786
http://sourceforge.net/p/bibdesk/svn/29786
Author: hofman
Date: 2025-11-12 23:20:10 +0000 (Wed, 12 Nov 2025)
Log Message:
-----------
secure coding for array or dictionary content when available
Modified Paths:
--------------
trunk/bibdesk/BDSKComplexString.m
trunk/bibdesk/BDSKEdgeView.m
trunk/bibdesk/BDSKFileSearchIndex.m
trunk/bibdesk/BDSKFilter.m
trunk/bibdesk/BDSKServerInfo.m
trunk/bibdesk/BDSKTreeNode.m
trunk/bibdesk/BibItem.m
Modified: trunk/bibdesk/BDSKComplexString.m
===================================================================
--- trunk/bibdesk/BDSKComplexString.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKComplexString.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -367,7 +367,10 @@
self = [super init];
if (self) {
BDSKASSERT([coder isKindOfClass:[NSKeyedUnarchiver class]]);
- nodes = [coder decodeObjectOfClass:[NSArray class]
forKey:@"nodes"];
+ if (@available(macOS 11.0, *))
+ nodes = [coder decodeArrayOfObjectsOfClass:[BDSKStringNode
class] forKey:@"nodes"];
+ else
+ nodes = [coder decodeObjectOfClass:[NSArray class]
forKey:@"nodes"];
isComplex = [coder decodeBoolForKey:@"complex"];
isInherited = [coder decodeBoolForKey:@"inherited"];
macroResolver = [[self class] macroResolverForUnarchiving];
Modified: trunk/bibdesk/BDSKEdgeView.m
===================================================================
--- trunk/bibdesk/BDSKEdgeView.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKEdgeView.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -98,9 +98,15 @@
// this decodes only the reference, the actual view should already be
decoded as a subview
contentView = [decoder decodeObjectOfClass:[NSView class]
forKey:@"contentView"];
wantsSubviews = NO;
- edgeColors = [[decoder decodeObjectOfClass:[NSArray class]
forKey:@"edgeColors"] mutableCopy];
+ if (@available(macOS 11.0, *))
+ edgeColors = [[decoder decodeArrayOfObjectsOfClass:[NSColor class]
forKey:@"edgeColors"] mutableCopy];
+ else
+ edgeColors = [[decoder decodeObjectOfClass:[NSArray class]
forKey:@"edgeColors"] mutableCopy];
edges = [decoder decodeIntegerForKey:@"edges"];
- backgroundColors = [decoder decodeObjectOfClass:[NSArray class]
forKey:@"backgroundColors"];
+ if (@available(macOS 11.0, *))
+ backgroundColors = [decoder decodeArrayOfObjectsOfClass:[NSColor
class] forKey:@"v"];
+ else
+ backgroundColors = [decoder decodeObjectOfClass:[NSArray class]
forKey:@"backgroundColors"];
backgroundView = [decoder decodeObjectOfClass:[NSView class]
forKey:@"backgroundView"];
if (@available(macOS 10.14, *))
reflectViewEnabled = YES;
Modified: trunk/bibdesk/BDSKFileSearchIndex.m
===================================================================
--- trunk/bibdesk/BDSKFileSearchIndex.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKFileSearchIndex.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -500,7 +500,10 @@
if (indexData != NULL) {
tmpIndex = SKIndexOpenWithMutableData((__bridge
CFMutableDataRef)indexData, NULL);
if (tmpIndex) {
- [signatures setDictionary:[unarchiver
decodeObjectOfClass:[NSDictionary class] forKey:@"signatures"]];
+ if (@available(macOS 11.0, *))
+ [signatures setDictionary:[unarchiver
decodeDictionaryWithKeysOfClasses:[NSSet setWithObject:[NSString class]]
objectsOfClasses:[NSSet setWithObjects:[NSData class], [NSDate class], nil]
forKey:@"signatures"]];
+ else
+ [signatures setDictionary:[unarchiver
decodeObjectOfClass:[NSDictionary class] forKey:@"signatures"]];
} else {
indexData = nil;
}
Modified: trunk/bibdesk/BDSKFilter.m
===================================================================
--- trunk/bibdesk/BDSKFilter.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKFilter.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -84,7 +84,10 @@
- (instancetype)initWithCoder:(NSCoder *)decoder {
self = [super init];
if (self) {
- conditions = [[NSMutableArray alloc] initWithArray:[decoder
decodeObjectOfClass:[NSArray class] forKey:@"conditions"]];
+ if (@available(macOS 11.0, *))
+ conditions = [[NSMutableArray alloc] initWithArray:[decoder
decodeArrayOfObjectsOfClass:[BDSKCondition class] forKey:@"conditions"]];
+ else
+ conditions = [[NSMutableArray alloc] initWithArray:[decoder
decodeObjectOfClass:[NSArray class] forKey:@"conditions"]];
conjunction = [decoder decodeIntegerForKey:@"conjunction"];
group = nil;
}
Modified: trunk/bibdesk/BDSKServerInfo.m
===================================================================
--- trunk/bibdesk/BDSKServerInfo.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKServerInfo.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -156,7 +156,10 @@
if ([self isEntrez] || [self isISI] || [self isDBLP]) {
host = nil;
port = nil;
- options = [[decoder decodeObjectOfClass:[NSDictionary class]
forKey:OPTIONS_KEY] mutableCopy];
+ if (@available(macOS 11.0, *))
+ options = [[decoder decodeDictionaryWithKeysOfClass:[NSString
class] objectsOfClass:[NSString class] forKey:OPTIONS_KEY] mutableCopy];
+ else
+ options = [[decoder decodeObjectOfClass:[NSDictionary class]
forKey:OPTIONS_KEY] mutableCopy];
if ([options count] == 0)
options = nil;
password = [[options objectForKey:PASSWORD_KEY] copy];
@@ -164,7 +167,10 @@
} else if ([self isZoom] || [self isSRU]) {
host = [decoder decodeObjectOfClass:[NSString class]
forKey:HOST_KEY];
port = [decoder decodeObjectOfClass:[NSString class]
forKey:PORT_KEY];
- options = [[decoder decodeObjectOfClass:[NSDictionary class]
forKey:OPTIONS_KEY] mutableCopy];
+ if (@available(macOS 11.0, *))
+ options = [[decoder decodeDictionaryWithKeysOfClass:[NSString
class] objectsOfClass:[NSString class] forKey:OPTIONS_KEY] mutableCopy];
+ else
+ options = [[decoder decodeObjectOfClass:[NSDictionary class]
forKey:OPTIONS_KEY] mutableCopy];
password = [[options objectForKey:PASSWORD_KEY] copy];
[options removeObjectForKey:PASSWORD_KEY];
} else {
Modified: trunk/bibdesk/BDSKTreeNode.m
===================================================================
--- trunk/bibdesk/BDSKTreeNode.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BDSKTreeNode.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -68,8 +68,14 @@
- (instancetype)initWithCoder:(NSCoder *)coder;
{
if(self = [super init]){
- children = [[NSMutableArray alloc] initWithArray:[coder
decodeObjectOfClass:[NSArray class] forKey:@"children"]];
- columnValues = [[NSMutableDictionary alloc] initWithDictionary:[coder
decodeObjectOfClass:[NSDictionary class] forKey:@"columnValues"]];
+ if (@available(macOS 11.0, *))
+ children = [[NSMutableArray alloc] initWithArray:[coder
decodeArrayOfObjectsOfClass:[BDSKTreeNode class] forKey:@"children"]];
+ else
+ children = [[NSMutableArray alloc] initWithArray:[coder
decodeObjectOfClass:[NSArray class] forKey:@"children"]];
+ if (@available(macOS 11.0, *))
+ columnValues = [[NSMutableDictionary alloc]
initWithDictionary:[coder decodeDictionaryWithKeysOfClasses:[NSSet
setWithObject:[NSString class]] objectsOfClasses:[NSSet setWithObject:[NSObject
class]] forKey:@"columnValues"]];
+ else
+ columnValues = [[NSMutableDictionary alloc]
initWithDictionary:[coder decodeObjectOfClass:[NSDictionary class]
forKey:@"columnValues"]];
parent = [coder decodeObjectOfClass:[BDSKTreeNode class]
forKey:@"parent"];
}
return self;
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2025-11-12 22:56:28 UTC (rev 29785)
+++ trunk/bibdesk/BibItem.m 2025-11-12 23:20:10 UTC (rev 29786)
@@ -278,12 +278,18 @@
- (instancetype)initWithCoder:(NSCoder *)coder{
if([coder allowsKeyedCoding]){
if(self = [super init]){
- pubFields = [[NSMutableDictionary alloc] initWithDictionary:[coder
decodeObjectOfClass:[NSDictionary class] forKey:@"pubFields"]];
+ if (@available(macOS 11.0, *))
+ pubFields = [[NSMutableDictionary alloc]
initWithDictionary:[coder decodeDictionaryWithKeysOfClass:[NSString class]
objectsOfClass:[NSString class] forKey:@"pubFields"]];
+ else
+ pubFields = [[NSMutableDictionary alloc]
initWithDictionary:[coder decodeObjectOfClass:[NSDictionary class]
forKey:@"pubFields"]];
[self setCiteKeyString:[coder decodeObjectOfClass:[NSString class]
forKey:@"citeKey"]];
[self setPubTypeString:[coder decodeObjectOfClass:[NSString class]
forKey:@"pubType"]];
groups = [[NSMutableDictionary alloc] initWithCapacity:5];
URLs = [[NSMutableDictionary alloc] initWithCapacity:5];
- files = [[NSMutableArray alloc] initWithArray:[coder
decodeObjectOfClass:[NSArray class] forKey:@"files"]];
+ if (@available(macOS 11.0, *))
+ files = [[NSMutableArray alloc] initWithArray:[coder
decodeArrayOfObjectsOfClass:[BDSKLinkedFile class] forKey:@"files"]];
+ else
+ files = [[NSMutableArray alloc] initWithArray:[coder
decodeObjectOfClass:[NSArray class] forKey:@"files"]];
[files setValue:self forKey:@"delegate"];
// set by the document, which we don't archive
owner = nil;
@@ -504,7 +510,12 @@
[NSString setMacroResolverForUnarchiving:aMacroResolver];
- NSArray *pubs = [unarchiver decodeObjectOfClass:[NSArray class]
forKey:@"publications"];
+ NSArray *pubs;
+ if (@available(macOS 11.0, *))
+ pubs = [unarchiver decodeArrayOfObjectsOfClass:[BibItem class]
forKey:@"publications"];
+ else
+ pubs = [unarchiver decodeObjectOfClass:[NSArray class]
forKey:@"publications"];
+
[unarchiver finishDecoding];
[NSString setMacroResolverForUnarchiving:nil];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit