Revision: 28624
          http://sourceforge.net/p/bibdesk/svn/28624
Author:   hofman
Date:     2024-01-16 18:51:22 +0000 (Tue, 16 Jan 2024)
Log Message:
-----------
avoid using some CF

Modified Paths:
--------------
    trunk/bibdesk/BDSKBibTeXParser.m
    trunk/bibdesk/BDSKConverter.m
    trunk/bibdesk/BDSKSciFinderParser.m
    trunk/bibdesk/NSAttributedString_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKBibTeXParser.m
===================================================================
--- trunk/bibdesk/BDSKBibTeXParser.m    2024-01-16 18:34:40 UTC (rev 28623)
+++ trunk/bibdesk/BDSKBibTeXParser.m    2024-01-16 18:51:22 UTC (rev 28624)
@@ -812,7 +812,7 @@
     }
     
     // create a fixed-size mutable array, since we've counted the number of 
nodes
-    NSMutableArray *nodes = 
CFBridgingRelease(CFArrayCreateMutable(CFAllocatorGetDefault(), nodeCount, 
&kCFTypeArrayCallBacks));
+    NSMutableArray *nodes = [[NSMutableArray alloc] 
initWithCapacity:nodeCount];
 
        while(simple_value){
         if (simple_value->text){

Modified: trunk/bibdesk/BDSKConverter.m
===================================================================
--- trunk/bibdesk/BDSKConverter.m       2024-01-16 18:34:40 UTC (rev 28623)
+++ trunk/bibdesk/BDSKConverter.m       2024-01-16 18:51:22 UTC (rev 28624)
@@ -214,11 +214,11 @@
         return NO;
     
     // isolate accent
-    NSString *accentChar = 
CFBridgingRelease(CFStringCreateWithSubstring(kCFAllocatorDefault, (__bridge 
CFStringRef)charString, CFRangeMake(1, 1)));
+    NSString *accentChar = [charString substringWithRange:NSMakeRange(1, 1)];
     NSString *accent = [texifyAccents objectForKey:accentChar];
     
     // isolate character
-    NSString *character = 
CFBridgingRelease(CFStringCreateWithSubstring(kCFAllocatorDefault, (__bridge 
CFStringRef)charString, CFRangeMake(0, 1)));
+    NSString *character = [charString substringWithRange:NSMakeRange(0, 1)];
     
     // handle i and j (others as well?)
     if (([character isEqualToString:@"i"] || [character isEqualToString:@"j"]) 
&&
@@ -339,7 +339,7 @@
         // scan up to the closing brace, since we don't know the character 
substring length beforehand
         if (ch == '}') {
 
-            character = 
CFBridgingRelease(CFStringCreateWithSubstring(kCFAllocatorDefault, (__bridge 
CFStringRef)texString, CFRangeMake(letterStart, idx - letterStart)));
+            character = [texString substringWithRange:NSMakeRange(letterStart, 
idx - letterStart)];
             
             // special cases for old style i, j
             if ([character isEqualToString:@"\\i"]) {

Modified: trunk/bibdesk/BDSKSciFinderParser.m
===================================================================
--- trunk/bibdesk/BDSKSciFinderParser.m 2024-01-16 18:34:40 UTC (rev 28623)
+++ trunk/bibdesk/BDSKSciFinderParser.m 2024-01-16 18:51:22 UTC (rev 28624)
@@ -58,10 +58,10 @@
     NSUInteger len = [line length];
     if (r.location != NSNotFound && (r.location + 1) < len) {
         CFAllocatorRef alloc = CFGetAllocator((__bridge CFStringRef)line);
-        *key = CFBridgingRelease(CFStringCreateWithSubstring(alloc, (__bridge 
CFStringRef)line, CFRangeMake(0, r.location)));
+        *key = [line substringWithRange:NSMakeRange(0, r.location)];
         // advance range past the ":"
         r.location += 1;
-        *value = CFBridgingRelease(CFStringCreateWithSubstring(alloc, 
(__bridge CFStringRef)line, CFRangeMake(r.location, len - r.location)));
+        *value = [line substringWithRange:NSMakeRange(r.location, len - 
r.location)];
         
         // just checking length may not be sufficient; some entries have a 
single space past the colon
         if ([*value rangeOfCharacterFromSet:[NSCharacterSet 
alphanumericCharacterSet]].length)

Modified: trunk/bibdesk/NSAttributedString_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSAttributedString_BDSKExtensions.m   2024-01-16 18:34:40 UTC 
(rev 28623)
+++ trunk/bibdesk/NSAttributedString_BDSKExtensions.m   2024-01-16 18:51:22 UTC 
(rev 28624)
@@ -66,7 +66,7 @@
     while( (cmdRange = [mutableString 
rangeOfTeXCommandInRange:searchRange]).location != NSNotFound){
         
         // copy the command
-        texStyle = 
CFBridgingRelease(CFStringCreateWithSubstring(kCFAllocatorDefault, (__bridge 
CFStringRef)mutableString, CFRangeMake(cmdRange.location, cmdRange.length)));
+        texStyle = [mutableString substringWithRange:cmdRange];
         
         // delete the command, now that we know what it was
         [mutableString deleteCharactersInRange:cmdRange];

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