Revision: 28523
          http://sourceforge.net/p/bibdesk/svn/28523
Author:   hofman
Date:     2024-01-03 17:41:17 +0000 (Wed, 03 Jan 2024)
Log Message:
-----------
Remove BDSKCFCallBags files. Define needed functions in fiel where they are 
used. Build call bag callbacks by modifying standard one.

Modified Paths:
--------------
    trunk/bibdesk/BibAuthor.h
    trunk/bibdesk/BibAuthor.m
    trunk/bibdesk/BibDocument_Groups.m
    trunk/bibdesk/BibItem.m
    trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
    trunk/bibdesk/NSSet_BDSKExtensions.m

Removed Paths:
-------------
    trunk/bibdesk/BDSKCFCallBacks.h
    trunk/bibdesk/BDSKCFCallBacks.m

Deleted: trunk/bibdesk/BDSKCFCallBacks.h
===================================================================
--- trunk/bibdesk/BDSKCFCallBacks.h     2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BDSKCFCallBacks.h     2024-01-03 17:41:17 UTC (rev 28523)
@@ -1,52 +0,0 @@
-//
-//  BDSKCFCallBacks.h
-//  Bibdesk
-//
-//  Created by Christiaan Hofman on 2/19/09.
-/*
- This software is Copyright (c) 2009
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-extern const void *BDSKNSObjectRetain(CFAllocatorRef allocator, const void 
*value);
-extern void BDSKNSObjectRelease(CFAllocatorRef allocator, const void *value);
-extern CFStringRef BDSKNSObjectCopyDescription(const void *value);
-
-extern Boolean BDSKCaseInsensitiveStringEqual(const void *value1, const void 
*value2);
-extern CFHashCode BDSKCaseInsensitiveStringHash(const void *value);
-
-#pragma mark CallBacks
-
-extern const CFDictionaryKeyCallBacks 
kBDSKCaseInsensitiveStringDictionaryKeyCallBacks;
-
-extern const CFBagCallBacks kBDSKCaseInsensitiveStringBagCallBacks;

Deleted: trunk/bibdesk/BDSKCFCallBacks.m
===================================================================
--- trunk/bibdesk/BDSKCFCallBacks.m     2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BDSKCFCallBacks.m     2024-01-03 17:41:17 UTC (rev 28523)
@@ -1,69 +0,0 @@
-//
-//  BDSKCFCallBacks.m
-//  Bibdesk
-//
-//  Created by Christiaan Hofman on 2/19/09.
-/*
- This software is Copyright (c) 2009
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "BDSKCFCallBacks.h"
-#import "CFString_BDSKExtensions.h"
-
-const void *BDSKNSObjectRetain(CFAllocatorRef allocator, const void *value) {
-    return CFRetain(value);
-}
-
-void BDSKNSObjectRelease(CFAllocatorRef allocator, const void *value) {
-    CFRelease(value);
-}
-
-CFStringRef BDSKNSObjectCopyDescription(const void *value) {
-    return CFCopyDescription(value);
-}
-
-Boolean BDSKCaseInsensitiveStringEqual(const void *value1, const void *value2) 
{
-    return CFStringCompare(value1, value2, kCFCompareCaseInsensitive) == 
kCFCompareEqualTo;
-}
-
-CFHashCode BDSKCaseInsensitiveStringHash(const void *value) {
-    return BDCaseInsensitiveStringHash(value);
-}
-
-const CFBagCallBacks kBDSKCaseInsensitiveStringBagCallBacks = {
-    0,   // version
-    BDSKNSObjectRetain,
-    BDSKNSObjectRelease,
-    BDSKNSObjectCopyDescription,
-    BDSKCaseInsensitiveStringEqual,
-    BDSKCaseInsensitiveStringHash
-};

Modified: trunk/bibdesk/BibAuthor.h
===================================================================
--- trunk/bibdesk/BibAuthor.h   2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BibAuthor.h   2024-01-03 17:41:17 UTC (rev 28523)
@@ -134,9 +134,6 @@
 @end
 
 
-extern const CFBagCallBacks kBDSKAuthorFuzzyBagCallBacks;
-
-
 @interface NSArray (BibAuthorMultipleCompare)
 - (NSComparisonResult)sortCompareToAuthorArray:(NSArray *)other;
 @end

Modified: trunk/bibdesk/BibAuthor.m
===================================================================
--- trunk/bibdesk/BibAuthor.m   2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BibAuthor.m   2024-01-03 17:41:17 UTC (rev 28523)
@@ -38,7 +38,6 @@
 #import "BibItem.h"
 #import "BDSKStringConstants.h"
 #import "BDSKBibTeXParser.h"
-#import "BDSKCFCallBacks.h"
 #import "NSCharacterSet_BDSKExtensions.h"
 #import "NSString_BDSKExtensions.h"
 #import "CFString_BDSKExtensions.h"
@@ -601,29 +600,6 @@
 
 #pragma mark Specialized collections
 
-// fuzzy equality requires that last names be equal case-insensitively, so 
equal objects are guaranteed the same hash
-CFHashCode BibAuthorFuzzyHash(const void *item)
-{
-    BDSKASSERT([(__bridge id)item isKindOfClass:[BibAuthor class]]);
-    return [(BibAuthor *)item fuzzyHash];
-}
-
-Boolean BibAuthorFuzzyEqual(const void *item1, const void *item2)
-{        
-    BDSKASSERT([(__bridge id)item1 isKindOfClass:[BibAuthor class]] && 
[(__bridge id)item2 isKindOfClass:[BibAuthor class]]);
-    return [(BibAuthor *)item1 fuzzyEqual:(BibAuthor *)item2];
-}
-
-const CFBagCallBacks kBDSKAuthorFuzzyBagCallBacks = {
-    0,    // version
-    BDSKNSObjectRetain,  // retain
-    BDSKNSObjectRelease, // release
-    BDSKNSObjectCopyDescription,
-    BibAuthorFuzzyEqual,
-    BibAuthorFuzzyHash,
-};
-
-
 @implementation NSArray (BibAuthorMultipleCompare)
 
 // Added at request of a user who wants to sort in a journal-style order of 
author/year.  Since our table subsort is only 2 deep, this is the most 
reasonable place to do the comparison for an arbitrary number of authors.  

Modified: trunk/bibdesk/BibDocument_Groups.m
===================================================================
--- trunk/bibdesk/BibDocument_Groups.m  2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BibDocument_Groups.m  2024-01-03 17:41:17 UTC (rev 28523)
@@ -78,7 +78,6 @@
 #import "BDSKSharingClient.h"
 #import "NSColor_BDSKExtensions.h"
 #import "NSView_BDSKExtensions.h"
-#import "BDSKCFCallBacks.h"
 #import "BDSKFileContentSearchController.h"
 #import "NSEvent_BDSKExtensions.h"
 #import "NSSplitView_BDSKExtensions.h"
@@ -95,7 +94,12 @@
 #import "BDSKControlTableCellView.h"
 #import "NSLayoutConstraint_BDSKExtensions.h"
 #import "NSPointerFunctions_BDSKExtensions.h"
+#import "CFString_BDSKExtensions.h"
 
+static Boolean BDSKCaseInsensitiveStringEqual(const void *value1, const void 
*value2);
+static CFHashCode BDSKCaseInsensitiveStringHash(const void *value);
+static CFHashCode BibAuthorFuzzyHash(const void *value);
+static Boolean BibAuthorFuzzyEqual(const void *value1, const void *value2);
 
 @implementation BibDocument (Groups)
 
@@ -464,13 +468,17 @@
     
     NSHashTable *hashTable;
     CFMutableBagRef bag;
+    CFBagCallBacks bagCallBacks = kCFTypeBagCallBacks;
     if(isPersonField) {
         hashTable = [[NSHashTable alloc] 
initWithPointerFunctions:[NSPointerFunctions fuzzyAuthorPointerFunctions] 
capacity:0];
-        bag = CFBagCreateMutable(kCFAllocatorDefault, 0, 
&kBDSKAuthorFuzzyBagCallBacks);
+        bagCallBacks.equal = BDSKCaseInsensitiveStringEqual;
+        bagCallBacks.hash = BDSKCaseInsensitiveStringHash;
     } else {
         hashTable = [[NSHashTable alloc] 
initWithPointerFunctions:[NSPointerFunctions 
caseInsensitiveStringPointerFunctions] capacity:0];
-        bag = CFBagCreateMutable(kCFAllocatorDefault, 0, 
&kBDSKCaseInsensitiveStringBagCallBacks);
+        bagCallBacks.equal = BibAuthorFuzzyEqual;
+        bagCallBacks.hash = BibAuthorFuzzyHash;
     }
+    bag = CFBagCreateMutable(kCFAllocatorDefault, 0, &bagCallBacks);
     
     NSArray *oldGroups = [parent categoryGroups];
     BDSKCategoryGroup *group = [oldGroups firstObject];
@@ -1696,3 +1704,23 @@
 }
 
 @end
+
+static Boolean BDSKCaseInsensitiveStringEqual(const void *value1, const void 
*value2) {
+    return CFStringCompare(value1, value2, kCFCompareCaseInsensitive) == 
kCFCompareEqualTo;
+}
+
+static CFHashCode BDSKCaseInsensitiveStringHash(const void *value) {
+    return BDCaseInsensitiveStringHash(value);
+}
+
+static CFHashCode BibAuthorFuzzyHash(const void *value)
+{
+    BDSKASSERT([(__bridge id)value isKindOfClass:[BibAuthor class]]);
+    return [(BibAuthor *)value fuzzyHash];
+}
+
+static Boolean BibAuthorFuzzyEqual(const void *value1, const void *value2)
+{
+    BDSKASSERT([(__bridge id)value1 isKindOfClass:[BibAuthor class]] && 
[(__bridge id)value2 isKindOfClass:[BibAuthor class]]);
+    return [(BibAuthor *)value1 fuzzyEqual:(BibAuthor *)value2];
+}

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2024-01-03 17:26:44 UTC (rev 28522)
+++ trunk/bibdesk/BibItem.m     2024-01-03 17:41:17 UTC (rev 28523)
@@ -68,7 +68,6 @@
 #import "BDSKMacro.h"
 #import "NSColor_BDSKExtensions.h"
 #import "CFString_BDSKExtensions.h"
-#import "BDSKCFCallBacks.h"
 #import "NSCharacterSet_BDSKExtensions.h"
 #import "NSWorkspace_BDSKExtensions.h"
 #import <SkimNotesBase/SkimNotesBase.h>

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2024-01-03 17:26:44 UTC 
(rev 28522)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2024-01-03 17:41:17 UTC 
(rev 28523)
@@ -158,7 +158,6 @@
                CE2A09C62245997A00A8F31C /* BDSKBooleanValueTransformer.h in 
Headers */ = {isa = PBXBuildFile; fileRef = CEEA4C690B57B0D400434059 /* 
BDSKBooleanValueTransformer.h */; };
                CE2A09C82245997A00A8F31C /* BDSKButtonBar.h in Headers */ = 
{isa = PBXBuildFile; fileRef = CE96DB6F10C7288800F085F3 /* BDSKButtonBar.h */; 
};
                CE2A09C92245997A00A8F31C /* BDSKCategoryGroup.h in Headers */ = 
{isa = PBXBuildFile; fileRef = CEFDBDDB0AEA87F8009EE99D /* BDSKCategoryGroup.h 
*/; };
-               CE2A09CA2245997A00A8F31C /* BDSKCFCallBacks.h in Headers */ = 
{isa = PBXBuildFile; fileRef = CEED2CBB0F4DAD2C0078E87A /* BDSKCFCallBacks.h 
*/; };
                CE2A09CB2245997A00A8F31C /* BDSKCharacterConversion.h in 
Headers */ = {isa = PBXBuildFile; fileRef = 3D866C2608031CEC00FF1724 /* 
BDSKCharacterConversion.h */; };
                CE2A09CC2245997A00A8F31C /* BDSKCitationFormatter.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = CEAB9F570B4FF20800673AC2 /* 
BDSKCitationFormatter.h */; };
                CE2A09CD2245997A00A8F31C /* BDSKCiteKeyFormatter.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = F9022C380758027800C3F701 /* 
BDSKCiteKeyFormatter.h */; };
@@ -751,7 +750,6 @@
                CEEC1A331091F31600530207 /* NSEvent_BDSKExtensions.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CEEC1A311091F31600530207 /* 
NSEvent_BDSKExtensions.m */; };
                CEEC70E2093B6EC200A64F54 /* BDSKDragImageView.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CEEC70E0093B6EC200A64F54 /* BDSKDragImageView.m 
*/; };
                CEEC72F7093BDCA200A64F54 /* BibDesk.sdef in Resources */ = {isa 
= PBXBuildFile; fileRef = F9022FBF07580B9400C3F701 /* BibDesk.sdef */; };
-               CEED2CBE0F4DAD2C0078E87A /* BDSKCFCallBacks.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CEED2CBC0F4DAD2C0078E87A /* BDSKCFCallBacks.m 
*/; };
                CEED2F350F4E0C860078E87A /* BDSKRuntime.m in Sources */ = {isa 
= PBXBuildFile; fileRef = CEED2F330F4E0C860078E87A /* BDSKRuntime.m */; };
                CEED306C0F4ED3410078E87A /* libz.dylib in Frameworks */ = {isa 
= PBXBuildFile; fileRef = CEED306B0F4ED3410078E87A /* libz.dylib */; };
                CEEFDE010B03ED0200668BB0 /* BDSKScriptGroupSheetController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CEEFDDFD0B03ED0200668BB0 /* 
BDSKScriptGroupSheetController.m */; };
@@ -2011,8 +2009,6 @@
                CEEC1A311091F31600530207 /* NSEvent_BDSKExtensions.m */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; 
path = NSEvent_BDSKExtensions.m; sourceTree = "<group>"; };
                CEEC70DF093B6EC200A64F54 /* BDSKDragImageView.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKDragImageView.h; sourceTree = "<group>"; };
                CEEC70E0093B6EC200A64F54 /* BDSKDragImageView.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKDragImageView.m; sourceTree = "<group>"; };
-               CEED2CBB0F4DAD2C0078E87A /* BDSKCFCallBacks.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKCFCallBacks.h; sourceTree = "<group>"; };
-               CEED2CBC0F4DAD2C0078E87A /* BDSKCFCallBacks.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKCFCallBacks.m; sourceTree = "<group>"; };
                CEED2F320F4E0C860078E87A /* BDSKRuntime.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKRuntime.h; sourceTree = "<group>"; };
                CEED2F330F4E0C860078E87A /* BDSKRuntime.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKRuntime.m; sourceTree = "<group>"; };
                CEED306B0F4ED3410078E87A /* libz.dylib */ = {isa = 
PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = 
libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
@@ -2852,7 +2848,6 @@
                        isa = PBXGroup;
                        children = (
                                CE8BE5460D99A10700E314A4 /* BDSKBookmark.m */,
-                               CEED2CBC0F4DAD2C0078E87A /* BDSKCFCallBacks.m 
*/,
                                2730077807CF20B500F2E485 /* BDSKComplexString.m 
*/,
                                CE38FB83091D946900BCB69D /* BDSKCondition.m */,
                                CE0B3B3A1292E1A500BA05EB /* BDSKErrorObject.m 
*/,
@@ -3290,7 +3285,6 @@
                                CE96DB6F10C7288800F085F3 /* BDSKButtonBar.h */,
                                CE1C94EB26A9CE9A00EF17E8 /* 
BDSKCategoryFormatter.h */,
                                CEFDBDDB0AEA87F8009EE99D /* BDSKCategoryGroup.h 
*/,
-                               CEED2CBB0F4DAD2C0078E87A /* BDSKCFCallBacks.h 
*/,
                                3D866C2608031CEC00FF1724 /* 
BDSKCharacterConversion.h */,
                                CEAB9F570B4FF20800673AC2 /* 
BDSKCitationFormatter.h */,
                                F9022C380758027800C3F701 /* 
BDSKCiteKeyFormatter.h */,
@@ -3851,7 +3845,6 @@
                                CEFB268F27E0E262002E50D5 /* BDSKLineTextField.h 
in Headers */,
                                CE2A0ABA22459A4500A8F31C /* BibPref_Export.h in 
Headers */,
                                CE2A0A7222459A0A00A8F31C /* BDSKSharingClient.h 
in Headers */,
-                               CE2A09CA2245997A00A8F31C /* BDSKCFCallBacks.h 
in Headers */,
                                CE2A0A1C224599EF00A8F31C /* BDSKInspireParser.h 
in Headers */,
                                CE2A09F4224599E100A8F31C /* 
BDSKFieldCollection.h in Headers */,
                                CE6759F426A356F0003B1FFA /* BDSKGroupCellView.h 
in Headers */,
@@ -4996,7 +4989,6 @@
                                CEA1A0A426F5054800897A84 /* 
BDSKFilePathTransformer.m in Sources */,
                                CEDBE05A0F4CDAD900190AF5 /* 
NSView_BDSKExtensions.m in Sources */,
                                CE17A30A22CA42D9002B64F8 /* BDSKItemDownload.m 
in Sources */,
-                               CEED2CBE0F4DAD2C0078E87A /* BDSKCFCallBacks.m 
in Sources */,
                                CEED2F350F4E0C860078E87A /* BDSKRuntime.m in 
Sources */,
                                CEC1CEA80F51D2CE00D18921 /* BDSKReadWriteLock.m 
in Sources */,
                                CEF546100F56BDDB008A630F /* 
BDSKStringArrayFormatter.m in Sources */,

Modified: trunk/bibdesk/NSSet_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSSet_BDSKExtensions.m        2024-01-03 17:26:44 UTC (rev 
28522)
+++ trunk/bibdesk/NSSet_BDSKExtensions.m        2024-01-03 17:41:17 UTC (rev 
28523)
@@ -37,7 +37,6 @@
  */
 
 #import "NSSet_BDSKExtensions.h"
-#import "BDSKCFCallBacks.h"
 #import "BDSKTemplateParser.h"
 
 @implementation NSSet (BDSKExtensions)

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