Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ - (void)addRowid:(int64_t)rowid isNew:(BOOL)isNew
{
__unsafe_unretained NSNumber *number = (NSNumber *)columnValue;

CFNumberType numberType = CFNumberGetType((CFNumberRef)number);
CFNumberType numberType = CFNumberGetType((__bridge CFNumberRef)number);

if (numberType == kCFNumberFloat32Type ||
numberType == kCFNumberFloat64Type ||
Expand Down
2 changes: 1 addition & 1 deletion YapDatabase/Internal/NSDictionary+YapDatabase.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ @implementation NSDictionary (YapDatabase)
**/
- (BOOL)ydb_containsKey:(id)key
{
return CFDictionaryContainsKey((CFDictionaryRef)self, (const void *)key);
return CFDictionaryContainsKey((__bridge CFDictionaryRef)self, (__bridge const void *)key);
}

@end
4 changes: 4 additions & 0 deletions YapDatabase/Internal/YapDatabasePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,11 @@ static NSString *const ext_key_class = @"class";

@interface YapDatabaseReadWriteTransaction () {
@public
#if OS_OBJECT_USE_OBJC
NSMutableArray<dispatch_queue_t> *completionQueueStack;
#else
NSMutableArray *completionQueueStack;
#endif
NSMutableArray<dispatch_block_t> *completionBlockStack;

BOOL rollback;
Expand Down
58 changes: 29 additions & 29 deletions YapDatabase/Utilities/YapBidirectionalCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ - (void)setCountLimit:(NSUInteger)newCountLimit
leastRecentCacheItem = leastRecentCacheItem->prev;
leastRecentCacheItem->next = nil;

CFDictionaryRemoveValue(obj_key_dict, (const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)(keyToEvict)); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)(keyToEvict)); // must be second

evictedCacheItem->prev = nil;
evictedCacheItem->next = nil;
Expand All @@ -191,8 +191,8 @@ - (void)setCountLimit:(NSUInteger)newCountLimit
leastRecentCacheItem = leastRecentCacheItem->prev;
leastRecentCacheItem->next = nil;

CFDictionaryRemoveValue(obj_key_dict, (const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)(keyToEvict)); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)(keyToEvict)); // must be second
}

#if YapBidirectionalCache_Enable_Statistics
Expand All @@ -209,7 +209,7 @@ - (id)objectForKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(key_obj_dict, (const void *)key);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(key_obj_dict, (__bridge const void *)key);
if (item)
{
if (item != mostRecentCacheItem)
Expand Down Expand Up @@ -257,7 +257,7 @@ - (BOOL)containsKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

return CFDictionaryContainsKey(key_obj_dict, (const void *)key);
return CFDictionaryContainsKey(key_obj_dict, (__bridge const void *)key);
}

- (id)keyForObject:(id)object
Expand All @@ -266,7 +266,7 @@ - (id)keyForObject:(id)object
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(obj_key_dict, (const void *)object);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(obj_key_dict, (__bridge const void *)object);
if (item)
{
if (item != mostRecentCacheItem)
Expand Down Expand Up @@ -314,7 +314,7 @@ - (BOOL)containsObject:(id)object
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

return CFDictionaryContainsKey(obj_key_dict, (const void *)object);
return CFDictionaryContainsKey(obj_key_dict, (__bridge const void *)object);
}

- (NSUInteger)count
Expand All @@ -329,20 +329,20 @@ - (void)setObject:(id)object forKey:(id)key
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *existingItem = CFDictionaryGetValue(key_obj_dict, (const void *)key);
__unsafe_unretained YapBidirectionalCacheItem *existingItem = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(key_obj_dict, (__bridge const void *)key);
if (existingItem)
{
// Update item value
if (!objCallBacks.equal((__bridge const void *)existingItem->obj, (__bridge const void *)object))
{
CFDictionaryRemoveValue(obj_key_dict, (const void *)existingItem->obj);
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)existingItem->obj);

if (objCallBacks.shouldCopy)
existingItem->obj = [object copy];
else
existingItem->obj = object;

CFDictionarySetValue(obj_key_dict, (const void *)existingItem->obj, (const void *)existingItem);
CFDictionarySetValue(obj_key_dict, (__bridge const void *)existingItem->obj, (__bridge const void *)existingItem);
}

if (existingItem != mostRecentCacheItem)
Expand Down Expand Up @@ -408,8 +408,8 @@ - (void)setObject:(id)object forKey:(id)key

// Add item to dicts

CFDictionarySetValue(key_obj_dict, (const void *)newKey, (const void *)newItem);
CFDictionarySetValue(obj_key_dict, (const void *)newItem->obj, (const void *)newItem);
CFDictionarySetValue(key_obj_dict, (__bridge const void *)newKey, (__bridge const void *)newItem);
CFDictionarySetValue(obj_key_dict, (__bridge const void *)newItem->obj, (__bridge const void *)newItem);

// Add item to beginning of linked-list

Expand All @@ -436,8 +436,8 @@ - (void)setObject:(id)object forKey:(id)key
leastRecentCacheItem = leastRecentCacheItem->prev;
leastRecentCacheItem->next = nil;

CFDictionaryRemoveValue(obj_key_dict, (const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)(keyToEvict)); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)(keyToEvict)); // must be second

evictedCacheItem->prev = nil;
evictedCacheItem->next = nil;
Expand All @@ -449,8 +449,8 @@ - (void)setObject:(id)object forKey:(id)key
leastRecentCacheItem = leastRecentCacheItem->prev;
leastRecentCacheItem->next = nil;

CFDictionaryRemoveValue(obj_key_dict, (const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)(keyToEvict)); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)(objToEvict)); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)(keyToEvict)); // must be second
}

#if YapBidirectionalCache_Enable_Statistics
Expand Down Expand Up @@ -501,7 +501,7 @@ - (void)removeObjectForKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(key_obj_dict, (const void *)key);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(key_obj_dict, (__bridge const void *)key);
if (item)
{
if (item == mostRecentCacheItem)
Expand All @@ -514,8 +514,8 @@ - (void)removeObjectForKey:(id)key
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(obj_key_dict, (const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)item->key); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)item->key); // must be second
}
}

Expand All @@ -527,7 +527,7 @@ - (void)removeObjectsForKeys:(id <NSFastEnumeration>)keys
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(key_obj_dict, (const void *)key);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(key_obj_dict, (__bridge const void *)key);
if (item)
{
if (item == mostRecentCacheItem)
Expand All @@ -540,8 +540,8 @@ - (void)removeObjectsForKeys:(id <NSFastEnumeration>)keys
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(obj_key_dict, (const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)item->key); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)item->key); // must be second
}
}
}
Expand All @@ -552,7 +552,7 @@ - (void)removeKeyForObject:(id)object
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(obj_key_dict, (const void *)object);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(obj_key_dict, (__bridge const void *)object);
if (item)
{
if (item == mostRecentCacheItem)
Expand All @@ -565,8 +565,8 @@ - (void)removeKeyForObject:(id)object
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(obj_key_dict, (const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)item->key); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)item->key); // must be second
}
}

Expand All @@ -578,7 +578,7 @@ - (void)removeKeysForObjects:(id <NSFastEnumeration>)objects
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

__unsafe_unretained YapBidirectionalCacheItem *item = CFDictionaryGetValue(obj_key_dict, (const void *)object);
__unsafe_unretained YapBidirectionalCacheItem *item = (__bridge YapBidirectionalCacheItem *)CFDictionaryGetValue(obj_key_dict, (__bridge const void *)object);
if (item)
{
if (item == mostRecentCacheItem)
Expand All @@ -591,8 +591,8 @@ - (void)removeKeysForObjects:(id <NSFastEnumeration>)objects
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(obj_key_dict, (const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (const void *)item->key); // must be second
CFDictionaryRemoveValue(obj_key_dict, (__bridge const void *)item->obj); // must be first
CFDictionaryRemoveValue(key_obj_dict, (__bridge const void *)item->key); // must be second
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions YapDatabase/Utilities/YapCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ - (void)setCountLimit:(NSUInteger)newCountLimit
leastRecentCacheItem->next = nil;
}

CFDictionaryRemoveValue(cfdict, (const void *)(keyToEvict));
CFDictionaryRemoveValue(cfdict, (__bridge const void *)(keyToEvict));

#if YapCache_Enable_Statistics
evictionCount++;
Expand All @@ -168,7 +168,7 @@ - (id)objectForKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
__unsafe_unretained YapCacheItem *item = (__bridge YapCacheItem *)CFDictionaryGetValue(cfdict, (__bridge const void *)key);
if (item)
{
if (item != mostRecentCacheItem)
Expand Down Expand Up @@ -216,7 +216,7 @@ - (BOOL)containsKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

return CFDictionaryContainsKey(cfdict, (const void *)key);
return CFDictionaryContainsKey(cfdict, (__bridge const void *)key);
}

- (void)setObject:(id)object forKey:(id)key
Expand All @@ -226,7 +226,7 @@ - (void)setObject:(id)object forKey:(id)key
AssertAllowedObjectClass(object, allowedObjectClasses);
#endif

__unsafe_unretained YapCacheItem *existingItem = CFDictionaryGetValue(cfdict, (const void *)key);
__unsafe_unretained YapCacheItem *existingItem = (__bridge YapCacheItem *)CFDictionaryGetValue(cfdict, (__bridge const void *)key);
if (existingItem)
{
// Update item value
Expand Down Expand Up @@ -283,7 +283,7 @@ - (void)setObject:(id)object forKey:(id)key
}

// Add item to set
CFDictionarySetValue(cfdict, (const void *)key, (const void *)newItem);
CFDictionarySetValue(cfdict, (__bridge const void *)key, (__bridge const void *)newItem);

// Add item to beginning of linked-list

Expand Down Expand Up @@ -320,7 +320,7 @@ - (void)setObject:(id)object forKey:(id)key
leastRecentCacheItem->next = nil;
}

CFDictionaryRemoveValue(cfdict, (const void *)(keyToEvict));
CFDictionaryRemoveValue(cfdict, (__bridge const void *)(keyToEvict));

#if YapCache_Enable_Statistics
evictionCount++;
Expand Down Expand Up @@ -373,7 +373,7 @@ - (void)removeObjectForKey:(id)key
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
__unsafe_unretained YapCacheItem *item = (__bridge YapCacheItem *)CFDictionaryGetValue(cfdict, (__bridge const void *)key);
if (item)
{
if (mostRecentCacheItem == item)
Expand All @@ -386,7 +386,7 @@ - (void)removeObjectForKey:(id)key
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(cfdict, (const void *)key);
CFDictionaryRemoveValue(cfdict, (__bridge const void *)key);
}
}

Expand All @@ -398,7 +398,7 @@ - (void)removeObjectsForKeys:(id <NSFastEnumeration>)keys
AssertAllowedKeyClass(key, allowedKeyClasses);
#endif

__unsafe_unretained YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
__unsafe_unretained YapCacheItem *item = (__bridge YapCacheItem *)CFDictionaryGetValue(cfdict, (__bridge const void *)key);
if (item)
{
if (mostRecentCacheItem == item)
Expand All @@ -411,7 +411,7 @@ - (void)removeObjectsForKeys:(id <NSFastEnumeration>)keys
else if (item->next)
item->next->prev = item->prev;

CFDictionaryRemoveValue(cfdict, (const void *)key);
CFDictionaryRemoveValue(cfdict, (__bridge const void *)key);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions YapDatabase/Utilities/YapSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (BOOL)containsObject:(id)object
if (set)
return [set containsObject:object];
else
return CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object);
return CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (__bridge const void *)object);
}

- (BOOL)intersectsSet:(NSSet *)otherSet
Expand All @@ -55,7 +55,7 @@ - (BOOL)intersectsSet:(NSSet *)otherSet
{
for (id object in otherSet)
{
if (CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object))
if (CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (__bridge const void *)object))
return YES;
}

Expand Down
12 changes: 10 additions & 2 deletions YapDatabase/YapDatabaseConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,11 @@ - (void)readWriteWithBlock:(void (NS_NOESCAPE^)(YapDatabaseReadWriteTransaction
NSUInteger count = transaction->completionBlockStack.count;
for (NSUInteger i = 0; i < count; i++)
{
#if OS_OBJECT_USE_OBJC
dispatch_queue_t stackItemQueue = transaction->completionQueueStack[i];
#else
dispatch_queue_t stackItemQueue = (dispatch_queue_t)[transaction->completionQueueStack[i] pointerValue];
#endif
dispatch_block_t stackItemBlock = transaction->completionBlockStack[i];

dispatch_async(stackItemQueue, stackItemBlock);
Expand Down Expand Up @@ -2239,7 +2243,11 @@ - (void)asyncReadWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *trans
NSUInteger count = transaction->completionBlockStack.count;
for (NSUInteger i = 0; i < count; i++)
{
#if OS_OBJECT_USE_OBJC
dispatch_queue_t stackItemQueue = transaction->completionQueueStack[i];
#else
dispatch_queue_t stackItemQueue = [transaction->completionQueueStack[i] pointerValue];
#endif
dispatch_block_t stackItemBlock = transaction->completionBlockStack[i];

dispatch_async(stackItemQueue, stackItemBlock);
Expand Down Expand Up @@ -6034,7 +6042,7 @@ - (NSError *)_backupToPath:(NSString *)backupDatabasePath withStep:(int)nPages p

// Loop through the backup process

BOOL cancelled = progress.cancelled;
BOOL cancelled = progress.isCancelled;
if (!cancelled)
{
while ((status = sqlite3_backup_step(backup, nPages)) == SQLITE_OK)
Expand All @@ -6047,7 +6055,7 @@ - (NSError *)_backupToPath:(NSString *)backupDatabasePath withStep:(int)nPages p
progress.totalUnitCount = pagecount;
progress.completedUnitCount = (pagecount - remaining);

cancelled = progress.cancelled;
cancelled = progress.isCancelled;
if (cancelled) break;
}
}
Expand Down
Loading