From 9702ff05b1973dac06ab740fadbaf4b9b7dce91c Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Wed, 14 Feb 2018 12:02:05 -0500 Subject: [PATCH 1/2] Fixes warnings in iOS SDK --- .../PFDefaultACLController.m | 32 ++-- .../URLSession/PFURLSessionCommandRunner.m | 8 +- .../URLSession/Session/PFURLSession.m | 18 +- .../PFURLSessionUploadTaskDelegate.m | 4 +- .../Internal/Commands/PFRESTPushCommand.h | 6 +- .../Config/Controller/PFConfigController.m | 6 +- .../Controller/PFCurrentConfigController.m | 14 +- .../File/Controller/PFFileController.m | 30 ++-- .../PFCurrentInstallationController.m | 22 +-- .../Internal/KeyValueCache/PFKeyValueCache.m | 2 +- .../LocalDataStore/SQLite/PFSQLiteDatabase.m | 8 +- .../SQLite/PFSQLiteDatabaseResult.m | 2 +- .../LocalDataStore/SQLite/PFSQLiteStatement.m | 10 +- .../MultiProcessLock/PFMultiProcessFileLock.m | 14 +- .../PFMultiProcessFileLockController.m | 18 +- .../PinningStore/PFPinningObjectStore.m | 4 +- .../Object/Subclassing/PFObjectSubclassInfo.m | 4 +- .../PFObjectSubclassingController.m | 10 +- Parse/Parse/Internal/PFAsyncTaskQueue.m | 4 +- Parse/Parse/Internal/PFCoreManager.m | 154 +++++++++--------- Parse/Parse/Internal/PFDateFormatter.m | 22 +-- Parse/Parse/Internal/PFEventuallyQueue.m | 26 +-- .../Parse/Internal/PFPinningEventuallyQueue.m | 54 +++--- Parse/Parse/Internal/PFReachability.m | 28 ++-- Parse/Parse/Internal/ParseManager.m | 104 ++++++------ .../Group/PFUserDefaultsPersistenceGroup.m | 16 +- .../Persistence/PFPersistenceController.m | 12 +- .../Controller/PFPurchaseController.m | 6 +- .../Internal/Push/Manager/PFPushManager.m | 16 +- .../Controller/PFOfflineQueryController.m | 6 +- .../PFUserAuthenticationController.m | 6 +- .../PFCurrentUserController.m | 34 ++-- Parse/Parse/PFFile.m | 16 +- .../Parse/PFNetworkActivityIndicatorManager.m | 8 +- Parse/Parse/PFObject.m | 28 ++-- Parse/Parse/PFQuery.m | 14 +- Parse/Parse/PFUser.m | 12 +- Vendor/xctoolchain | 2 +- 38 files changed, 390 insertions(+), 390 deletions(-) diff --git a/Parse/Parse/Internal/ACL/DefaultACLController/PFDefaultACLController.m b/Parse/Parse/Internal/ACL/DefaultACLController/PFDefaultACLController.m index a796134ff..0786c2216 100644 --- a/Parse/Parse/Internal/ACL/DefaultACLController/PFDefaultACLController.m +++ b/Parse/Parse/Internal/ACL/DefaultACLController/PFDefaultACLController.m @@ -49,40 +49,40 @@ + (instancetype)controllerWithDataSource:(id)da - (BFTask *)getDefaultACLAsync { return [_taskQueue enqueue:^id(BFTask *task) { - if (!_defaultACL || !_useCurrentUser) { - return _defaultACL; + if (!self->_defaultACL || !self->_useCurrentUser) { + return self->_defaultACL; } PFCurrentUserController *currentUserController = self.dataSource.currentUserController; return [[currentUserController getCurrentObjectAsync] continueWithBlock:^id(BFTask *task) { PFUser *currentUser = task.result; if (!currentUser) { - return _defaultACL; + return self->_defaultACL; } - if (currentUser != _lastCurrentUser) { - _defaultACLWithCurrentUser = [_defaultACL createUnsharedCopy]; - [_defaultACLWithCurrentUser setShared:YES]; - [_defaultACLWithCurrentUser setReadAccess:YES forUser:currentUser]; - [_defaultACLWithCurrentUser setWriteAccess:YES forUser:currentUser]; - _lastCurrentUser = currentUser; + if (currentUser != self->_lastCurrentUser) { + self->_defaultACLWithCurrentUser = [self->_defaultACL createUnsharedCopy]; + [self->_defaultACLWithCurrentUser setShared:YES]; + [self->_defaultACLWithCurrentUser setReadAccess:YES forUser:currentUser]; + [self->_defaultACLWithCurrentUser setWriteAccess:YES forUser:currentUser]; + self->_lastCurrentUser = currentUser; } - return _defaultACLWithCurrentUser; + return self->_defaultACLWithCurrentUser; }]; }]; } - (BFTask *)setDefaultACLAsync:(PFACL *)acl withCurrentUserAccess:(BOOL)accessForCurrentUser { return [_taskQueue enqueue:^id(BFTask *task) { - _defaultACLWithCurrentUser = nil; - _lastCurrentUser = nil; + self->_defaultACLWithCurrentUser = nil; + self->_lastCurrentUser = nil; - _defaultACL = [acl createUnsharedCopy]; - [_defaultACL setShared:YES]; + self->_defaultACL = [acl createUnsharedCopy]; + [self->_defaultACL setShared:YES]; - _useCurrentUser = accessForCurrentUser; + self->_useCurrentUser = accessForCurrentUser; - return _defaultACL; + return self->_defaultACL; }]; } diff --git a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/PFURLSessionCommandRunner.m b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/PFURLSessionCommandRunner.m index 9e33dce3f..c26e79a0e 100644 --- a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/PFURLSessionCommandRunner.m +++ b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/PFURLSessionCommandRunner.m @@ -152,7 +152,7 @@ - (void)dealloc { BOOL success = [command resolveLocalIds:&error]; PFPreconditionReturnFailedTask(success, error); return [[self.requestConstructor getDataURLRequestAsyncForCommand:command] continueWithSuccessBlock:^id(BFTask *task) { - return [_session performDataURLRequestAsync:task.result forCommand:command cancellationToken:cancellationToken]; + return [self->_session performDataURLRequestAsync:task.result forCommand:command cancellationToken:cancellationToken]; }]; } withOptions:options cancellationToken:cancellationToken]; } @@ -177,7 +177,7 @@ - (void)dealloc { return [[self.requestConstructor getFileUploadURLRequestAsyncForCommand:command withContentType:contentType contentSourceFilePath:sourceFilePath] continueWithSuccessBlock:^id(BFTask *task) { - return [_session performFileUploadURLRequestAsync:task.result + return [self->_session performFileUploadURLRequestAsync:task.result forCommand:command withContentSourceFilePath:sourceFilePath cancellationToken:cancellationToken @@ -192,7 +192,7 @@ - (void)dealloc { progressBlock:(nullable PFProgressBlock)progressBlock { return [self _performCommandRunningBlock:^id { NSURLRequest *request = [NSURLRequest requestWithURL:url]; - return [_session performFileDownloadURLRequestAsync:request + return [self->_session performFileDownloadURLRequestAsync:request toFileAtPath:filePath withCancellationToken:cancellationToken progressBlock:progressBlock]; @@ -241,7 +241,7 @@ - (BFTask *)_performCommandRunningBlock:(nonnull id (^)(void))block if ([task.error.userInfo[@"temporary"] boolValue] && attempts > 1) { PFLogError(PFLoggingTagCommon, @"Network connection failed. Making attempt %lu after sleeping for %f seconds.", - (unsigned long)(_retryAttempts - attempts + 1), (double)delay); + (unsigned long)(self->_retryAttempts - attempts + 1), (double)delay); return [[BFTask taskWithDelay:(int)(delay * 1000)] continueWithBlock:^id(BFTask *task) { return [self _performCommandRunningBlock:block diff --git a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m index 5c5fe8824..251eb83fc 100644 --- a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m +++ b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m @@ -99,8 +99,8 @@ - (BFTask *)performDataURLRequestAsync:(NSURLRequest *)request } __block NSURLSessionDataTask *task = nil; - dispatch_sync(_sessionTaskQueue, ^{ - task = [_urlSession dataTaskWithRequest:request]; + dispatch_sync(self->_sessionTaskQueue, ^{ + task = [self->_urlSession dataTaskWithRequest:request]; }); PFURLSessionDataTaskDelegate *delegate = [PFURLSessionJSONDataTaskDelegate taskDelegateForDataTask:task withCancellationToken:cancellationToken]; @@ -125,8 +125,8 @@ - (BFTask *)performFileUploadURLRequestAsync:(NSURLRequest *)request } __block NSURLSessionDataTask *task = nil; - dispatch_sync(_sessionTaskQueue, ^{ - task = [_urlSession uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:sourceFilePath]]; + dispatch_sync(self->_sessionTaskQueue, ^{ + task = [self->_urlSession uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:sourceFilePath]]; }); PFURLSessionUploadTaskDelegate *delegate = [PFURLSessionUploadTaskDelegate taskDelegateForDataTask:task withCancellationToken:cancellationToken @@ -151,8 +151,8 @@ - (BFTask *)performFileDownloadURLRequestAsync:(NSURLRequest *)request } __block NSURLSessionDataTask *task = nil; - dispatch_sync(_sessionTaskQueue, ^{ - task = [_urlSession dataTaskWithRequest:request]; + dispatch_sync(self->_sessionTaskQueue, ^{ + task = [self->_urlSession dataTaskWithRequest:request]; }); PFURLSessionFileDownloadTaskDelegate *delegate = [PFURLSessionFileDownloadTaskDelegate taskDelegateForDataTask:task withCancellationToken:cancellationToken @@ -194,20 +194,20 @@ - (BFTask *)_performDataTask:(NSURLSessionDataTask *)dataTask withDelegate:(PFUR - (PFURLSessionDataTaskDelegate *)_taskDelegateForTask:(NSURLSessionTask *)task { __block PFURLSessionDataTaskDelegate *delegate = nil; dispatch_sync(_delegatesAccessQueue, ^{ - delegate = _delegatesDictionary[@(task.taskIdentifier)]; + delegate = self->_delegatesDictionary[@(task.taskIdentifier)]; }); return delegate; } - (void)setDelegate:(PFURLSessionDataTaskDelegate *)delegate forDataTask:(NSURLSessionDataTask *)task { dispatch_barrier_async(_delegatesAccessQueue, ^{ - _delegatesDictionary[@(task.taskIdentifier)] = delegate; + self->_delegatesDictionary[@(task.taskIdentifier)] = delegate; }); } - (void)_removeDelegateForTaskWithIdentifier:(NSNumber *)identifier { dispatch_barrier_async(_delegatesAccessQueue, ^{ - [_delegatesDictionary removeObjectForKey:identifier]; + [self->_delegatesDictionary removeObjectForKey:identifier]; }); } diff --git a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionUploadTaskDelegate.m b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionUploadTaskDelegate.m index 93f231a7f..2b3c477cb 100644 --- a/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionUploadTaskDelegate.m +++ b/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionUploadTaskDelegate.m @@ -47,8 +47,8 @@ - (void)URLSession:(NSURLSession *)session totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend { int progress = (int)round(totalBytesSent / (double)totalBytesExpectedToSend * 100); dispatch_async(dispatch_get_main_queue(), ^{ - if (_progressBlock) { - _progressBlock(progress); + if (self->_progressBlock) { + self->_progressBlock(progress); } }); } diff --git a/Parse/Parse/Internal/Commands/PFRESTPushCommand.h b/Parse/Parse/Internal/Commands/PFRESTPushCommand.h index e92fe9ea4..a533c0aa7 100644 --- a/Parse/Parse/Internal/Commands/PFRESTPushCommand.h +++ b/Parse/Parse/Internal/Commands/PFRESTPushCommand.h @@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFRESTPushCommand : PFRESTCommand -+ (instancetype)sendPushCommandWithPushState:(PFPushState *)state - sessionToken:(nullable NSString *)sessionToken - error:(NSError **)error; ++ (nullable instancetype)sendPushCommandWithPushState:(PFPushState *)state + sessionToken:(nullable NSString *)sessionToken + error:(NSError **)error; @end diff --git a/Parse/Parse/Internal/Config/Controller/PFConfigController.m b/Parse/Parse/Internal/Config/Controller/PFConfigController.m index d6aef2c0b..cfb850e68 100644 --- a/Parse/Parse/Internal/Config/Controller/PFConfigController.m +++ b/Parse/Parse/Internal/Config/Controller/PFConfigController.m @@ -77,10 +77,10 @@ - (BFTask *)fetchConfigAsyncWithSessionToken:(NSString *)sessionToken { - (PFCurrentConfigController *)currentConfigController { __block PFCurrentConfigController *controller = nil; dispatch_sync(_dataAccessQueue, ^{ - if (!_currentConfigController) { - _currentConfigController = [[PFCurrentConfigController alloc] initWithDataSource:self.dataSource]; + if (!self->_currentConfigController) { + self->_currentConfigController = [[PFCurrentConfigController alloc] initWithDataSource:self.dataSource]; } - controller = _currentConfigController; + controller = self->_currentConfigController; }); return controller; } diff --git a/Parse/Parse/Internal/Config/Controller/PFCurrentConfigController.m b/Parse/Parse/Internal/Config/Controller/PFCurrentConfigController.m index e7e4bf400..5bed36cc3 100644 --- a/Parse/Parse/Internal/Config/Controller/PFCurrentConfigController.m +++ b/Parse/Parse/Internal/Config/Controller/PFCurrentConfigController.m @@ -55,13 +55,13 @@ + (instancetype)controllerWithDataSource:(id)da - (BFTask *)getCurrentConfigAsync { return [_dataTaskQueue enqueue:^id(BFTask *_) { - if (!_currentConfig) { + if (!self->_currentConfig) { return [[self _loadConfigAsync] continueWithSuccessBlock:^id(BFTask *task) { - _currentConfig = task.result; - return _currentConfig; + self->_currentConfig = task.result; + return self->_currentConfig; }]; } - return _currentConfig; + return self->_currentConfig; }]; } @@ -69,7 +69,7 @@ - (BFTask *)setCurrentConfigAsync:(PFConfig *)config { @weakify(self); return [_dataTaskQueue enqueue:^id(BFTask *_) { @strongify(self); - _currentConfig = config; + self->_currentConfig = config; NSDictionary *configParameters = @{ PFConfigParametersRESTKey : (config.parametersDictionary ?: @{}) }; NSError *error; @@ -88,7 +88,7 @@ - (BFTask *)clearCurrentConfigAsync { @weakify(self); return [_dataTaskQueue enqueue:^id(BFTask *_) { @strongify(self); - _currentConfig = nil; + self->_currentConfig = nil; return [[self.dataSource.persistenceController getPersistenceGroupAsync] continueWithSuccessBlock:^id(BFTask> *task) { return [task.result removeDataAsyncForKey:PFConfigCurrentConfigFileName_]; }]; @@ -97,7 +97,7 @@ - (BFTask *)clearCurrentConfigAsync { - (BFTask *)clearMemoryCachedCurrentConfigAsync { return [_dataTaskQueue enqueue:^id(BFTask *_) { - _currentConfig = nil; + self->_currentConfig = nil; return nil; }]; } diff --git a/Parse/Parse/Internal/File/Controller/PFFileController.m b/Parse/Parse/Internal/File/Controller/PFFileController.m index 012cf4912..03d6d05c8 100644 --- a/Parse/Parse/Internal/File/Controller/PFFileController.m +++ b/Parse/Parse/Internal/File/Controller/PFFileController.m @@ -71,10 +71,10 @@ + (instancetype)controllerWithDataSource:(id_fileStagingController) { + self->_fileStagingController = [PFFileStagingController controllerWithDataSource:self.dataSource]; } - result = _fileStagingController; + result = self->_fileStagingController; }); return result; } @@ -119,14 +119,14 @@ - (PFFileStagingController *)fileStagingController { return task; }]; }] continueWithBlock:^id(BFTask *task) { - dispatch_barrier_async(_downloadDataAccessQueue, ^{ - [_downloadTasks removeObjectForKey:fileState.secureURLString]; - [_downloadProgressBlocks removeObjectForKey:fileState.secureURLString]; + dispatch_barrier_async(self->_downloadDataAccessQueue, ^{ + [self->_downloadTasks removeObjectForKey:fileState.secureURLString]; + [self->_downloadProgressBlocks removeObjectForKey:fileState.secureURLString]; }); return task; }]; - dispatch_barrier_async(_downloadDataAccessQueue, ^{ - _downloadTasks[fileState.secureURLString] = resultTask; + dispatch_barrier_async(self->_downloadDataAccessQueue, ^{ + self->_downloadTasks[fileState.secureURLString] = resultTask; }); } return resultTask; @@ -158,8 +158,8 @@ - (PFFileStagingController *)fileStagingController { - (BFTask *)_fileDownloadResultTaskForFileWithState:(PFFileState *)state { __block BFTask *resultTask = nil; - dispatch_sync(_downloadDataAccessQueue, ^{ - resultTask = _downloadTasks[state.secureURLString]; + dispatch_sync(self->_downloadDataAccessQueue, ^{ + resultTask = self->_downloadTasks[state.secureURLString]; }); return resultTask; } @@ -168,8 +168,8 @@ - (PFProgressBlock)_fileDownloadUnifyingProgressBlockForFileState:(PFFileState * return ^(int progress) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ __block NSArray *blocks = nil; - dispatch_sync(_downloadDataAccessQueue, ^{ - blocks = [_downloadProgressBlocks[fileState.secureURLString] copy]; + dispatch_sync(self->_downloadDataAccessQueue, ^{ + blocks = [self->_downloadProgressBlocks[fileState.secureURLString] copy]; }); if (blocks.count != 0) { dispatch_async(dispatch_get_main_queue(), ^{ @@ -187,11 +187,11 @@ - (void)_addFileDownloadProgressBlock:(PFProgressBlock)block forFileWithState:(P return; } - dispatch_barrier_async(_downloadDataAccessQueue, ^{ - NSMutableArray *progressBlocks = _downloadProgressBlocks[state.secureURLString]; + dispatch_barrier_async(self->_downloadDataAccessQueue, ^{ + NSMutableArray *progressBlocks = self->_downloadProgressBlocks[state.secureURLString]; if (!progressBlocks) { progressBlocks = [NSMutableArray arrayWithObject:block]; - _downloadProgressBlocks[state.secureURLString] = progressBlocks; + self->_downloadProgressBlocks[state.secureURLString] = progressBlocks; } else { [progressBlocks addObject:block]; } diff --git a/Parse/Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m b/Parse/Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m index 9f80c6b67..785664ce3 100644 --- a/Parse/Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m +++ b/Parse/Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m @@ -128,9 +128,9 @@ - (BFTask *)getCurrentObjectAsync { return installation; }]; }] continueWithBlock:^id(BFTask *task) { - dispatch_barrier_sync(_dataQueue, ^{ - _currentInstallation = task.result; - _currentInstallationMatchesDisk = !task.faulted; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentInstallation = task.result; + self->_currentInstallationMatchesDisk = !task.faulted; }); return task; }]; @@ -167,9 +167,9 @@ - (BFTask *)clearCurrentInstallationAsync { return [_dataTaskQueue enqueue:^BFTask *(BFTask *unused) { @strongify(self); - dispatch_barrier_sync(_dataQueue, ^{ - _currentInstallation = nil; - _currentInstallationMatchesDisk = NO; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentInstallation = nil; + self->_currentInstallationMatchesDisk = NO; }); NSMutableArray *tasks = [NSMutableArray arrayWithCapacity:2]; @@ -252,15 +252,15 @@ - (PFInstallationIdentifierStore *)installationIdentifierStore { - (PFInstallation *)currentInstallation { __block PFInstallation *installation = nil; dispatch_sync(_dataQueue, ^{ - installation = _currentInstallation; + installation = self->_currentInstallation; }); return installation; } - (void)setCurrentInstallation:(PFInstallation *)currentInstallation { dispatch_barrier_sync(_dataQueue, ^{ - if (_currentInstallation != currentInstallation) { - _currentInstallation = currentInstallation; + if (self->_currentInstallation != currentInstallation) { + self->_currentInstallation = currentInstallation; } }); } @@ -268,14 +268,14 @@ - (void)setCurrentInstallation:(PFInstallation *)currentInstallation { - (BOOL)currentInstallationMatchesDisk { __block BOOL matches = NO; dispatch_sync(_dataQueue, ^{ - matches = _currentInstallationMatchesDisk; + matches = self->_currentInstallationMatchesDisk; }); return matches; } - (void)setCurrentInstallationMatchesDisk:(BOOL)currentInstallationMatchesDisk { dispatch_barrier_sync(_dataQueue, ^{ - _currentInstallationMatchesDisk = currentInstallationMatchesDisk; + self->_currentInstallationMatchesDisk = currentInstallationMatchesDisk; }); } diff --git a/Parse/Parse/Internal/KeyValueCache/PFKeyValueCache.m b/Parse/Parse/Internal/KeyValueCache/PFKeyValueCache.m index 77c755ebd..6a386dc3d 100644 --- a/Parse/Parse/Internal/KeyValueCache/PFKeyValueCache.m +++ b/Parse/Parse/Internal/KeyValueCache/PFKeyValueCache.m @@ -178,7 +178,7 @@ - (void)removeAllObjects { dispatch_sync(_diskCacheQueue, ^{ // Directory will be automatically recreated the next time 'cacheDir' is accessed. - [self.fileManager removeItemAtURL:_cacheDirectoryURL error:NULL]; + [self.fileManager removeItemAtURL:self->_cacheDirectoryURL error:NULL]; }); } diff --git a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabase.m b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabase.m index b63fc6d79..97885725c 100644 --- a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabase.m +++ b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabase.m @@ -108,7 +108,7 @@ - (BFTask *)openAsync { } // Check if this database have already been opened before. - if (_databaseClosedTaskCompletionSource.task.completed) { + if (self->_databaseClosedTaskCompletionSource.task.completed) { NSError *error = [self _errorWithErrorCode:PFSQLiteDatabaseDatabaseAlreadyClosed errorMessage:@"Closed database cannot be reopen." domain:PFSQLiteDatabaseErrorPFSQLiteDatabaseDomain]; @@ -146,12 +146,12 @@ - (BFTask *)closeAsync { if (resultCode == SQLITE_OK) { self.database = nil; - [_databaseClosedTaskCompletionSource setResult:nil]; + [self->_databaseClosedTaskCompletionSource setResult:nil]; } else { // Returns error - [_databaseClosedTaskCompletionSource setError:[self _errorWithErrorCode:resultCode]]; + [self->_databaseClosedTaskCompletionSource setError:[self _errorWithErrorCode:resultCode]]; } - return _databaseClosedTaskCompletionSource.task; + return self->_databaseClosedTaskCompletionSource.task; }]; } diff --git a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabaseResult.m b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabaseResult.m index ac1c1470b..75fb5a37c 100644 --- a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabaseResult.m +++ b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteDatabaseResult.m @@ -182,7 +182,7 @@ - (NSDictionary *)columnNameToIndexMap { NSString *key = [NSString stringWithUTF8String:sqlite3_column_name(self.statement.sqliteStatement, i)]; mutableColumnNameToIndexMap[key.lowercaseString] = @(i); } - _columnNameToIndexMap = mutableColumnNameToIndexMap; + self->_columnNameToIndexMap = mutableColumnNameToIndexMap; }); } return _columnNameToIndexMap; diff --git a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.m b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.m index c021e8050..8a229d845 100644 --- a/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.m +++ b/Parse/Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.m @@ -31,12 +31,12 @@ - (void)dealloc { - (BOOL)close { return PFThreadSafetyPerform(_databaseQueue, ^BOOL{ - if (!_sqliteStatement) { + if (!self->_sqliteStatement) { return YES; } - int resultCode = sqlite3_finalize(_sqliteStatement); - _sqliteStatement = NULL; + int resultCode = sqlite3_finalize(self->_sqliteStatement); + self->_sqliteStatement = NULL; return (resultCode == SQLITE_OK || resultCode == SQLITE_DONE); }); @@ -44,11 +44,11 @@ - (BOOL)close { - (BOOL)reset { return PFThreadSafetyPerform(_databaseQueue, ^BOOL{ - if (!_sqliteStatement) { + if (!self->_sqliteStatement) { return YES; } - int resultCode = sqlite3_reset(_sqliteStatement); + int resultCode = sqlite3_reset(self->_sqliteStatement); return (resultCode == SQLITE_OK || resultCode == SQLITE_DONE); }); } diff --git a/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLock.m b/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLock.m index 32cb1422c..950c83b19 100644 --- a/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLock.m +++ b/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLock.m @@ -58,7 +58,7 @@ - (void)dealloc { - (void)lock { dispatch_sync(_synchronizationQueue, ^{ // Greater than zero means that the lock was already succesfully acquired. - if (_fileDescriptor > 0) { + if (self->_fileDescriptor > 0) { return; } @@ -75,12 +75,12 @@ - (void)lock { - (void)unlock { dispatch_sync(_synchronizationQueue, ^{ // Only descriptor that is greater than zero is going to be open. - if (_fileDescriptor <= 0) { + if (self->_fileDescriptor <= 0) { return; } - close(_fileDescriptor); - _fileDescriptor = 0; + close(self->_fileDescriptor); + self->_fileDescriptor = 0; }); } @@ -92,9 +92,9 @@ - (BOOL)_tryLock { const char *filePath = self.lockFilePath.fileSystemRepresentation; // Atomically create a lock file if it doesn't exist and acquire the lock. - _fileDescriptor = open(filePath, (O_RDWR | O_CREAT | O_EXLOCK), - ((S_IRUSR | S_IWUSR | S_IXUSR) | (S_IRGRP | S_IWGRP | S_IXGRP) | (S_IROTH | S_IWOTH | S_IXOTH))); - return (_fileDescriptor > 0); + self->_fileDescriptor = open(filePath, (O_RDWR | O_CREAT | O_EXLOCK), + ((S_IRUSR | S_IWUSR | S_IXUSR) | (S_IRGRP | S_IWGRP | S_IXGRP) | (S_IROTH | S_IWOTH | S_IXOTH))); + return (self->_fileDescriptor > 0); } @end diff --git a/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLockController.m b/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLockController.m index be10da982..052d8b7d5 100644 --- a/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLockController.m +++ b/Parse/Parse/Internal/MultiProcessLock/PFMultiProcessFileLockController.m @@ -52,27 +52,27 @@ + (instancetype)sharedController { - (void)beginLockedContentAccessForFileAtPath:(NSString *)filePath { dispatch_barrier_sync(_synchronizationQueue, ^{ - PFMultiProcessFileLock *fileLock = _locksDictionary[filePath]; + PFMultiProcessFileLock *fileLock = self->_locksDictionary[filePath]; if (!fileLock) { fileLock = [PFMultiProcessFileLock lockForFileWithPath:filePath]; - _locksDictionary[filePath] = fileLock; + self->_locksDictionary[filePath] = fileLock; } [fileLock lock]; - NSUInteger contentAccess = [_contentAccessDictionary[filePath] unsignedIntegerValue]; - _contentAccessDictionary[filePath] = @(contentAccess + 1); + NSUInteger contentAccess = [self->_contentAccessDictionary[filePath] unsignedIntegerValue]; + self->_contentAccessDictionary[filePath] = @(contentAccess + 1); }); } - (void)endLockedContentAccessForFileAtPath:(NSString *)filePath { dispatch_barrier_sync(_synchronizationQueue, ^{ - PFMultiProcessFileLock *fileLock = _locksDictionary[filePath]; + PFMultiProcessFileLock *fileLock = self->_locksDictionary[filePath]; [fileLock unlock]; - if (fileLock && [_contentAccessDictionary[filePath] unsignedIntegerValue] == 0) { - [_locksDictionary removeObjectForKey:filePath]; - [_contentAccessDictionary removeObjectForKey:filePath]; + if (fileLock && [self->_contentAccessDictionary[filePath] unsignedIntegerValue] == 0) { + [self->_locksDictionary removeObjectForKey:filePath]; + [self->_contentAccessDictionary removeObjectForKey:filePath]; } }); } @@ -80,7 +80,7 @@ - (void)endLockedContentAccessForFileAtPath:(NSString *)filePath { - (NSUInteger)lockedContentAccessCountForFileAtPath:(NSString *)filePath { __block NSUInteger value = 0; dispatch_sync(_synchronizationQueue, ^{ - value = [_contentAccessDictionary[filePath] unsignedIntegerValue]; + value = [self->_contentAccessDictionary[filePath] unsignedIntegerValue]; }); return value; } diff --git a/Parse/Parse/Internal/Object/PinningStore/PFPinningObjectStore.m b/Parse/Parse/Internal/Object/PinningStore/PFPinningObjectStore.m index 1f152fe2a..752164a26 100644 --- a/Parse/Parse/Internal/Object/PinningStore/PFPinningObjectStore.m +++ b/Parse/Parse/Internal/Object/PinningStore/PFPinningObjectStore.m @@ -54,7 +54,7 @@ + (instancetype)storeWithDataSource:(id)dataSource { - (BFTask *)fetchPinAsyncWithName:(NSString *)name { @weakify(self); return [BFTask taskFromExecutor:_pinCacheAccessExecutor withBlock:^id{ - BFTask *cachedTask = [_pinCacheTable objectForKey:name] ?: [BFTask taskWithResult:nil]; + BFTask *cachedTask = [self->_pinCacheTable objectForKey:name] ?: [BFTask taskWithResult:nil]; // We need to call directly to OfflineStore since we don't want/need a user to query for ParsePins cachedTask = [cachedTask continueWithBlock:^id(BFTask *task) { @strongify(self); @@ -70,7 +70,7 @@ + (instancetype)storeWithDataSource:(id)dataSource { }]; }]; // Put the task back into the cache. - [_pinCacheTable setObject:cachedTask forKey:name]; + [self->_pinCacheTable setObject:cachedTask forKey:name]; return cachedTask; }]; } diff --git a/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m b/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m index 72d2be753..32748d9a4 100644 --- a/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m +++ b/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassInfo.m @@ -117,7 +117,7 @@ - (NSMethodSignature *)forwardingMethodSignatureForSelector:(SEL)cmd { // NSMethodSignature can be fairly heavyweight, so let's agressively cache this here. dispatch_sync(_dataAccessQueue, ^{ - result = _knownMethodSignatures[selectorString]; + result = self->_knownMethodSignatures[selectorString]; if (result) { return; } @@ -143,7 +143,7 @@ - (NSMethodSignature *)forwardingMethodSignatureForSelector:(SEL)cmd { NSString *objcTypes = ([NSString stringWithFormat:(isSetter ? @"v@:%@" : @"%@@:"), typeEncoding]); result = [NSMethodSignature signatureWithObjCTypes:objcTypes.UTF8String]; - _knownMethodSignatures[selectorString] = result; + self->_knownMethodSignatures[selectorString] = result; }); return result; diff --git a/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m b/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m index 1be108765..4f3b90bd7 100644 --- a/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m +++ b/Parse/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m @@ -113,7 +113,7 @@ - (void)dealloc { - (Class)subclassForParseClassName:(NSString *)parseClassName { __block Class result = nil; pf_sync_with_throw(_registeredSubclassesAccessQueue, ^{ - result = [_registeredSubclasses[parseClassName] subclass]; + result = [self->_registeredSubclasses[parseClassName] subclass]; }); return result; } @@ -146,7 +146,7 @@ - (void)registerSubclass:(Class)kls { - (void)unregisterSubclass:(Class)class { pf_sync_with_throw(_registeredSubclassesAccessQueue, ^{ NSString *parseClassName = [class parseClassName]; - Class registeredClass = [_registeredSubclasses[parseClassName] subclass]; + Class registeredClass = [self->_registeredSubclasses[parseClassName] subclass]; // Make it a no-op if the class itself is not registered or // if there is another class registered under the same name. @@ -155,7 +155,7 @@ - (void)unregisterSubclass:(Class)class { return; } - [_registeredSubclasses removeObjectForKey:parseClassName]; + [self->_registeredSubclasses removeObjectForKey:parseClassName]; }); } @@ -268,13 +268,13 @@ - (PFObjectSubclassInfo *)_subclassInfoForClass:(Class)kls { __block PFObjectSubclassInfo *result = nil; pf_sync_with_throw(_registeredSubclassesAccessQueue, ^{ if (class_respondsToSelector(object_getClass(kls), @selector(parseClassName))) { - result = _registeredSubclasses[[kls parseClassName]]; + result = self->_registeredSubclasses[[kls parseClassName]]; } // TODO: (nlutsenko, richardross) Don't let unregistered subclasses have dynamic property resolution. if (!result) { result = [PFObjectSubclassInfo subclassInfoWithSubclass:kls]; - _unregisteredSubclasses[NSStringFromClass(kls)] = result; + self->_unregisteredSubclasses[NSStringFromClass(kls)] = result; } }); return result; diff --git a/Parse/Parse/Internal/PFAsyncTaskQueue.m b/Parse/Parse/Internal/PFAsyncTaskQueue.m index c154143bd..839726449 100644 --- a/Parse/Parse/Internal/PFAsyncTaskQueue.m +++ b/Parse/Parse/Internal/PFAsyncTaskQueue.m @@ -47,8 +47,8 @@ + (instancetype)taskQueue { - (BFTask *)enqueue:(BFContinuationBlock)block { BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource]; dispatch_async(_syncQueue, ^{ - _tail = [_tail continueAsyncWithBlock:block]; - [_tail continueAsyncWithBlock:^id(BFTask *task) { + self->_tail = [self->_tail continueAsyncWithBlock:block]; + [self->_tail continueAsyncWithBlock:^id(BFTask *task) { if (task.faulted) { [source trySetError:task.error]; } else if (task.cancelled) { diff --git a/Parse/Parse/Internal/PFCoreManager.m b/Parse/Parse/Internal/PFCoreManager.m index eeb4ebd5c..df64a15cb 100644 --- a/Parse/Parse/Internal/PFCoreManager.m +++ b/Parse/Parse/Internal/PFCoreManager.m @@ -97,10 +97,10 @@ + (instancetype)managerWithDataSource:(id)dataSource { - (PFLocationManager *)locationManager { __block PFLocationManager *manager; dispatch_sync(_locationManagerAccessQueue, ^{ - if (!_locationManager) { - _locationManager = [[PFLocationManager alloc] init]; + if (!self->_locationManager) { + self->_locationManager = [[PFLocationManager alloc] init]; } - manager = _locationManager; + manager = self->_locationManager; }); return manager; } @@ -112,10 +112,10 @@ - (PFLocationManager *)locationManager { - (PFDefaultACLController *)defaultACLController { __block PFDefaultACLController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_defaultACLController) { - _defaultACLController = [PFDefaultACLController controllerWithDataSource:self]; + if (!self->_defaultACLController) { + self->_defaultACLController = [PFDefaultACLController controllerWithDataSource:self]; } - controller = _defaultACLController; + controller = self->_defaultACLController; }); return controller; } @@ -127,23 +127,23 @@ - (PFDefaultACLController *)defaultACLController { - (PFQueryController *)queryController { __block PFQueryController *queryController; dispatch_sync(_controllerAccessQueue, ^{ - if (!_queryController) { + if (!self->_queryController) { id dataSource = self.dataSource; if (dataSource.offlineStoreLoaded) { - _queryController = [PFOfflineQueryController controllerWithCommonDataSource:dataSource + self->_queryController = [PFOfflineQueryController controllerWithCommonDataSource:dataSource coreDataSource:self]; } else { - _queryController = [PFCachedQueryController controllerWithCommonDataSource:dataSource]; + self->_queryController = [PFCachedQueryController controllerWithCommonDataSource:dataSource]; } } - queryController = _queryController; + queryController = self->_queryController; }); return queryController; } - (void)setQueryController:(PFQueryController *)queryController { dispatch_sync(_controllerAccessQueue, ^{ - _queryController = queryController; + self->_queryController = queryController; }); } @@ -154,17 +154,17 @@ - (void)setQueryController:(PFQueryController *)queryController { - (PFFileController *)fileController { __block PFFileController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_fileController) { - _fileController = [PFFileController controllerWithDataSource:self.dataSource]; + if (!self->_fileController) { + self->_fileController = [PFFileController controllerWithDataSource:self.dataSource]; } - controller = _fileController; + controller = self->_fileController; }); return controller; } - (void)setFileController:(PFFileController *)fileController { dispatch_sync(_controllerAccessQueue, ^{ - _fileController = fileController; + self->_fileController = fileController; }); } @@ -175,17 +175,17 @@ - (void)setFileController:(PFFileController *)fileController { - (PFCloudCodeController *)cloudCodeController { __block PFCloudCodeController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_cloudCodeController) { - _cloudCodeController = [[PFCloudCodeController alloc] initWithDataSource:self.dataSource]; + if (!self->_cloudCodeController) { + self->_cloudCodeController = [[PFCloudCodeController alloc] initWithDataSource:self.dataSource]; } - controller = _cloudCodeController; + controller = self->_cloudCodeController; }); return controller; } - (void)setCloudCodeController:(PFCloudCodeController *)cloudCodeController { dispatch_sync(_controllerAccessQueue, ^{ - _cloudCodeController = cloudCodeController; + self->_cloudCodeController = cloudCodeController; }); } @@ -196,17 +196,17 @@ - (void)setCloudCodeController:(PFCloudCodeController *)cloudCodeController { - (PFConfigController *)configController { __block PFConfigController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_configController) { - _configController = [[PFConfigController alloc] initWithDataSource:self.dataSource]; + if (!self->_configController) { + self->_configController = [[PFConfigController alloc] initWithDataSource:self.dataSource]; } - controller = _configController; + controller = self->_configController; }); return controller; } - (void)setConfigController:(PFConfigController *)configController { dispatch_sync(_controllerAccessQueue, ^{ - _configController = configController; + self->_configController = configController; }); } @@ -217,22 +217,22 @@ - (void)setConfigController:(PFConfigController *)configController { - (PFObjectController *)objectController { __block PFObjectController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_objectController) { + if (!self->_objectController) { id dataSource = self.dataSource; if (dataSource.offlineStoreLoaded) { - _objectController = [PFOfflineObjectController controllerWithDataSource:dataSource]; + self->_objectController = [PFOfflineObjectController controllerWithDataSource:dataSource]; } else { - _objectController = [PFObjectController controllerWithDataSource:dataSource]; + self->_objectController = [PFObjectController controllerWithDataSource:dataSource]; } } - controller = _objectController; + controller = self->_objectController; }); return controller; } - (void)setObjectController:(PFObjectController *)controller { dispatch_sync(_controllerAccessQueue, ^{ - _objectController = controller; + self->_objectController = controller; }); } @@ -243,18 +243,18 @@ - (void)setObjectController:(PFObjectController *)controller { - (PFObjectSubclassingController *)objectSubclassingController { __block PFObjectSubclassingController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_objectSubclassingController) { - _objectSubclassingController = [[PFObjectSubclassingController alloc] init]; - [_objectSubclassingController scanForUnregisteredSubclasses:YES]; + if (!self->_objectSubclassingController) { + self->_objectSubclassingController = [[PFObjectSubclassingController alloc] init]; + [self->_objectSubclassingController scanForUnregisteredSubclasses:YES]; } - controller = _objectSubclassingController; + controller = self->_objectSubclassingController; }); return controller; } - (void)setObjectSubclassingController:(PFObjectSubclassingController *)objectSubclassingController { dispatch_sync(_controllerAccessQueue, ^{ - _objectSubclassingController = objectSubclassingController; + self->_objectSubclassingController = objectSubclassingController; }); } @@ -265,10 +265,10 @@ - (void)setObjectSubclassingController:(PFObjectSubclassingController *)objectSu - (PFObjectBatchController *)objectBatchController { __block PFObjectBatchController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_objectBatchController) { - _objectBatchController = [PFObjectBatchController controllerWithDataSource:self.dataSource]; + if (!self->_objectBatchController) { + self->_objectBatchController = [PFObjectBatchController controllerWithDataSource:self.dataSource]; } - controller = _objectBatchController; + controller = self->_objectBatchController; }); return controller; } @@ -280,17 +280,17 @@ - (PFObjectBatchController *)objectBatchController { - (PFObjectFilePersistenceController *)objectFilePersistenceController { __block PFObjectFilePersistenceController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_objectFilePersistenceController) { - _objectFilePersistenceController = [PFObjectFilePersistenceController controllerWithDataSource:self.dataSource]; + if (!self->_objectFilePersistenceController) { + self->_objectFilePersistenceController = [PFObjectFilePersistenceController controllerWithDataSource:self.dataSource]; } - controller = _objectFilePersistenceController; + controller = self->_objectFilePersistenceController; }); return controller; } - (void)unloadObjectFilePersistenceController { dispatch_sync(_controllerAccessQueue, ^{ - _objectFilePersistenceController = nil; + self->_objectFilePersistenceController = nil; }); } @@ -301,17 +301,17 @@ - (void)unloadObjectFilePersistenceController { - (PFPinningObjectStore *)pinningObjectStore { __block PFPinningObjectStore *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_pinningObjectStore) { - _pinningObjectStore = [PFPinningObjectStore storeWithDataSource:self.dataSource]; + if (!self->_pinningObjectStore) { + self->_pinningObjectStore = [PFPinningObjectStore storeWithDataSource:self.dataSource]; } - controller = _pinningObjectStore; + controller = self->_pinningObjectStore; }); return controller; } - (void)setPinningObjectStore:(PFPinningObjectStore *)pinningObjectStore { dispatch_sync(_controllerAccessQueue, ^{ - _pinningObjectStore = pinningObjectStore; + self->_pinningObjectStore = pinningObjectStore; }); } @@ -324,17 +324,17 @@ - (PFObjectLocalIdStore *)objectLocalIdStore { @weakify(self); dispatch_sync(_objectLocalIdStoreAccessQueue, ^{ @strongify(self); - if (!_objectLocalIdStore) { - _objectLocalIdStore = [[PFObjectLocalIdStore alloc] initWithDataSource:self.dataSource]; + if (!self->_objectLocalIdStore) { + self->_objectLocalIdStore = [[PFObjectLocalIdStore alloc] initWithDataSource:self.dataSource]; } - store = _objectLocalIdStore; + store = self->_objectLocalIdStore; }); return store; } - (void)setObjectLocalIdStore:(PFObjectLocalIdStore *)objectLocalIdStore { dispatch_sync(_objectLocalIdStoreAccessQueue, ^{ - _objectLocalIdStore = objectLocalIdStore; + self->_objectLocalIdStore = objectLocalIdStore; }); } @@ -345,17 +345,17 @@ - (void)setObjectLocalIdStore:(PFObjectLocalIdStore *)objectLocalIdStore { - (PFUserAuthenticationController *)userAuthenticationController { __block PFUserAuthenticationController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_userAuthenticationController) { - _userAuthenticationController = [PFUserAuthenticationController controllerWithDataSource:self]; + if (!self->_userAuthenticationController) { + self->_userAuthenticationController = [PFUserAuthenticationController controllerWithDataSource:self]; } - controller = _userAuthenticationController; + controller = self->_userAuthenticationController; }); return controller; } - (void)setUserAuthenticationController:(PFUserAuthenticationController *)userAuthenticationController { dispatch_sync(_controllerAccessQueue, ^{ - _userAuthenticationController = userAuthenticationController; + self->_userAuthenticationController = userAuthenticationController; }); } @@ -366,17 +366,17 @@ - (void)setUserAuthenticationController:(PFUserAuthenticationController *)userAu - (PFSessionController *)sessionController { __block PFSessionController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_sessionController) { - _sessionController = [PFSessionController controllerWithDataSource:self.dataSource]; + if (!self->_sessionController) { + self->_sessionController = [PFSessionController controllerWithDataSource:self.dataSource]; } - controller = _sessionController; + controller = self->_sessionController; }); return controller; } - (void)setSessionController:(PFSessionController *)sessionController { dispatch_sync(_controllerAccessQueue, ^{ - _sessionController = sessionController; + self->_sessionController = sessionController; }); } @@ -389,23 +389,23 @@ - (void)setSessionController:(PFSessionController *)sessionController { - (PFCurrentInstallationController *)currentInstallationController { __block PFCurrentInstallationController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_currentInstallationController) { + if (!self->_currentInstallationController) { id dataSource = self.dataSource; PFCurrentObjectStorageType storageType = (dataSource.offlineStore ? PFCurrentObjectStorageTypeOfflineStore : PFCurrentObjectStorageTypeFile); - _currentInstallationController = [PFCurrentInstallationController controllerWithStorageType:storageType - commonDataSource:dataSource - coreDataSource:self]; + self->_currentInstallationController = [PFCurrentInstallationController controllerWithStorageType:storageType + commonDataSource:dataSource + coreDataSource:self]; } - controller = _currentInstallationController; + controller = self->_currentInstallationController; }); return controller; } - (void)setCurrentInstallationController:(PFCurrentInstallationController *)controller { dispatch_sync(_controllerAccessQueue, ^{ - _currentInstallationController = controller; + self->_currentInstallationController = controller; }); } @@ -418,23 +418,23 @@ - (void)setCurrentInstallationController:(PFCurrentInstallationController *)cont - (PFCurrentUserController *)currentUserController { __block PFCurrentUserController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_currentUserController) { + if (!self->_currentUserController) { id dataSource = self.dataSource; PFCurrentObjectStorageType storageType = (dataSource.offlineStore ? PFCurrentObjectStorageTypeOfflineStore : PFCurrentObjectStorageTypeFile); - _currentUserController = [PFCurrentUserController controllerWithStorageType:storageType - commonDataSource:dataSource - coreDataSource:self]; + self->_currentUserController = [PFCurrentUserController controllerWithStorageType:storageType + commonDataSource:dataSource + coreDataSource:self]; } - controller = _currentUserController; + controller = self->_currentUserController; }); return controller; } - (void)setCurrentUserController:(PFCurrentUserController *)currentUserController { dispatch_sync(_controllerAccessQueue, ^{ - _currentUserController = currentUserController; + self->_currentUserController = currentUserController; }); } @@ -447,17 +447,17 @@ - (void)setCurrentUserController:(PFCurrentUserController *)currentUserControlle - (PFInstallationController *)installationController { __block PFInstallationController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_installationController) { - _installationController = [PFInstallationController controllerWithDataSource:self]; + if (!self->_installationController) { + self->_installationController = [PFInstallationController controllerWithDataSource:self]; } - controller = _installationController; + controller = self->_installationController; }); return controller; } - (void)setInstallationController:(PFInstallationController *)installationController { dispatch_sync(_controllerAccessQueue, ^{ - _installationController = installationController; + self->_installationController = installationController; }); } @@ -470,18 +470,18 @@ - (void)setInstallationController:(PFInstallationController *)installationContro - (PFUserController *)userController { __block PFUserController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_userController) { - _userController = [PFUserController controllerWithCommonDataSource:self.dataSource - coreDataSource:self]; + if (!self->_userController) { + self->_userController = [PFUserController controllerWithCommonDataSource:self.dataSource + coreDataSource:self]; } - controller = _userController; + controller = self->_userController; }); return controller; } - (void)setUserController:(PFUserController *)userController { dispatch_sync(_controllerAccessQueue, ^{ - _userController = userController; + self->_userController = userController; }); } diff --git a/Parse/Parse/Internal/PFDateFormatter.m b/Parse/Parse/Internal/PFDateFormatter.m index 1f8707929..6044895f3 100644 --- a/Parse/Parse/Internal/PFDateFormatter.m +++ b/Parse/Parse/Internal/PFDateFormatter.m @@ -73,14 +73,14 @@ - (NSString *)preciseStringFromDate:(NSDate *)date { __block NSString *string = nil; NSTimeInterval interval = date.timeIntervalSince1970; dispatch_sync(_synchronizationQueue, ^{ - sqlite3_bind_double(_dateToStringStatement, 1, interval); + sqlite3_bind_double(self->_dateToStringStatement, 1, interval); - if (sqlite3_step(_dateToStringStatement) == SQLITE_ROW) { - const char *sqliteString = (const char *)sqlite3_column_text(_dateToStringStatement, 0); + if (sqlite3_step(self->_dateToStringStatement) == SQLITE_ROW) { + const char *sqliteString = (const char *)sqlite3_column_text(self->_dateToStringStatement, 0); string = [NSString stringWithUTF8String:sqliteString]; } - sqlite3_reset(_dateToStringStatement); + sqlite3_reset(self->_dateToStringStatement); }); return string; } @@ -95,16 +95,16 @@ - (NSDate *)dateFromString:(NSString *)string { dispatch_sync(_synchronizationQueue, ^{ const char *utf8String = string.UTF8String; - sqlite3_bind_text(_stringToDateStatement, 1, utf8String, -1, SQLITE_STATIC); - sqlite3_bind_text(_stringToDateStatement, 2, utf8String, -1, SQLITE_STATIC); + sqlite3_bind_text(self->_stringToDateStatement, 1, utf8String, -1, SQLITE_STATIC); + sqlite3_bind_text(self->_stringToDateStatement, 2, utf8String, -1, SQLITE_STATIC); - if (sqlite3_step(_stringToDateStatement) == SQLITE_ROW) { - interval = sqlite3_column_int64(_stringToDateStatement, 0); - seconds = sqlite3_column_double(_stringToDateStatement, 1); + if (sqlite3_step(self->_stringToDateStatement) == SQLITE_ROW) { + interval = sqlite3_column_int64(self->_stringToDateStatement, 0); + seconds = sqlite3_column_double(self->_stringToDateStatement, 1); } - sqlite3_reset(_stringToDateStatement); - sqlite3_clear_bindings(_stringToDateStatement); + sqlite3_reset(self->_stringToDateStatement); + sqlite3_clear_bindings(self->_stringToDateStatement); }); // Extract the fraction component of the seconds double sintegral = 0.0; diff --git a/Parse/Parse/Internal/PFEventuallyQueue.m b/Parse/Parse/Internal/PFEventuallyQueue.m index 6c509c208..a3f0cf3a9 100644 --- a/Parse/Parse/Internal/PFEventuallyQueue.m +++ b/Parse/Parse/Internal/PFEventuallyQueue.m @@ -110,7 +110,7 @@ - (BFTask *)enqueueCommandInBackground:(id)command withObject: } return task; - }] continueWithExecutor:_synchronizationExecutor withSuccessBlock:^id(BFTask *task) { + }] continueWithExecutor:self->_synchronizationExecutor withSuccessBlock:^id(BFTask *task) { [self _didEnqueueCommand:command withIdentifier:identifier taskCompletionSource:taskCompletionSource]; return nil; }]; @@ -196,7 +196,7 @@ - (void)terminate { - (void)removeAllCommands { dispatch_sync(_synchronizationQueue, ^{ - [_taskCompletionSources removeAllObjects]; + [self->_taskCompletionSources removeAllObjects]; }); } @@ -236,7 +236,7 @@ - (void)_runCommandsWithRetriesCount:(NSUInteger)retriesCount { __block BFTaskCompletionSource *taskCompletionSource = nil; dispatch_sync(_synchronizationQueue, ^{ - taskCompletionSource = _taskCompletionSources[identifier]; + taskCompletionSource = self->_taskCompletionSources[identifier]; }); BFTask *resultTask = nil; @@ -266,8 +266,8 @@ - (void)_runCommandsWithRetriesCount:(NSUInteger)retriesCount { __block dispatch_semaphore_t semaphore = NULL; dispatch_sync(_synchronizationQueue, ^{ - _retryingSemaphore = dispatch_semaphore_create(0); - semaphore = _retryingSemaphore; + self->_retryingSemaphore = dispatch_semaphore_create(0); + semaphore = self->_retryingSemaphore; }); dispatch_time_t timeoutTime = dispatch_time(DISPATCH_TIME_NOW, @@ -275,7 +275,7 @@ - (void)_runCommandsWithRetriesCount:(NSUInteger)retriesCount { long waitResult = dispatch_semaphore_wait(semaphore, timeoutTime); dispatch_sync(_synchronizationQueue, ^{ - _retryingSemaphore = NULL; + self->_retryingSemaphore = NULL; }); if (waitResult == 0) { @@ -330,7 +330,7 @@ - (BFTask *)_didFinishRunningCommand:(id)command PFConsistencyAssert(resultTask.completed, @"Task should be completed."); dispatch_sync(_synchronizationQueue, ^{ - [_taskCompletionSources removeObjectForKey:identifier]; + [self->_taskCompletionSources removeObjectForKey:identifier]; }); return resultTask; @@ -382,12 +382,12 @@ - (void)setConnected:(BOOL)connected { @weakify(self); BFTaskCompletionSource *barrier = [BFTaskCompletionSource taskCompletionSource]; dispatch_async(_processingQueue, ^{ - dispatch_sync(_synchronizationQueue, ^{ + dispatch_sync(self->_synchronizationQueue, ^{ @strongify(self); if (self.connected != connected) { - _connected = connected; + self->_connected = connected; if (connected) { - dispatch_source_merge_data(_processingQueueSource, 1); + dispatch_source_merge_data(self->_processingQueueSource, 1); } } }); @@ -395,8 +395,8 @@ - (void)setConnected:(BOOL)connected { }); if (connected) { dispatch_async(_synchronizationQueue, ^{ - if (_retryingSemaphore) { - dispatch_semaphore_signal(_retryingSemaphore); + if (self->_retryingSemaphore) { + dispatch_semaphore_signal(self->_retryingSemaphore); } }); } @@ -414,7 +414,7 @@ - (void)_simulateReboot { return toAwait; }] continueWithExecutor:_synchronizationExecutor withBlock:^id(BFTask *task) { // Remove all state task completion sources - [_taskCompletionSources removeAllObjects]; + [self->_taskCompletionSources removeAllObjects]; return nil; }] continueWithExecutor:[BFExecutor executorWithDispatchQueue:_processingQueue] withBlock:^id(BFTask *task) { // Let all operations in the queue run at least once diff --git a/Parse/Parse/Internal/PFPinningEventuallyQueue.m b/Parse/Parse/Internal/PFPinningEventuallyQueue.m index 1853c0a6c..32e371e89 100644 --- a/Parse/Parse/Internal/PFPinningEventuallyQueue.m +++ b/Parse/Parse/Internal/PFPinningEventuallyQueue.m @@ -79,10 +79,10 @@ - (instancetype)initWithDataSource:(id)dataSource _taskQueue = [[PFTaskQueue alloc] init]; dispatch_sync(_synchronizationQueue, ^{ - _eventuallyPinUUIDQueue = [NSMutableArray array]; - _uuidToEventuallyPin = [NSMutableDictionary dictionary]; - _operationSetUUIDToOperationSet = [NSMutableDictionary dictionary]; - _operationSetUUIDToEventuallyPin = [NSMutableDictionary dictionary]; + self->_eventuallyPinUUIDQueue = [NSMutableArray array]; + self->_uuidToEventuallyPin = [NSMutableDictionary dictionary]; + self->_operationSetUUIDToOperationSet = [NSMutableDictionary dictionary]; + self->_operationSetUUIDToEventuallyPin = [NSMutableDictionary dictionary]; }); // Populate Eventually Pin to make sure we pre-loaded any existing data. @@ -116,20 +116,20 @@ - (void)removeAllCommands { [removeTask waitForResult:nil]; // Clear in-memory data dispatch_sync(_synchronizationQueue, ^{ - [_eventuallyPinUUIDQueue removeAllObjects]; - [_uuidToEventuallyPin removeAllObjects]; - [_operationSetUUIDToEventuallyPin removeAllObjects]; - [_operationSetUUIDToOperationSet removeAllObjects]; + [self->_eventuallyPinUUIDQueue removeAllObjects]; + [self->_uuidToEventuallyPin removeAllObjects]; + [self->_operationSetUUIDToEventuallyPin removeAllObjects]; + [self->_operationSetUUIDToOperationSet removeAllObjects]; }); } - (void)_simulateReboot { [super _simulateReboot]; - [_eventuallyPinUUIDQueue removeAllObjects]; - [_uuidToEventuallyPin removeAllObjects]; - [_operationSetUUIDToEventuallyPin removeAllObjects]; - [_operationSetUUIDToOperationSet removeAllObjects]; + [self->_eventuallyPinUUIDQueue removeAllObjects]; + [self->_uuidToEventuallyPin removeAllObjects]; + [self->_operationSetUUIDToEventuallyPin removeAllObjects]; + [self->_operationSetUUIDToOperationSet removeAllObjects]; [self _populateEventuallyPinAsync]; } @@ -146,11 +146,11 @@ - (NSArray *)_pendingCommandIdentifiers { [[self _populateEventuallyPinAsync] waitForResult:nil]; NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { - PFEventuallyPin *pin = _uuidToEventuallyPin[evaluatedObject]; + PFEventuallyPin *pin = self->_uuidToEventuallyPin[evaluatedObject]; // Filter out all pins that don't have `operationSet` data ready yet // to make sure we send the command with all the changes. if (pin.operationSetUUID) { - return (_operationSetUUIDToEventuallyPin[pin.operationSetUUID] != nil); + return (self->_operationSetUUIDToEventuallyPin[pin.operationSetUUID] != nil); } return YES; }]; @@ -208,9 +208,9 @@ - (BFTask *)_didFinishRunningCommand:(id)command BFTask *unpinTask = [eventuallyPin unpinInBackgroundWithName:PFEventuallyPinPinName]; unpinTask = [unpinTask continueWithBlock:^id(BFTask *task) { // Remove data from memory. - dispatch_sync(_synchronizationQueue, ^{ - [_uuidToEventuallyPin removeObjectForKey:identifier]; - [_eventuallyPinUUIDQueue removeObject:identifier]; + dispatch_sync(self->_synchronizationQueue, ^{ + [self->_uuidToEventuallyPin removeObjectForKey:identifier]; + [self->_eventuallyPinUUIDQueue removeObject:identifier]; }); if (resultTask.cancelled || resultTask.faulted) { @@ -219,9 +219,9 @@ - (BFTask *)_didFinishRunningCommand:(id)command if (eventuallyPin.operationSetUUID) { // Remove only if the operation succeeded - dispatch_sync(_synchronizationQueue, ^{ - [_operationSetUUIDToOperationSet removeObjectForKey:eventuallyPin.operationSetUUID]; - [_operationSetUUIDToEventuallyPin removeObjectForKey:eventuallyPin.operationSetUUID]; + dispatch_sync(self->_synchronizationQueue, ^{ + [self->_operationSetUUIDToOperationSet removeObjectForKey:eventuallyPin.operationSetUUID]; + [self->_operationSetUUIDToEventuallyPin removeObjectForKey:eventuallyPin.operationSetUUID]; }); } @@ -274,11 +274,11 @@ - (BFTask *)_waitForOperationSet:(PFOperationSet *)operationSet eventuallyPin:(P dispatch_sync(_synchronizationQueue, ^{ if (operationSet != nil) { uuid = operationSet.uuid; - _operationSetUUIDToOperationSet[uuid] = operationSet; + self->_operationSetUUIDToOperationSet[uuid] = operationSet; } if (eventuallyPin != nil) { uuid = eventuallyPin.operationSetUUID; - _operationSetUUIDToEventuallyPin[uuid] = eventuallyPin; + self->_operationSetUUIDToEventuallyPin[uuid] = eventuallyPin; } }); if (uuid == nil) { @@ -297,20 +297,20 @@ - (BFTask *)_waitForOperationSet:(PFOperationSet *)operationSet eventuallyPin:(P - (BFTask *)_populateEventuallyPinAsync { return [_taskQueue enqueue:^BFTask *(BFTask *toAwait) { return [[toAwait continueWithBlock:^id(BFTask *task) { - return [PFEventuallyPin findAllEventuallyPinWithExcludeUUIDs:_eventuallyPinUUIDQueue]; + return [PFEventuallyPin findAllEventuallyPinWithExcludeUUIDs:self->_eventuallyPinUUIDQueue]; }] continueWithSuccessBlock:^id(BFTask *task) { NSArray *eventuallyPins = task.result; for (PFEventuallyPin *eventuallyPin in eventuallyPins) { // If it's enqueued already, we don't need to run it again. - if ([_eventuallyPinUUIDQueue containsObject:eventuallyPin.operationSetUUID]) { + if ([self->_eventuallyPinUUIDQueue containsObject:eventuallyPin.operationSetUUID]) { continue; } // Make sure the data is in memory. - dispatch_sync(_synchronizationQueue, ^{ - [_eventuallyPinUUIDQueue addObject:eventuallyPin.uuid]; - _uuidToEventuallyPin[eventuallyPin.uuid] = eventuallyPin; + dispatch_sync(self->_synchronizationQueue, ^{ + [self->_eventuallyPinUUIDQueue addObject:eventuallyPin.uuid]; + self->_uuidToEventuallyPin[eventuallyPin.uuid] = eventuallyPin; }); // For now we don't care whether this will fail or not. diff --git a/Parse/Parse/Internal/PFReachability.m b/Parse/Parse/Internal/PFReachability.m index f125545a9..f2faebbb8 100644 --- a/Parse/Parse/Internal/PFReachability.m +++ b/Parse/Parse/Internal/PFReachability.m @@ -125,7 +125,7 @@ - (void)dealloc { - (void)addListener:(id)listener { PFWeakValue *value = [PFWeakValue valueWithWeakObject:listener]; dispatch_barrier_sync(_synchronizationQueue, ^{ - [_listenersArray addObject:value]; + [self->_listenersArray addObject:value]; }); } @@ -133,7 +133,7 @@ - (void)removeListener:(id)listener { @weakify(listener); dispatch_barrier_sync(_synchronizationQueue, ^{ @strongify(listener); - [_listenersArray filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { + [self->_listenersArray filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { id weakObject = [evaluatedObject weakObject]; return !(weakObject == nil || weakObject == listener); }]]; @@ -142,7 +142,7 @@ - (void)removeListener:(id)listener { - (void)removeAllListeners { dispatch_barrier_sync(_synchronizationQueue, ^{ - [_listenersArray removeAllObjects]; + [self->_listenersArray removeAllObjects]; }); } @@ -150,13 +150,13 @@ - (void)_notifyAllListeners { @weakify(self); dispatch_async(_synchronizationQueue, ^{ @strongify(self); - PFReachabilityState state = [[self class] _reachabilityStateForFlags:_flags]; - for (PFWeakValue *value in _listenersArray) { + PFReachabilityState state = [[self class] _reachabilityStateForFlags:self->_flags]; + for (PFWeakValue *value in self->_listenersArray) { [value.weakObject reachability:self didChangeReachabilityState:state]; } - dispatch_barrier_async(_synchronizationQueue, ^{ - [_listenersArray filterUsingPredicate:[NSPredicate predicateWithFormat:@"SELF.weakObject != nil"]]; + dispatch_barrier_async(self->_synchronizationQueue, ^{ + [self->_listenersArray filterUsingPredicate:[NSPredicate predicateWithFormat:@"SELF.weakObject != nil"]]; }); }); } @@ -167,7 +167,7 @@ - (void)_notifyAllListeners { - (void)setFlags:(SCNetworkReachabilityFlags)flags { dispatch_barrier_async(_synchronizationQueue, ^{ - _flags = flags; + self->_flags = flags; [self _notifyAllListeners]; }); } @@ -175,7 +175,7 @@ - (void)setFlags:(SCNetworkReachabilityFlags)flags { - (SCNetworkReachabilityFlags)flags { __block SCNetworkReachabilityFlags flags; dispatch_sync(_synchronizationQueue, ^{ - flags = _flags; + flags = self->_flags; }); return flags; } @@ -190,17 +190,17 @@ - (PFReachabilityState)currentState { - (void)_startMonitoringReachabilityWithURL:(NSURL *)url { dispatch_barrier_async(_synchronizationQueue, ^{ - _networkReachability = SCNetworkReachabilityCreateWithName(NULL, url.host.UTF8String); - if (_networkReachability != NULL) { + self->_networkReachability = SCNetworkReachabilityCreateWithName(NULL, url.host.UTF8String); + if (self->_networkReachability != NULL) { // Set the initial flags SCNetworkReachabilityFlags flags; - SCNetworkReachabilityGetFlags(_networkReachability, &flags); + SCNetworkReachabilityGetFlags(self->_networkReachability, &flags); self.flags = flags; // Set up notification for changes in reachability. SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL}; - if (SCNetworkReachabilitySetCallback(_networkReachability, _reachabilityCallback, &context)) { - if (!SCNetworkReachabilitySetDispatchQueue(_networkReachability, _synchronizationQueue)) { + if (SCNetworkReachabilitySetCallback(self->_networkReachability, _reachabilityCallback, &context)) { + if (!SCNetworkReachabilitySetDispatchQueue(self->_networkReachability, self->_synchronizationQueue)) { PFLogError(PFLoggingTagCommon, @"Unable to start listening for network connectivity status."); } } diff --git a/Parse/Parse/Internal/ParseManager.m b/Parse/Parse/Internal/ParseManager.m index ac3acc464..3d845686f 100644 --- a/Parse/Parse/Internal/ParseManager.m +++ b/Parse/Parse/Internal/ParseManager.m @@ -130,21 +130,21 @@ - (void)startManaging { - (void)loadOfflineStoreWithOptions:(PFOfflineStoreOptions)options { dispatch_barrier_sync(_offlineStoreAccessQueue, ^{ - PFConsistencyAssert(!_offlineStore, @"Can't load offline store more than once."); - _offlineStore = [[PFOfflineStore alloc] initWithFileManager:self.fileManager options:options]; + PFConsistencyAssert(!self->_offlineStore, @"Can't load offline store more than once."); + self->_offlineStore = [[PFOfflineStore alloc] initWithFileManager:self.fileManager options:options]; }); } - (void)setOfflineStore:(PFOfflineStore *)offlineStore { dispatch_barrier_sync(_offlineStoreAccessQueue, ^{ - _offlineStore = offlineStore; + self->_offlineStore = offlineStore; }); } - (PFOfflineStore *)offlineStore { __block PFOfflineStore *offlineStore = nil; dispatch_sync(_offlineStoreAccessQueue, ^{ - offlineStore = _offlineStore; + offlineStore = self->_offlineStore; }); return offlineStore; } @@ -165,12 +165,12 @@ - (PFEventuallyQueue *)eventuallyQueue { _eventuallyQueue = [PFMemoryEventuallyQueue newDefaultMemoryEventuallyQueueWithDataSource:self]; } #else - if (!_eventuallyQueue || - (self.offlineStoreLoaded && [_eventuallyQueue isKindOfClass:[PFCommandCache class]]) || - (!self.offlineStoreLoaded && [_eventuallyQueue isKindOfClass:[PFPinningEventuallyQueue class]])) { + if (!self->_eventuallyQueue || + (self.offlineStoreLoaded && [self->_eventuallyQueue isKindOfClass:[PFCommandCache class]]) || + (!self.offlineStoreLoaded && [self->_eventuallyQueue isKindOfClass:[PFPinningEventuallyQueue class]])) { PFCommandCache *commandCache = [self _newCommandCache]; - _eventuallyQueue = (self.offlineStoreLoaded ? + self->_eventuallyQueue = (self.offlineStoreLoaded ? [PFPinningEventuallyQueue newDefaultPinningEventuallyQueueWithDataSource:self] : commandCache); @@ -186,7 +186,7 @@ - (PFEventuallyQueue *)eventuallyQueue { } } #endif - queue = _eventuallyQueue; + queue = self->_eventuallyQueue; }); return queue; } @@ -202,10 +202,10 @@ - (PFCommandCache *)_newCommandCache { - (void)clearEventuallyQueue { dispatch_sync(_preloadQueue, ^{ - dispatch_sync(_eventuallyQueueAccessQueue, ^{ - [_eventuallyQueue removeAllCommands]; - [_eventuallyQueue pause]; - _eventuallyQueue = nil; + dispatch_sync(self->_eventuallyQueueAccessQueue, ^{ + [self->_eventuallyQueue removeAllCommands]; + [self->_eventuallyQueue pause]; + self->_eventuallyQueue = nil; }); }); } @@ -219,12 +219,12 @@ - (void)clearEventuallyQueue { - (PFKeychainStore *)keychainStore { __block PFKeychainStore *store = nil; dispatch_sync(_keychainStoreAccessQueue, ^{ - if (!_keychainStore) { + if (!self->_keychainStore) { NSString *bundleIdentifier = (self.configuration.containingApplicationBundleIdentifier ?: [NSBundle mainBundle].bundleIdentifier); NSString *service = [NSString stringWithFormat:@"%@.%@", bundleIdentifier, PFKeychainStoreDefaultService]; - _keychainStore = [[PFKeychainStore alloc] initWithService:service]; + self->_keychainStore = [[PFKeychainStore alloc] initWithService:service]; } - store = _keychainStore; + store = self->_keychainStore; }); return store; } @@ -234,11 +234,11 @@ - (PFKeychainStore *)keychainStore { - (PFFileManager *)fileManager { __block PFFileManager *fileManager = nil; dispatch_sync(_fileManagerAccessQueue, ^{ - if (!_fileManager) { - _fileManager = [[PFFileManager alloc] initWithApplicationIdentifier:self.configuration.applicationId + if (!self->_fileManager) { + self->_fileManager = [[PFFileManager alloc] initWithApplicationIdentifier:self.configuration.applicationId applicationGroupIdentifier:self.configuration.applicationGroupIdentifier]; } - fileManager = _fileManager; + fileManager = self->_fileManager; }); return fileManager; } @@ -248,10 +248,10 @@ - (PFFileManager *)fileManager { - (PFPersistenceController *)persistenceController { __block PFPersistenceController *controller = nil; dispatch_sync(_persistenceControllerAccessQueue, ^{ - if (!_persistenceController) { - _persistenceController = [self _createPersistenceController]; + if (!self->_persistenceController) { + self->_persistenceController = [self _createPersistenceController]; } - controller = _persistenceController; + controller = self->_persistenceController; }); return controller; } @@ -298,10 +298,10 @@ - (PFPersistenceController *)_createPersistenceController { - (PFInstallationIdentifierStore *)installationIdentifierStore { __block PFInstallationIdentifierStore *store = nil; dispatch_sync(_installationIdentifierStoreAccessQueue, ^{ - if (!_installationIdentifierStore) { - _installationIdentifierStore = [[PFInstallationIdentifierStore alloc] initWithDataSource:self]; + if (!self->_installationIdentifierStore) { + self->_installationIdentifierStore = [[PFInstallationIdentifierStore alloc] initWithDataSource:self]; } - store = _installationIdentifierStore; + store = self->_installationIdentifierStore; }); return store; } @@ -316,14 +316,14 @@ - (void)setCommandRunner:(id)commandRunner { - (id)commandRunner { __block id runner = nil; dispatch_sync(_commandRunnerAccessQueue, ^{ - if (!_commandRunner) { - _commandRunner = [PFURLSessionCommandRunner commandRunnerWithDataSource:self - retryAttempts:self.configuration.networkRetryAttempts - applicationId:self.configuration.applicationId - clientKey:self.configuration.clientKey - serverURL:[NSURL URLWithString:self.configuration.server]]; + if (!self->_commandRunner) { + self->_commandRunner = [PFURLSessionCommandRunner commandRunnerWithDataSource:self + retryAttempts:self.configuration.networkRetryAttempts + applicationId:self.configuration.applicationId + clientKey:self.configuration.clientKey + serverURL:[NSURL URLWithString:self.configuration.server]]; } - runner = _commandRunner; + runner = self->_commandRunner; }); return runner; } @@ -333,11 +333,11 @@ - (void)setCommandRunner:(id)commandRunner { - (PFKeyValueCache *)keyValueCache { __block PFKeyValueCache *cache = nil; dispatch_sync(_keyValueCacheAccessQueue, ^{ - if (!_keyValueCache) { + if (!self->_keyValueCache) { NSString *path = [self.fileManager parseCacheItemPathForPathComponent:@"../ParseKeyValueCache/"]; - _keyValueCache = [[PFKeyValueCache alloc] initWithCacheDirectoryPath:path]; + self->_keyValueCache = [[PFKeyValueCache alloc] initWithCacheDirectoryPath:path]; } - cache = _keyValueCache; + cache = self->_keyValueCache; }); return cache; } @@ -347,17 +347,17 @@ - (PFKeyValueCache *)keyValueCache { - (PFCoreManager *)coreManager { __block PFCoreManager *manager = nil; dispatch_sync(_coreManagerAccessQueue, ^{ - if (!_coreManager) { - _coreManager = [PFCoreManager managerWithDataSource:self]; + if (!self->_coreManager) { + self->_coreManager = [PFCoreManager managerWithDataSource:self]; } - manager = _coreManager; + manager = self->_coreManager; }); return manager; } - (void)unloadCoreManager { dispatch_sync(_coreManagerAccessQueue, ^{ - _coreManager = nil; + self->_coreManager = nil; }); } @@ -368,17 +368,17 @@ - (void)unloadCoreManager { - (PFPushManager *)pushManager { __block PFPushManager *manager = nil; dispatch_sync(_pushManagerAccessQueue, ^{ - if (!_pushManager) { - _pushManager = [PFPushManager managerWithCommonDataSource:self coreDataSource:self.coreManager]; + if (!self->_pushManager) { + self->_pushManager = [PFPushManager managerWithCommonDataSource:self coreDataSource:self.coreManager]; } - manager = _pushManager; + manager = self->_pushManager; }); return manager; } - (void)setPushManager:(PFPushManager *)pushManager { dispatch_sync(_pushManagerAccessQueue, ^{ - _pushManager = pushManager; + self->_pushManager = pushManager; }); } @@ -389,18 +389,18 @@ - (void)setPushManager:(PFPushManager *)pushManager { - (PFAnalyticsController *)analyticsController { __block PFAnalyticsController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_analyticsController) { - _analyticsController = [[PFAnalyticsController alloc] initWithDataSource:self]; + if (!self->_analyticsController) { + self->_analyticsController = [[PFAnalyticsController alloc] initWithDataSource:self]; } - controller = _analyticsController; + controller = self->_analyticsController; }); return controller; } - (void)setAnalyticsController:(PFAnalyticsController *)analyticsController { dispatch_sync(_controllerAccessQueue, ^{ - if (_analyticsController != analyticsController) { - _analyticsController = analyticsController; + if (self->_analyticsController != analyticsController) { + self->_analyticsController = analyticsController; } }); } @@ -412,17 +412,17 @@ - (void)setAnalyticsController:(PFAnalyticsController *)analyticsController { - (PFPurchaseController *)purchaseController { __block PFPurchaseController *controller = nil; dispatch_sync(_controllerAccessQueue, ^{ - if (!_purchaseController) { - _purchaseController = [PFPurchaseController controllerWithDataSource:self bundle:[NSBundle mainBundle]]; + if (!self->_purchaseController) { + self->_purchaseController = [PFPurchaseController controllerWithDataSource:self bundle:[NSBundle mainBundle]]; } - controller = _purchaseController; + controller = self->_purchaseController; }); return controller; } - (void)setPurchaseController:(PFPurchaseController *)purchaseController { dispatch_sync(_controllerAccessQueue, ^{ - _purchaseController = purchaseController; + self->_purchaseController = purchaseController; }); } diff --git a/Parse/Parse/Internal/Persistence/Group/PFUserDefaultsPersistenceGroup.m b/Parse/Parse/Internal/Persistence/Group/PFUserDefaultsPersistenceGroup.m index cbe8c9052..88b4d28ae 100644 --- a/Parse/Parse/Internal/Persistence/Group/PFUserDefaultsPersistenceGroup.m +++ b/Parse/Parse/Internal/Persistence/Group/PFUserDefaultsPersistenceGroup.m @@ -48,7 +48,7 @@ - (instancetype)initWithKey:(NSString *)key userDefaults:(NSUserDefaults *)userD - (BFTask *)getDataAsyncForKey:(NSString *)key { return [_dataAccessQueue enqueue:^id(BFTask *task) { return [[self _loadUserDefaultsIfNeededAsync] continueWithSuccessBlock:^id(BFTask *task) { - return _dataDictionary[key]; + return self->_dataDictionary[key]; }]; }]; } @@ -56,7 +56,7 @@ - (instancetype)initWithKey:(NSString *)key userDefaults:(NSUserDefaults *)userD - (BFTask *)setDataAsync:(NSData *)data forKey:(NSString *)key { return [_dataAccessQueue enqueue:^id(BFTask *task) { return [[self _loadUserDefaultsIfNeededAsync] continueWithSuccessBlock:^id(BFTask *task) { - _dataDictionary[key] = data; + self->_dataDictionary[key] = data; return [self _writeUserDefaultsAsync]; }]; }]; @@ -65,7 +65,7 @@ - (BFTask *)setDataAsync:(NSData *)data forKey:(NSString *)key { - (BFTask *)removeDataAsyncForKey:(NSString *)key { return [_dataAccessQueue enqueue:^id(BFTask *task) { return [[self _loadUserDefaultsIfNeededAsync] continueWithSuccessBlock:^id(BFTask *task) { - [_dataDictionary removeObjectForKey:key]; + [self->_dataDictionary removeObjectForKey:key]; return [self _writeUserDefaultsAsync]; }]; }]; @@ -74,7 +74,7 @@ - (BFTask *)removeDataAsyncForKey:(NSString *)key { - (BFTask *)removeAllDataAsync { return [_dataAccessQueue enqueue:^id(BFTask *task) { return [[self _loadUserDefaultsIfNeededAsync] continueWithSuccessBlock:^id(BFTask *task) { - [_dataDictionary removeAllObjects]; + [self->_dataDictionary removeAllObjects]; return [self _writeUserDefaultsAsync]; }]; }]; @@ -94,9 +94,9 @@ - (BFTask *)endLockedContentAccessAsyncToDataForKey:(NSString *)key { - (BFTask *)_loadUserDefaultsIfNeededAsync { return [BFTask taskFromExecutor:[BFExecutor defaultExecutor] withBlock:^id{ - if (!_dataDictionary) { - NSDictionary *dictionary = [_userDefaults objectForKey:self.key]; - _dataDictionary = (dictionary ? [dictionary mutableCopy] : [NSMutableDictionary dictionary]); + if (!self->_dataDictionary) { + NSDictionary *dictionary = [self->_userDefaults objectForKey:self.key]; + self->_dataDictionary = (dictionary ? [dictionary mutableCopy] : [NSMutableDictionary dictionary]); } return nil; }]; @@ -104,7 +104,7 @@ - (BFTask *)_loadUserDefaultsIfNeededAsync { - (BFTask *)_writeUserDefaultsAsync { return [BFTask taskFromExecutor:[BFExecutor defaultExecutor] withBlock:^id{ - [_userDefaults setObject:_dataDictionary forKey:self.key]; + [self->_userDefaults setObject:self->_dataDictionary forKey:self.key]; return nil; }]; } diff --git a/Parse/Parse/Internal/Persistence/PFPersistenceController.m b/Parse/Parse/Internal/Persistence/PFPersistenceController.m index 12251a282..988b9cfab 100644 --- a/Parse/Parse/Internal/Persistence/PFPersistenceController.m +++ b/Parse/Parse/Internal/Persistence/PFPersistenceController.m @@ -54,8 +54,8 @@ - (instancetype)initWithApplicationIdentifier:(nonnull NSString *)applicationIde - (BFTask> *)getPersistenceGroupAsync { return [_dataQueue enqueue:^id(BFTask *task) { - if (_persistenceGroup) { - return _persistenceGroup; + if (self->_persistenceGroup) { + return self->_persistenceGroup; } return [self _loadPersistenceGroup]; }]; @@ -74,9 +74,9 @@ - (instancetype)initWithApplicationIdentifier:(nonnull NSString *)applicationIde #endif }] continueWithSuccessBlock:^id(BFTask> *task) { id group = task.result; - return [_groupValidationHandler(group) continueWithSuccessBlock:^id(BFTask *_) { - _persistenceGroup = group; - return _persistenceGroup; + return [self->_groupValidationHandler(group) continueWithSuccessBlock:^id(BFTask *_) { + self->_persistenceGroup = group; + return self->_persistenceGroup; }]; }]; } @@ -94,7 +94,7 @@ - (instancetype)initWithApplicationIdentifier:(nonnull NSString *)applicationIde }] continueWithSuccessBlock:^id(BFTask *task) { NSString *storagePath = task.result; PFFilePersistenceGroupOptions options = 0; - if (_applicationGroupIdentifier) { + if (self->_applicationGroupIdentifier) { options |= PFFilePersistenceGroupOptionUseFileLocks; } return [[PFFilePersistenceGroup alloc] initWithStorageDirectoryPath:storagePath options:options]; diff --git a/Parse/Parse/Internal/Purchase/Controller/PFPurchaseController.m b/Parse/Parse/Internal/Purchase/Controller/PFPurchaseController.m index 494c4b32a..04054dffb 100644 --- a/Parse/Parse/Internal/Purchase/Controller/PFPurchaseController.m +++ b/Parse/Parse/Internal/Purchase/Controller/PFPurchaseController.m @@ -78,10 +78,10 @@ - (BFTask *)findProductsAsyncWithIdentifiers:(NSSet *)productIdentifiers { @strongify(self); Class requestClass = self.productsRequestClass ?: [SKProductsRequest class]; SKProductsRequest *request = [[requestClass alloc] initWithProductIdentifiers:productIdentifiers]; - _currentProductsRequestHandler = [[PFProductsRequestHandler alloc] initWithProductsRequest:request]; - return [_currentProductsRequestHandler findProductsAsync]; + self->_currentProductsRequestHandler = [[PFProductsRequestHandler alloc] initWithProductsRequest:request]; + return [self->_currentProductsRequestHandler findProductsAsync]; }] continueWithSuccessBlock:^id(BFTask *task) { - _currentProductsRequestHandler = nil; + self->_currentProductsRequestHandler = nil; return task; }]; } diff --git a/Parse/Parse/Internal/Push/Manager/PFPushManager.m b/Parse/Parse/Internal/Push/Manager/PFPushManager.m index a0f5c5cf9..ee7cb2dd5 100644 --- a/Parse/Parse/Internal/Push/Manager/PFPushManager.m +++ b/Parse/Parse/Internal/Push/Manager/PFPushManager.m @@ -53,17 +53,17 @@ + (instancetype)managerWithCommonDataSource:(id)commonD - (PFPushController *)pushController { __block PFPushController *controller; dispatch_sync(_controllerAccessQueue, ^{ - if (!_pushController) { - _pushController = [PFPushController controllerWithCommandRunner:self.commonDataSource.commandRunner]; + if (!self->_pushController) { + self->_pushController = [PFPushController controllerWithCommandRunner:self.commonDataSource.commandRunner]; } - controller = _pushController; + controller = self->_pushController; }); return controller; } - (void)setPushController:(PFPushController *)pushController { dispatch_sync(_controllerAccessQueue, ^{ - _pushController = pushController; + self->_pushController = pushController; }); } @@ -74,17 +74,17 @@ - (void)setPushController:(PFPushController *)pushController { - (PFPushChannelsController *)channelsController { __block PFPushChannelsController *controller; dispatch_sync(_controllerAccessQueue, ^{ - if (!_channelsController) { - _channelsController = [PFPushChannelsController controllerWithDataSource:self.coreDataSource]; + if (!self->_channelsController) { + self->_channelsController = [PFPushChannelsController controllerWithDataSource:self.coreDataSource]; } - controller = _channelsController; + controller = self->_channelsController; }); return controller; } - (void)setChannelsController:(PFPushChannelsController *)channelsController { dispatch_sync(_controllerAccessQueue, ^{ - _channelsController = channelsController; + self->_channelsController = channelsController; }); } diff --git a/Parse/Parse/Internal/Query/Controller/PFOfflineQueryController.m b/Parse/Parse/Internal/Query/Controller/PFOfflineQueryController.m index eb3348e92..4771ba328 100644 --- a/Parse/Parse/Internal/Query/Controller/PFOfflineQueryController.m +++ b/Parse/Parse/Internal/Query/Controller/PFOfflineQueryController.m @@ -95,7 +95,7 @@ - (BFTask *)_findObjectsAsyncInRelation:(PFRelation *)relation [relation _addKnownObject:object]; } - return [[_offlineStore updateDataForObjectAsync:parentObject] continueWithBlock:^id(BFTask *task) { + return [[self->_offlineStore updateDataForObjectAsync:parentObject] continueWithBlock:^id(BFTask *task) { // Roll-forward the result of find task instead of a result of update task. return fetchTask; } cancellationToken:cancellationToken]; @@ -121,7 +121,7 @@ - (BFTask *)_findObjectsFromLocalDatastoreAsyncForQueryState:(PFQueryState *)que return nil; }] continueWithSuccessBlock:^id(BFTask *task) { PFPin *pin = task.result; - return [_offlineStore findAsyncForQueryState:queryState user:user pin:pin]; + return [self->_offlineStore findAsyncForQueryState:queryState user:user pin:pin]; } cancellationToken:cancellationToken]; } @@ -158,7 +158,7 @@ - (BFTask *)_countObjectsFromLocalDatastoreAsyncForQueryState:(PFQueryState *)qu return nil; }] continueWithSuccessBlock:^id(BFTask *task) { PFPin *pin = task.result; - return [_offlineStore countAsyncForQueryState:queryState user:user pin:pin]; + return [self->_offlineStore countAsyncForQueryState:queryState user:user pin:pin]; } cancellationToken:cancellationToken]; } diff --git a/Parse/Parse/Internal/User/AuthenticationProviders/Controller/PFUserAuthenticationController.m b/Parse/Parse/Internal/User/AuthenticationProviders/Controller/PFUserAuthenticationController.m index e4a70a7a5..87438b76c 100644 --- a/Parse/Parse/Internal/User/AuthenticationProviders/Controller/PFUserAuthenticationController.m +++ b/Parse/Parse/Internal/User/AuthenticationProviders/Controller/PFUserAuthenticationController.m @@ -58,7 +58,7 @@ - (void)registerAuthenticationDelegate:(id)delegat PFParameterAssert(![self authenticationDelegateForAuthType:authType], @"Authentication delegate already registered for authType `%@`.", authType); dispatch_sync(_dataAccessQueue, ^{ - _authenticationDelegates[authType] = delegate; + self->_authenticationDelegates[authType] = delegate; }); // TODO: (nlutsenko) Decouple this further. @@ -74,7 +74,7 @@ - (void)unregisterAuthenticationDelegateForAuthType:(NSString *)authType { return; } dispatch_sync(_dataAccessQueue, ^{ - [_authenticationDelegates removeObjectForKey:authType]; + [self->_authenticationDelegates removeObjectForKey:authType]; }); } @@ -85,7 +85,7 @@ - (void)unregisterAuthenticationDelegateForAuthType:(NSString *)authType { __block id delegate = nil; dispatch_sync(_dataAccessQueue, ^{ - delegate = _authenticationDelegates[authType]; + delegate = self->_authenticationDelegates[authType]; }); return delegate; } diff --git a/Parse/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m b/Parse/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m index ff4d14f7c..67dc52490 100644 --- a/Parse/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m +++ b/Parse/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m @@ -98,9 +98,9 @@ - (BFTask *)_getCurrentUserAsyncWithOptions:(PFCurrentUserLoadingOptions)options return [BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{ __block BOOL matchesDisk = NO; __block PFUser *currentUser = nil; - dispatch_sync(_dataQueue, ^{ - matchesDisk = _currentUserMatchesDisk; - currentUser = _currentUser; + dispatch_sync(self->_dataQueue, ^{ + matchesDisk = self->_currentUserMatchesDisk; + currentUser = self->_currentUser; }); if (currentUser) { return currentUser; @@ -123,9 +123,9 @@ - (BFTask *)_getCurrentUserAsyncWithOptions:(PFCurrentUserLoadingOptions)options } return user; }] continueWithBlock:^id(BFTask *task) { - dispatch_barrier_sync(_dataQueue, ^{ - _currentUser = task.result; - _currentUserMatchesDisk = !task.faulted; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentUser = task.result; + self->_currentUserMatchesDisk = !task.faulted; }); return task; }] continueWithBlock:^id(BFTask *task) { @@ -141,8 +141,8 @@ - (BFTask *)_getCurrentUserAsyncWithOptions:(PFCurrentUserLoadingOptions)options - (BFTask *)_saveCurrentUserAsync:(PFUser *)user { return [BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{ __block PFUser *currentUser = nil; - dispatch_sync(_dataQueue, ^{ - currentUser = _currentUser; + dispatch_sync(self->_dataQueue, ^{ + currentUser = self->_currentUser; }); BFTask *task = [BFTask taskWithResult:nil]; @@ -159,9 +159,9 @@ - (BFTask *)_saveCurrentUserAsync:(PFUser *)user { } return [self _saveCurrentUserToDiskAsync:user]; }] continueWithBlock:^id(BFTask *task) { - dispatch_barrier_sync(_dataQueue, ^{ - _currentUser = user; - _currentUserMatchesDisk = !task.faulted && !task.cancelled; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentUser = user; + self->_currentUserMatchesDisk = !task.faulted && !task.cancelled; }); return user; }]; @@ -192,9 +192,9 @@ - (BFTask *)logOutCurrentUserAsync { [self _deleteSensitiveUserDataFromKeychainWithItemName:PFUserCurrentUserFileName]; BFTask *logoutTask = [[BFTask taskForCompletionOfAllTasks:@[ fileTask, unpinTask ]] continueWithBlock:^id(BFTask *task) { - dispatch_barrier_sync(_dataQueue, ^{ - _currentUser = nil; - _currentUserMatchesDisk = YES; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentUser = nil; + self->_currentUserMatchesDisk = YES; }); return nil; }]; @@ -347,9 +347,9 @@ - (BFTask *)_lazyLogInUser { return [[self _saveCurrentUserAsync:user] continueWithSuccessResult:user]; } - dispatch_barrier_sync(_dataQueue, ^{ - _currentUser = user; - _currentUserMatchesDisk = YES; + dispatch_barrier_sync(self->_dataQueue, ^{ + self->_currentUser = user; + self->_currentUserMatchesDisk = YES; }); return user; }]; diff --git a/Parse/Parse/PFFile.m b/Parse/Parse/PFFile.m index 3ca52eddc..bd20aca5c 100644 --- a/Parse/Parse/PFFile.m +++ b/Parse/Parse/PFFile.m @@ -413,12 +413,12 @@ - (NSInputStream *)_cachedDataStream { - (BOOL)_stageWithData:(NSData *)data error:(NSError * __autoreleasing *)error { __block BOOL result = NO; [self _performDataAccessBlock:^{ - _stagedFilePath = [[[[self class] fileController].fileStagingController stageFileAsyncWithData:data - name:self.state.name - uniqueId:(uintptr_t)self] + self->_stagedFilePath = [[[[self class] fileController].fileStagingController stageFileAsyncWithData:data + name:self.state.name + uniqueId:(uintptr_t)self] waitForResult:error withMainThreadWarning:NO]; - result = (_stagedFilePath != nil); + result = (self->_stagedFilePath != nil); }]; return result; } @@ -426,12 +426,12 @@ - (BOOL)_stageWithData:(NSData *)data error:(NSError * __autoreleasing *)error { - (BOOL)_stageWithPath:(NSString *)path error:(NSError * __autoreleasing *)error { __block BOOL result = NO; [self _performDataAccessBlock:^{ - _stagedFilePath = [[[[self class] fileController].fileStagingController stageFileAsyncAtPath:path - name:self.state.name - uniqueId:(uintptr_t)self] + self->_stagedFilePath = [[[[self class] fileController].fileStagingController stageFileAsyncAtPath:path + name:self.state.name + uniqueId:(uintptr_t)self] waitForResult:error withMainThreadWarning:NO]; - result = (_stagedFilePath != nil); + result = (self->_stagedFilePath != nil); }]; return result; } diff --git a/Parse/Parse/PFNetworkActivityIndicatorManager.m b/Parse/Parse/PFNetworkActivityIndicatorManager.m index eb5ac2680..0cd9159a1 100644 --- a/Parse/Parse/PFNetworkActivityIndicatorManager.m +++ b/Parse/Parse/PFNetworkActivityIndicatorManager.m @@ -73,7 +73,7 @@ - (void)dealloc { - (void)setNetworkActivityCount:(NSUInteger)networkActivityCount { dispatch_sync(_networkActivityAccessQueue, ^{ - _networkActivityCount = networkActivityCount; + self->_networkActivityCount = networkActivityCount; }); dispatch_async(dispatch_get_main_queue(), ^{ [self _updateNetworkActivityIndicatorVisibilityAfterDelay]; @@ -83,7 +83,7 @@ - (void)setNetworkActivityCount:(NSUInteger)networkActivityCount { - (NSUInteger)networkActivityCount { __block NSUInteger count = 0; dispatch_sync(_networkActivityAccessQueue, ^{ - count = _networkActivityCount; + count = self->_networkActivityCount; }); return count; } @@ -98,7 +98,7 @@ - (BOOL)isNetworkActivityIndicatorVisible { - (void)incrementActivityCount { dispatch_sync(_networkActivityAccessQueue, ^{ - _networkActivityCount++; + self->_networkActivityCount++; }); dispatch_async(dispatch_get_main_queue(), ^{ [self _updateNetworkActivityIndicatorVisibilityAfterDelay]; @@ -107,7 +107,7 @@ - (void)incrementActivityCount { - (void)decrementActivityCount { dispatch_sync(_networkActivityAccessQueue, ^{ - _networkActivityCount = MAX(_networkActivityCount - 1, 0); + self->_networkActivityCount = MAX(self->_networkActivityCount - 1, 0); }); dispatch_async(dispatch_get_main_queue(), ^{ [self _updateNetworkActivityIndicatorVisibilityAfterDelay]; diff --git a/Parse/Parse/PFObject.m b/Parse/Parse/PFObject.m index 574903172..20487ddfb 100644 --- a/Parse/Parse/PFObject.m +++ b/Parse/Parse/PFObject.m @@ -1001,8 +1001,8 @@ - (BOOL)mergeFromRESTDictionary:(NSDictionary *)object withDecoder:(PFDecoder *) // Check if queue already contains this operation set and discard it if does if (![self _containsOperationSet:operationSet]) { // Insert the `saveEventually` operationSet before the last operation set at all times. - NSUInteger index = (operationSetQueue.count == 0 ? 0 : operationSetQueue.count - 1); - [operationSetQueue insertObject:operationSet atIndex:index]; + NSUInteger index = (self->operationSetQueue.count == 0 ? 0 : self->operationSetQueue.count - 1); + [self->operationSetQueue insertObject:operationSet atIndex:index]; [self _enqueueSaveEventuallyOperationAsync:operationSet]; } @@ -1031,9 +1031,9 @@ - (BOOL)mergeFromRESTDictionary:(NSDictionary *)object withDecoder:(PFDecoder *) *stop = YES; return; } - NSUInteger index = [operationSetQueue indexOfObject:localOperationSet]; + NSUInteger index = [self->operationSetQueue indexOfObject:localOperationSet]; [remoteOperationSet mergeOperationSet:localOperationSet]; - operationSetQueue[index] = remoteOperationSet; + self->operationSetQueue[index] = remoteOperationSet; } return; @@ -1045,11 +1045,11 @@ - (BOOL)mergeFromRESTDictionary:(NSDictionary *)object withDecoder:(PFDecoder *) return; } if ([key isEqualToString:PFObjectIsDeletingEventuallyRESTKey]) { - _deletingEventuallyCount = [obj unsignedIntegerValue]; + self->_deletingEventuallyCount = [obj unsignedIntegerValue]; return; } - [_availableKeys addObject:key]; + [self->_availableKeys addObject:key]; // If server data in dictionary is older - don't merge it. if (!mergeServerData) { @@ -1122,7 +1122,7 @@ - (BFTask *)_enqueueSaveEventuallyWithChildren:(BOOL)saveChildren { return [[toAwait continueAsyncWithBlock:^id(BFTask *task) { return [self _validateSaveEventuallyAsync]; }] continueWithSuccessBlock:^id(BFTask *task) { - @synchronized (lock) { + @synchronized (self->lock) { [self _objectWillSave]; if (![self isDirty:NO]) { return @YES; @@ -1138,7 +1138,7 @@ - (BFTask *)_enqueueSaveEventuallyWithChildren:(BOOL)saveChildren { return [saveChildrenTask continueWithSuccessBlock:^id(BFTask *task) { BFTask *saveTask = nil; - @synchronized (lock) { + @synchronized (self->lock) { // Snapshot the current set of changes, and push a new changeset into the queue. PFOperationSet *changes = [self unsavedChanges]; changes.saveEventually = YES; @@ -1319,7 +1319,7 @@ - (void)removeOldKeysAfterFetch:(NSDictionary *)result { NSArray *removedKeys = removedDictionary.allKeys; [state removeServerDataObjectsForKeys:removedKeys]; - [_availableKeys minusSet:[NSSet setWithArray:removedKeys]]; + [self->_availableKeys minusSet:[NSSet setWithArray:removedKeys]]; }]; } } @@ -1415,7 +1415,7 @@ - (BFTask *)handleSaveResultAsync:(NSDictionary *)result { } return [task continueWithBlock:^id(BFTask *task) { - @synchronized (lock) { + @synchronized (self->lock) { if (self.saveDelegate) { [self.saveDelegate invoke:self error:nil]; } @@ -1448,7 +1448,7 @@ - (BFTask *)saveAsync:(BFTask *)toAwait { } return nil; }] continueWithBlock:^id(BFTask *task) { - @synchronized (lock) { + @synchronized (self->lock) { if (![self isDirty:YES]) { return @YES; } @@ -1461,7 +1461,7 @@ - (BFTask *)saveAsync:(BFTask *)toAwait { [self startSave]; BFTask *childrenTask = [self _saveChildrenInBackgroundWithCurrentUser:currentUser sessionToken:sessionToken]; - if (!dirty && changes.count == 0) { + if (!self->dirty && changes.count == 0) { return childrenTask; } return [[childrenTask continueWithSuccessBlock:^id(BFTask *task) { @@ -1972,8 +1972,8 @@ - (BFTask *)deleteEventually { return [[toAwait continueAsyncWithBlock:^id(BFTask *task) { return [self _validateDeleteAsync]; }] continueWithSuccessBlock:^id(BFTask *task) { - @synchronized (lock) { - _deletingEventuallyCount += 1; + @synchronized (self->lock) { + self->_deletingEventuallyCount += 1; PFOfflineStore *store = [Parse _currentManager].offlineStore; BFTask *updateDataTask = store ? [store updateDataForObjectAsync:self] : [BFTask taskWithResult:nil]; diff --git a/Parse/Parse/PFQuery.m b/Parse/Parse/PFQuery.m index e3293ce09..56911feb0 100644 --- a/Parse/Parse/PFQuery.m +++ b/Parse/Parse/PFQuery.m @@ -768,8 +768,8 @@ - (BFTask *)_findObjectsAsyncForQueryState:(PFQueryState *)queryState after:(BFT return task; } @synchronized (self) { - if (_cancellationTokenSource == cancellationTokenSource) { - _cancellationTokenSource = nil; + if (self->_cancellationTokenSource == cancellationTokenSource) { + self->_cancellationTokenSource = nil; } } return task; @@ -867,8 +867,8 @@ - (BFTask *)_countObjectsAsyncForQueryState:(PFQueryState *)queryState after:(BF user:user]; }] continueWithBlock:^id(BFTask *task) { @synchronized(self) { - if (_cancellationTokenSource == cancellationTokenSource) { - _cancellationTokenSource = nil; + if (self->_cancellationTokenSource == cancellationTokenSource) { + self->_cancellationTokenSource = nil; } } return task; @@ -881,9 +881,9 @@ - (BFTask *)_countObjectsAsyncForQueryState:(PFQueryState *)queryState after:(BF - (void)cancel { @synchronized(self) { - if (_cancellationTokenSource) { - [_cancellationTokenSource cancel]; - _cancellationTokenSource = nil; + if (self->_cancellationTokenSource) { + [self->_cancellationTokenSource cancel]; + self->_cancellationTokenSource = nil; } } } diff --git a/Parse/Parse/PFUser.m b/Parse/Parse/PFUser.m index 4f472ff94..941302b8a 100644 --- a/Parse/Parse/PFUser.m +++ b/Parse/Parse/PFUser.m @@ -517,9 +517,9 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait { NSArray *oldAnonymousData = currentUser.authData[PFAnonymousUserAuthenticationType]; // Move the changes to this object over to the currentUser object. - PFOperationSet *selfOperations = operationSetQueue[0]; - [operationSetQueue removeAllObjects]; - [operationSetQueue addObject:[[PFOperationSet alloc] init]]; + PFOperationSet *selfOperations = self->operationSetQueue[0]; + [self->operationSetQueue removeAllObjects]; + [self->operationSetQueue addObject:[[PFOperationSet alloc] init]]; for (NSString *key in selfOperations) { currentUser[key] = selfOperations[key]; } @@ -542,7 +542,7 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait { } @synchronized(self.lock) { - operationSetQueue[0] = selfOperations; + self->operationSetQueue[0] = selfOperations; [self rebuildEstimatedData]; } } @@ -883,7 +883,7 @@ + (void)registerAuthenticationDelegate:(id)delegat oldAnonymousData = self.authData[PFAnonymousUserAuthenticationType]; [self stripAnonymity]; - dirty = YES; + self->dirty = YES; } return [[self saveAsync:nil] continueAsyncWithBlock:^id(BFTask *task) { @@ -914,7 +914,7 @@ - (BFTask *)unlinkWithAuthTypeInBackground:(NSString *)authType { @synchronized (self.lock) { if (self.authData[authType]) { self.authData[authType] = [NSNull null]; - dirty = YES; + self->dirty = YES; return [self saveInBackground]; } } diff --git a/Vendor/xctoolchain b/Vendor/xctoolchain index d24b2e8d0..1dcfb1bb5 160000 --- a/Vendor/xctoolchain +++ b/Vendor/xctoolchain @@ -1 +1 @@ -Subproject commit d24b2e8d0049917ac88576b65c4f32d62a9a4ebd +Subproject commit 1dcfb1bb57695ba56a084913f64b87de943fec5f From bb7563b85f74028d5af91f5bad97ffe2662415a4 Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Wed, 14 Feb 2018 12:06:44 -0500 Subject: [PATCH 2/2] Fixes warnings in TwitterUtils --- .../ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m | 2 +- ParseTwitterUtils/ParseTwitterUtils/PF_Twitter.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ParseTwitterUtils/ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m b/ParseTwitterUtils/ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m index 47d1d37a2..7ea1de217 100644 --- a/ParseTwitterUtils/ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m +++ b/ParseTwitterUtils/ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m @@ -357,7 +357,7 @@ - (void)dismissAnimated:(BOOL)animated { __strong typeof(wself) sself = wself; [sself _removeObservers]; [sself removeFromSuperview]; - [_modalBackgroundView removeFromSuperview]; + [sself->_modalBackgroundView removeFromSuperview]; }; if (animated) { diff --git a/ParseTwitterUtils/ParseTwitterUtils/PF_Twitter.m b/ParseTwitterUtils/ParseTwitterUtils/PF_Twitter.m index 6e87e7b77..4852cf25a 100644 --- a/ParseTwitterUtils/ParseTwitterUtils/PF_Twitter.m +++ b/ParseTwitterUtils/ParseTwitterUtils/PF_Twitter.m @@ -422,7 +422,7 @@ - (BFTask *)_performWebViewAuthAsync { return; } - NSArray *accounts = [_accountStore accountsWithAccountType:twitterType]; + NSArray *accounts = [self->_accountStore accountsWithAccountType:twitterType]; // No accounts - provide an empty result if ([accounts count] == 0) {