Revision: 26894
          http://sourceforge.net/p/bibdesk/svn/26894
Author:   hofman
Date:     2021-09-15 17:01:33 +0000 (Wed, 15 Sep 2021)
Log Message:
-----------
Revert last commit, the field names are always normalized by the parser

Modified Paths:
--------------
    trunk/bibdesk/BDSKBibTeXParser.m
    trunk/bibdesk/BibItem.m
    trunk/bibdesk/NSSet_BDSKExtensions.h
    trunk/bibdesk/NSSet_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKBibTeXParser.m
===================================================================
--- trunk/bibdesk/BDSKBibTeXParser.m    2021-09-15 16:48:26 UTC (rev 26893)
+++ trunk/bibdesk/BDSKBibTeXParser.m    2021-09-15 17:01:33 UTC (rev 26894)
@@ -1063,7 +1063,7 @@
         
         // Special case handling of abstract & annote is to avoid losing 
newlines in preexisting files.
         // In addition, we need to preserve newlines in file fields for base64 
decoding, instead of replacing with a space.
-        if([fieldName isNoteField] || [fieldName 
hasCaseInsensitivePrefix:@"Bdsk-File-"]){
+        if([fieldName isNoteField] || [fieldName hasPrefix:@"Bdsk-File-"]){
             
             // this is guaranteed to point to a meaningful error if 
copyStringFromNoteField fails
             NSString *errorString = nil;

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2021-09-15 16:48:26 UTC (rev 26893)
+++ trunk/bibdesk/BibItem.m     2021-09-15 17:01:33 UTC (rev 26894)
@@ -4062,19 +4062,6 @@
     }
 }
 
-static BOOL getValueForKey(NSDictionary *dict, NSString **key, NSString 
**value) {
-    *value = [dict objectForKey:*key];
-    if (*value)
-        return YES;
-    NSString *lowerKey = [*key lowercaseString];
-    *value = [dict objectForKey:lowerKey];
-    if (*value) {
-        *key = lowerKey;
-        return YES;
-    }
-    return NO;
-}
-
 - (void)createFilesArray
 {        
     NSUInteger i = 1;
@@ -4084,7 +4071,7 @@
     NSMutableArray *unresolvedFiles = [NSMutableArray new];
     NSMutableArray *unresolvedURLs = [NSMutableArray new];
     
-    while (getValueForKey(pubFields, &key, &value)) {
+    while ((value = [pubFields objectForKey:key]) != nil) {
         BDSKLinkedFile *aFile = [[BDSKLinkedFile alloc] 
initWithBase64String:value delegate:self];
         if (aFile) {
             [files addObject:aFile];
@@ -4104,7 +4091,7 @@
     i = 1;
     key = @"Bdsk-Url-1";
     
-    while (getValueForKey(pubFields, &key, &value)) {
+    while ((value = [pubFields objectForKey:key]) != nil) {
         BDSKLinkedFile *aURL = [[BDSKLinkedFile alloc] 
initWithURLString:value];
         if (aURL) {
             [files addObject:aURL];

Modified: trunk/bibdesk/NSSet_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSSet_BDSKExtensions.h        2021-09-15 16:48:26 UTC (rev 
26893)
+++ trunk/bibdesk/NSSet_BDSKExtensions.h        2021-09-15 17:01:33 UTC (rev 
26894)
@@ -41,6 +41,7 @@
 @interface NSSet (BDSKExtensions)
 
 + (id)setForCaseInsensitiveStringsWithObjects:(id)firstObj, ...;
++ (id)setForCaseInsensitiveStringsWithArray:(NSArray *)array;
 
 - (id)nonEmpty;
 

Modified: trunk/bibdesk/NSSet_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSSet_BDSKExtensions.m        2021-09-15 16:48:26 UTC (rev 
26893)
+++ trunk/bibdesk/NSSet_BDSKExtensions.m        2021-09-15 17:01:33 UTC (rev 
26894)
@@ -61,6 +61,19 @@
     return [returnSet autorelease];
 }
 
++ (id)setForCaseInsensitiveStringsWithArray:(NSArray *)array;
+{
+    CFMutableSetRef set = CFSetCreateMutable(CFAllocatorGetDefault(), 0, 
&kBDSKCaseInsensitiveStringSetCallBacks);
+    
+    for(id object in array)
+        CFSetAddValue(set, (const void *)object);
+    
+    // CFSetCreateCopy uses same callbacks as original set
+    NSSet *returnSet = (NSSet *)CFSetCreateCopy(CFAllocatorGetDefault(), set);
+    CFRelease(set);
+    return [returnSet autorelease];
+}
+
 - (id)nonEmpty {
     NSMutableSet *nonEmptySet = [NSMutableSet set];
     for (id obj in self)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to