Skip to content

Commit

Permalink
rename PSPDFThreadSafeMutableDictionary
Browse files Browse the repository at this point in the history
to CustomPSPDFThreadSafeMutableDictionary

and completely remove PSPDFThreadSafeMutableDictionary.h

(cordova-sqlite-storage 4.0.0-pre1)
  • Loading branch information
Christopher J. Brody committed Dec 6, 2019
1 parent 6c02011 commit 7290f57
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 48 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changes

#### cordova-sqlite-storage 3.4.2-dev
#### cordova-sqlite-storage 4.0.0-pre1

TBD
- rename PSPDFThreadSafeMutableDictionary to CustomPSPDFThreadSafeMutableDictionary and completely remove PSPDFThreadSafeMutableDictionary.h

#### cordova-sqlite-storage 3.4.1

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-sqlite-storage",
"version": "3.4.2-dev",
"version": "4.0.0-pre1",
"description": "Native interface to SQLite for PhoneGap/Cordova - cordova-sqlite-storage plugin version",
"cordova": {
"id": "cordova-sqlite-storage",
Expand Down
8 changes: 3 additions & 5 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-sqlite-storage"
version="3.4.2-dev">
version="4.0.0-pre1">

<name>Cordova sqlite storage plugin - cordova-sqlite-storage plugin version</name>

Expand Down Expand Up @@ -51,8 +51,7 @@
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />

<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
<source-file src="src/ios/CustomPSPDFThreadSafeMutableDictionary.m"
compiler-flags="-w" />

<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
Expand All @@ -72,8 +71,7 @@
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />

<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
<source-file src="src/ios/CustomPSPDFThreadSafeMutableDictionary.m"
compiler-flags="-w" />

<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//
// PSPDFThreadSafeMutableDictionary.m
// CustomPSPDFThreadSafeMutableDictionary.m
//
// renamed from PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2019-present Christopher J. Brody (aka Chris Brody)
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
Expand All @@ -23,29 +27,31 @@

#import <Foundation/Foundation.h>

/* ** ALREADY INCLUDED BY #import "PSPDFThreadSafeMutableDictionary.h"
// Dictionary-Subclasss whose primitive operations are thread safe.
@interface PSPDFThreadSafeMutableDictionary : NSMutableDictionary
@interface CustomPSPDFThreadSafeMutableDictionary : NSMutableDictionary
@end
// */

// ----------------------------------------------------------------

//
// PSPDFThreadSafeMutableDictionary.m
// CustomPSPDFThreadSafeMutableDictionary.m
//
// renamed from PSPDFThreadSafeMutableDictionary.m
//
// PSPDFKit
//
// Copyright (c) 2013 PSPDFKit GmbH. All rights reserved.
//

#import "PSPDFThreadSafeMutableDictionary.h"
// #import "PSPDFThreadSafeMutableDictionary.h"

#import <libkern/OSAtomic.h>

#define LOCKED(...) OSSpinLockLock(&_lock); \
__VA_ARGS__; \
OSSpinLockUnlock(&_lock);

@implementation PSPDFThreadSafeMutableDictionary {
@implementation CustomPSPDFThreadSafeMutableDictionary {
OSSpinLock _lock;
NSMutableDictionary *_dictionary; // Class Cluster!
}
Expand Down Expand Up @@ -145,8 +151,8 @@ - (void)performLockedWithDictionary:(void (^)(NSDictionary *dictionary))block {
- (BOOL)isEqual:(id)object {
if (object == self) return YES;

if ([object isKindOfClass:PSPDFThreadSafeMutableDictionary.class]) {
PSPDFThreadSafeMutableDictionary *other = object;
if ([object isKindOfClass:CustomPSPDFThreadSafeMutableDictionary.class]) {
CustomPSPDFThreadSafeMutableDictionary *other = object;
__block BOOL isEqual = NO;
[other performLockedWithDictionary:^(NSDictionary *dictionary) {
[self performLockedWithDictionary:^(NSDictionary *otherDictionary) {
Expand Down
28 changes: 0 additions & 28 deletions src/ios/PSPDFThreadSafeMutableDictionary.h

This file was deleted.

11 changes: 8 additions & 3 deletions src/ios/SQLitePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#import "sqlite3.h"

#import "PSPDFThreadSafeMutableDictionary.h"

// Defines Macro to only log lines when in DEBUG mode
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
Expand All @@ -23,6 +21,13 @@
# error "Missing objc_arc feature"
#endif

// CustomPSPDFThreadSafeMutableDictionary interface copied from
// CustomPSPDFThreadSafeMutableDictionary.m:
//
// Dictionary-Subclasss whose primitive operations are thread safe.
@interface CustomPSPDFThreadSafeMutableDictionary : NSMutableDictionary
@end

@implementation SQLitePlugin

@synthesize openDBs;
Expand All @@ -33,7 +38,7 @@ -(void)pluginInitialize
DLog(@"Initializing SQLitePlugin");

{
openDBs = [PSPDFThreadSafeMutableDictionary dictionaryWithCapacity:0];
openDBs = [CustomPSPDFThreadSafeMutableDictionary dictionaryWithCapacity:0];
appDBPaths = [NSMutableDictionary dictionaryWithCapacity:0];

NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
Expand Down

0 comments on commit 7290f57

Please sign in to comment.