Revision: 22242 http://sourceforge.net/p/bibdesk/svn/22242 Author: hofman Date: 2018-05-15 14:55:48 +0000 (Tue, 15 May 2018) Log Message: ----------- use macros for dictionary keys
Modified Paths: -------------- trunk/bibdesk/BDSKLinkedFile.m Modified: trunk/bibdesk/BDSKLinkedFile.m =================================================================== --- trunk/bibdesk/BDSKLinkedFile.m 2018-05-15 14:52:50 UTC (rev 22241) +++ trunk/bibdesk/BDSKLinkedFile.m 2018-05-15 14:55:48 UTC (rev 22242) @@ -46,6 +46,9 @@ // this is the base64 encoding of "bplist", which is always the start of a binary property list #define ENCODED_PLIST_PREFIX @"YnBsaXN0" +#define ALIASDATA_KEY @"aliasData" +#define RELATIVEPATH_KEY @"relativePath" + static void BDSKDisposeAliasHandle(AliasHandle inAlias); static AliasHandle BDSKDataToAliasHandle(CFDataRef inData); static CFDataRef BDSKCopyAliasHandleToData(AliasHandle inAlias); @@ -327,8 +330,8 @@ } [data release]; if ([dictionary respondsToSelector:@selector(objectForKey:)]) { - aliasData = [dictionary objectForKey:@"aliasData"]; - relPath = [dictionary objectForKey:@"relativePath"]; + aliasData = [dictionary objectForKey:ALIASDATA_KEY]; + relPath = [dictionary objectForKey:RELATIVEPATH_KEY]; } } } else { @@ -379,8 +382,8 @@ NSData *data = nil; NSString *relPath = nil; if ([coder allowsKeyedCoding]) { - data = [coder decodeObjectForKey:@"aliasData"]; - relPath = [coder decodeObjectForKey:@"relativePath"]; + data = [coder decodeObjectForKey:ALIASDATA_KEY]; + relPath = [coder decodeObjectForKey:RELATIVEPATH_KEY]; } else { data = [coder decodeObject]; relPath = [coder decodeObject]; @@ -391,8 +394,8 @@ - (void)encodeWithCoder:(NSCoder *)coder { if ([coder allowsKeyedCoding]) { - [coder encodeObject:[self aliasDataRelativeToPath:[delegate basePathForLinkedFile:self]] forKey:@"aliasData"]; - [coder encodeObject:relativePath forKey:@"relativePath"]; + [coder encodeObject:[self aliasDataRelativeToPath:[delegate basePathForLinkedFile:self]] forKey:ALIASDATA_KEY]; + [coder encodeObject:relativePath forKey:RELATIVEPATH_KEY]; } else { [coder encodeObject:[self aliasDataRelativeToPath:[delegate basePathForLinkedFile:self]]]; [coder encodeObject:relativePath]; @@ -586,7 +589,7 @@ path = path && newBasePath ? [path relativePathFromPath:newBasePath] : relativePath; if (path == nil && noAlias) data = [self aliasDataRelativeToPath:newBasePath]; - NSDictionary *dictionary = data ? [NSDictionary dictionaryWithObjectsAndKeys:data, @"aliasData", path, @"relativePath", nil] : [NSDictionary dictionaryWithObjectsAndKeys:path, @"relativePath", nil]; + NSDictionary *dictionary = data ? [NSDictionary dictionaryWithObjectsAndKeys:data, ALIASDATA_KEY, path, RELATIVEPATH_KEY, nil] : [NSDictionary dictionaryWithObjectsAndKeys:path, RELATIVEPATH_KEY, nil]; return [[NSKeyedArchiver archivedDataWithRootObject:dictionary] base64String]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit