Revision: 29792
          http://sourceforge.net/p/bibdesk/svn/29792
Author:   hofman
Date:     2025-11-13 18:11:19 +0000 (Thu, 13 Nov 2025)
Log Message:
-----------
Remov support for unkeyed archiving of BibItem, BibAuthor, and DSKLinkedFile, 
we never pass them directly over a DO

Modified Paths:
--------------
    trunk/bibdesk/BDSKColorLabelWell.m
    trunk/bibdesk/BDSKLinkedFile.m
    trunk/bibdesk/BibAuthor.m
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BDSKColorLabelWell.m
===================================================================
--- trunk/bibdesk/BDSKColorLabelWell.m  2025-11-13 17:57:10 UTC (rev 29791)
+++ trunk/bibdesk/BDSKColorLabelWell.m  2025-11-13 18:11:19 UTC (rev 29792)
@@ -130,13 +130,11 @@
 
 - (void)encodeWithCoder:(NSCoder *)aCoder {
     [super encodeWithCoder:aCoder];
-    if ([aCoder allowsKeyedCoding]) {
-        for (NSUInteger i = 0; i < 9; i++)
-            [aCoder encodeConditionalObject:[buttons objectAtIndex:i] 
forKey:[NSString stringWithFormat:@"button%lu", i]];
-        [aCoder encodeBool:suppressSelection forKey:@"suppressSelection"];
-        [aCoder encodeObject:titleCell forKey:@"titleCell"];
-        [aCoder encodeObject:labelCell forKey:@"labelCell"];
-    }
+    for (NSUInteger i = 0; i < 9; i++)
+        [aCoder encodeConditionalObject:[buttons objectAtIndex:i] 
forKey:[NSString stringWithFormat:@"button%lu", i]];
+    [aCoder encodeBool:suppressSelection forKey:@"suppressSelection"];
+    [aCoder encodeObject:titleCell forKey:@"titleCell"];
+    [aCoder encodeObject:labelCell forKey:@"labelCell"];
 }
 
 - (void)sizeToFit {

Modified: trunk/bibdesk/BDSKLinkedFile.m
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.m      2025-11-13 17:57:10 UTC (rev 29791)
+++ trunk/bibdesk/BDSKLinkedFile.m      2025-11-13 18:11:19 UTC (rev 29792)
@@ -93,7 +93,6 @@
     __weak id delegate;
 }
 - (void)updateFileURL;
-- (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath;
 - (NSData *)dataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark;
 @end
 
@@ -378,15 +377,8 @@
         BDSKASSERT_NOT_REACHED("Attempt to decode a BDSKLinkedAliasFile 
instance");
         self = [BDSKConcreteLinkedAliasFileClass alloc];
     }
-    id anAlias = nil;
-    NSString *relPath = nil;
-    if ([coder allowsKeyedCoding]) {
-        anAlias = [coder decodeObjectOfClass:[NSData class] 
forKey:BOOKMARK_KEY] ?: [BDSKAlias aliasWithData:[coder 
decodeObjectOfClass:[NSData class] forKey:ALIASDATA_KEY]];
-        relPath = [coder decodeObjectOfClass:[NSString class] 
forKey:RELATIVEPATH_KEY];
-    } else {
-        anAlias = [BDSKAlias aliasWithData:[coder decodeObject]];
-        relPath = [coder decodeObject];
-    }
+    id anAlias = [coder decodeObjectOfClass:[NSData class] 
forKey:BOOKMARK_KEY] ?: [BDSKAlias aliasWithData:[coder 
decodeObjectOfClass:[NSData class] forKey:ALIASDATA_KEY]];;
+    NSString *relPath = [coder decodeObjectOfClass:[NSString class] 
forKey:RELATIVEPATH_KEY];;
     self = [self initWithAlias:anAlias relativePath:relPath delegate:nil];
     return self;
 }
@@ -394,16 +386,10 @@
 - (void)encodeWithCoder:(NSCoder *)coder {
     // make sure the fileRef is valid
     [self updateFileURL];
-    if ([coder allowsKeyedCoding]) {
-        BOOL isBookmark = NO;
-        NSData *data = [self dataRelativeToPath:[delegate 
basePathForLinkedFile:self] isBookmark:&isBookmark];
-        [coder encodeObject:relativePath forKey:RELATIVEPATH_KEY];
-        [coder encodeObject:data forKey:isBookmark ? BOOKMARK_KEY : 
ALIASDATA_KEY];
-    } else {
-        NSData *data = [self aliasDataRelativeToPath:[delegate 
basePathForLinkedFile:self]];
-        [coder encodeObject:data];
-        [coder encodeObject:relativePath];
-    }
+    BOOL isBookmark = NO;
+    NSData *data = [self dataRelativeToPath:[delegate 
basePathForLinkedFile:self] isBookmark:&isBookmark];
+    [coder encodeObject:relativePath forKey:RELATIVEPATH_KEY];
+    [coder encodeObject:data forKey:isBookmark ? BOOKMARK_KEY : ALIASDATA_KEY];
 }
 
 + (BOOL)supportsSecureCoding { return YES; }
@@ -524,9 +510,6 @@
 }
 
 // implemented by the subclasses
-- (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath { return nil; }
-
-// implemented by the subclasses
 - (NSData *)dataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark { return nil; }
 
 // implemented by the subclasses
@@ -757,25 +740,19 @@
     isInitial = NO;
 }
 
-- (NSData *)aliasDataRelativeToPath:(NSString *)basePath {
+- (NSData *)dataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark {
     BDSKAlias *anAlias = NULL;
-    
     if (fileRef) {
         FSRef baseRef;
-        BOOL hasBaseRef = BDSKPathToFSRef(basePath, &baseRef);
+        BOOL hasBaseRef = BDSKPathToFSRef(newBasePath, &baseRef);
         anAlias = [BDSKAlias aliasWithFSRef:fileRef baseRef:hasBaseRef ? 
&baseRef : NULL];
-    } else if (relativePath && basePath) {
-        NSString *path = [relativePath isAbsolutePath] ? relativePath : 
[[basePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath];
-        anAlias = [BDSKAlias aliasWithPath:path basePath:basePath];
+    } else if (relativePath && newBasePath) {
+        NSString *path = [relativePath isAbsolutePath] ? relativePath : 
[[newBasePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath];
+        anAlias = [BDSKAlias aliasWithPath:path basePath:newBasePath];
     }
     if (anAlias == NULL && [alias isKindOfClass:[BDSKAlias class]])
         anAlias = alias;
-    
-    return [anAlias data];
-}
-
-- (NSData *)dataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark {
-    NSData *data = [self aliasDataRelativeToPath:newBasePath];
+    NSData *data = [anAlias data];
     if (data) {
         *isBookmark = NO;
     } else if ([alias isKindOfClass:[NSData class]]) {
@@ -930,21 +907,6 @@
     isInitial = NO;
 }
 
-- (NSData *)aliasDataRelativeToPath:(NSString *)basePath {
-    BDSKAlias *anAlias = NULL;
-    
-    if (fileURL) {
-        anAlias = [BDSKAlias aliasWithPath:[fileURL path] basePath:basePath];
-    } else if (relativePath && basePath) {
-        NSString *path = [relativePath isAbsolutePath] ? relativePath : 
[[basePath stringByAppendingPathComponent:relativePath] 
stringByStandardizingPath];
-        anAlias = [BDSKAlias aliasWithPath:path basePath:basePath];
-    }
-    if (anAlias != NULL && [alias isKindOfClass:[BDSKAlias class]])
-        anAlias = alias;
-    
-    return [anAlias data];
-}
-
 - (NSData *)dataRelativeToPath:(NSString *)newBasePath isBookmark:(BOOL 
*)isBookmark {
     NSData *data = nil;
     
@@ -1003,21 +965,13 @@
 - (instancetype)initWithCoder:(NSCoder *)coder {
     self = [super init];
     if (self) {
-        if ([coder allowsKeyedCoding]) {
-            URL = [coder decodeObjectOfClass:[NSURL class] forKey:@"URL"];
-        } else {
-            URL = [coder decodeObject];
-        }
+        URL = [coder decodeObjectOfClass:[NSURL class] forKey:@"URL"];
     }
     return self;
 }
 
 - (void)encodeWithCoder:(NSCoder *)coder {
-    if ([coder allowsKeyedCoding]) {
-        [coder encodeObject:URL forKey:@"URL"];
-    } else {
-        [coder encodeObject:URL];
-    }
+    [coder encodeObject:URL forKey:@"URL"];
 }
 
 + (BOOL)supportsSecureCoding { return YES; }

Modified: trunk/bibdesk/BibAuthor.m
===================================================================
--- trunk/bibdesk/BibAuthor.m   2025-11-13 17:57:10 UTC (rev 29791)
+++ trunk/bibdesk/BibAuthor.m   2025-11-13 18:11:19 UTC (rev 29792)
@@ -118,25 +118,19 @@
 }
 
 - (instancetype)initWithCoder:(NSCoder *)coder{
-    if([coder allowsKeyedCoding]){
-        self = [super init];
+    self = [super init];
+    if (self) {
         publication = [coder decodeObjectOfClass:[BibItem class] 
forKey:@"publication"];
         originalName = [coder decodeObjectOfClass:[NSString class] 
forKey:@"name"];
         // this should take care of the rest of the ivars
         [self setupNames];
-    } else {
-        self = [NSKeyedUnarchiver unarchivedObjectOfClass:[BibAuthor class] 
fromData:[coder decodeDataObject] error:NULL];
     }
     return self;
 }
 
 - (void)encodeWithCoder:(NSCoder *)coder{
-    if([coder allowsKeyedCoding]){
-        [coder encodeObject:originalName forKey:@"name"];
-        [coder encodeConditionalObject:publication forKey:@"publication"];
-    } else {
-        [coder encodeDataObject:[NSKeyedArchiver 
archivedDataWithRootObject:self]];
-    }  
+    [coder encodeObject:originalName forKey:@"name"];
+    [coder encodeConditionalObject:publication forKey:@"publication"];
 }
 
 + (BOOL)supportsSecureCoding { return YES; }

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2025-11-13 17:57:10 UTC (rev 29791)
+++ trunk/bibdesk/BibItem.m     2025-11-13 18:11:19 UTC (rev 29792)
@@ -276,49 +276,41 @@
 }
 
 - (instancetype)initWithCoder:(NSCoder *)coder{
-    if([coder allowsKeyedCoding]){
-        if(self = [super init]){
-            pubFields = [[NSMutableDictionary alloc] initWithDictionary:[coder 
decodeObjectOfClasses:[NSSet setWithObjects:[NSDictionary class], [NSString 
class], nil] 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 
decodeObjectOfClasses:[NSSet setWithObjects:[NSArray class], [BDSKLinkedFile 
class], nil] forKey:@"files"]];
-            [files setValue:self forKey:@"delegate"];
-            // set by the document, which we don't archive
-            owner = nil;
-            macroResolver = nil;
-            fileOrder = nil;
-            biFlags.hasBeenEdited = YES;
-            biFlags.hasEditedCiteKey = NO;
-            // we don't bother encoding this
-            biFlags.spotlightMetadataChanged = YES;
-            identifierURL = createUniqueURL();
-            
-            // these are set by updateMetadataForKey:
-            year = 0;
-            month = 0;
-            dateAdded = nil;
-            dateModified = nil;
-            
-            // set the dates based on the fields
-            [self updateMetadataForKey:nil];
-        }
-    } else {
-        self = [NSKeyedUnarchiver unarchivedObjectOfClass:[BibItem class] 
fromData:[coder decodeDataObject] error:NULL];
+    if(self = [super init]){
+        pubFields = [[NSMutableDictionary alloc] initWithDictionary:[coder 
decodeObjectOfClasses:[NSSet setWithObjects:[NSDictionary class], [NSString 
class], nil] 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 
decodeObjectOfClasses:[NSSet setWithObjects:[NSArray class], [BDSKLinkedFile 
class], nil] forKey:@"files"]];
+        [files setValue:self forKey:@"delegate"];
+        // set by the document, which we don't archive
+        owner = nil;
+        macroResolver = nil;
+        fileOrder = nil;
+        biFlags.hasBeenEdited = YES;
+        biFlags.hasEditedCiteKey = NO;
+        // we don't bother encoding this
+        biFlags.spotlightMetadataChanged = YES;
+        identifierURL = createUniqueURL();
+        
+        // these are set by updateMetadataForKey:
+        year = 0;
+        month = 0;
+        dateAdded = nil;
+        dateModified = nil;
+        
+        // set the dates based on the fields
+        [self updateMetadataForKey:nil];
     }
        return self;
 }
 
 - (void)encodeWithCoder:(NSCoder *)coder{
-    if([coder allowsKeyedCoding]){
-        [coder encodeObject:citeKey forKey:@"citeKey"];
-        [coder encodeObject:pubType forKey:@"pubType"];
-        [coder encodeObject:pubFields forKey:@"pubFields"];
-        [coder encodeObject:files forKey:@"files"];
-    } else {
-        [coder encodeDataObject:[NSKeyedArchiver 
archivedDataWithRootObject:self]];
-    }        
+    [coder encodeObject:citeKey forKey:@"citeKey"];
+    [coder encodeObject:pubType forKey:@"pubType"];
+    [coder encodeObject:pubFields forKey:@"pubFields"];
+    [coder encodeObject:files forKey:@"files"];
 }
 
 + (BOOL)supportsSecureCoding { return YES; }

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

Reply via email to