diff --git a/CouchbaseLite.xcodeproj/project.pbxproj b/CouchbaseLite.xcodeproj/project.pbxproj index 849d63a9b..43559f3f7 100644 --- a/CouchbaseLite.xcodeproj/project.pbxproj +++ b/CouchbaseLite.xcodeproj/project.pbxproj @@ -5566,7 +5566,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "source \"$SCRIPT_INPUT_FILE_0\"\n"; + shellScript = "source \"$SCRIPT_INPUT_FILE_0\"\necho \"Private headers removed\"\n"; }; 93CED8D52048B3D600E6F0A4 /* Remove private headers */ = { isa = PBXShellScriptBuildPhase; @@ -5581,7 +5581,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "source \"$SCRIPT_INPUT_FILE_0\""; + shellScript = "source \"$SCRIPT_INPUT_FILE_0\"\necho \"Private headers removed\"\n"; }; 93D118ED1F560232000F6D3E /* Check Git Commit */ = { isa = PBXShellScriptBuildPhase; diff --git a/Objective-C/CBLDocument.mm b/Objective-C/CBLDocument.mm index 626b4349c..36be39784 100644 --- a/Objective-C/CBLDocument.mm +++ b/Objective-C/CBLDocument.mm @@ -174,7 +174,7 @@ - (void) updateDictionary { } _root.reset(new MRoot(new cbl::DocContext(db, _c4Doc), Dict(_fleeceData), self.isMutable)); [db safeBlock:^{ - _dict = _root->asNative(); + self->_dict = self->_root->asNative(); }]; } else { // New document: diff --git a/Objective-C/CBLQuery.mm b/Objective-C/CBLQuery.mm index b0d4ef04c..b8af7680a 100644 --- a/Objective-C/CBLQuery.mm +++ b/Objective-C/CBLQuery.mm @@ -202,7 +202,7 @@ - (instancetype) initWithSelect: (NSArray*)select - (void) dealloc { [self.database safeBlock:^{ - c4query_release(_c4Query); + c4query_release(self->_c4Query); }]; } @@ -236,7 +236,7 @@ - (void) setParameters: (CBLQueryParameters*)parameters { _parameters = [[CBLQueryParameters alloc] initWithParameters: parameters readonly: YES]; [self.database safeBlock:^{ - c4query_setParameters(_c4Query, {params.bytes, params.length}); + c4query_setParameters(self->_c4Query, {params.bytes, params.length}); }]; } else @@ -247,7 +247,7 @@ - (void) setParameters: (CBLQueryParameters*)parameters { - (NSString*) explain: (NSError**)outError { __block NSString* result; [self.database safeBlock: ^{ - result = sliceResult2string(c4query_explain(_c4Query)); + result = sliceResult2string(c4query_explain(self->_c4Query)); }]; return result; @@ -258,7 +258,7 @@ - (nullable CBLQueryResultSet*) execute: (NSError**)outError { __block C4QueryEnumerator* e; __block C4Error c4Err; [self.database safeBlock:^{ - e = c4query_run(_c4Query, kC4SliceNull, &c4Err); + e = c4query_run(self->_c4Query, kC4SliceNull, &c4Err); }]; if (!e) { @@ -352,13 +352,13 @@ - (BOOL) compile: (NSError**)outError { __block C4Error c4Err; __block C4Query* query; [self.database safeBlock:^{ - if (_language == kC4JSONQuery) { - assert(_json); + if (self->_language == kC4JSONQuery) { + assert(self->_json); query = c4query_new2(self.database.c4db, - kC4JSONQuery, {_json.bytes, _json.length}, nullptr, &c4Err); + kC4JSONQuery, {self->_json.bytes, self->_json.length}, nullptr, &c4Err); } else { - assert(_expressions); - CBLStringBytes exp(_expressions); + assert(self->_expressions); + CBLStringBytes exp(self->_expressions); query = c4query_new2(self.database.c4db, kC4N1QLQuery, exp, nullptr, &c4Err); } }]; diff --git a/Objective-C/CBLQueryResult.mm b/Objective-C/CBLQueryResult.mm index 7b2a530e7..dbe77abc0 100644 --- a/Objective-C/CBLQueryResult.mm +++ b/Objective-C/CBLQueryResult.mm @@ -293,7 +293,7 @@ - (id) fleeceValueToObjectAtIndex: (NSUInteger)index { __block id result; [_rs.database safeBlock:^{ - MRoot root(_context, value, false); + MRoot root(self->_context, value, false); result = root.asNative(); }]; return result; diff --git a/Objective-C/CBLQueryResultSet.mm b/Objective-C/CBLQueryResultSet.mm index 7e146d295..6b85c4b76 100644 --- a/Objective-C/CBLQueryResultSet.mm +++ b/Objective-C/CBLQueryResultSet.mm @@ -95,16 +95,16 @@ - (void) dealloc { - (id) nextObject { __block id row = nil; [self.database safeBlock: ^{ - if (_isAllEnumerated) + if (self->_isAllEnumerated) return; - if (c4queryenum_next(_c4enum, &_error)) { + if (c4queryenum_next(self->_c4enum, &self->_error)) { row = self.currentObject; - } else if (_error.code) { - CBLWarnError(Query, @"%@[%p] error: %d/%d", [self class], self, _error.domain, _error.code); + } else if (self->_error.code) { + CBLWarnError(Query, @"%@[%p] error: %d/%d", [self class], self, self->_error.domain, self->_error.code); } else { - _isAllEnumerated = YES; - CBLLogInfo(Query, @"End of query enumeration (%p)", _c4enum); + self->_isAllEnumerated = YES; + CBLLogInfo(Query, @"End of query enumeration (%p)", self->_c4enum); } }]; return row; @@ -144,8 +144,8 @@ - (id) objectAtIndex: (NSUInteger)index { __block id result; [db safeBlock: ^{ - if (!c4queryenum_seek(_c4enum, index, &_error)) { - NSString* message = sliceResult2string(c4error_getMessage(_error)); + if (!c4queryenum_seek(self->_c4enum, index, &self->_error)) { + NSString* message = sliceResult2string(c4error_getMessage(self->_error)); [NSException raise: NSInternalInconsistencyException format: @"CBLQueryEnumerator couldn't get a value: %@", message]; } @@ -172,7 +172,7 @@ - (CBLQueryResultSet*) refresh: (NSError**)outError { CBLDatabase* db = self.database; [db safeBlock: ^{ - newEnum = c4queryenum_refresh(_c4enum, &c4error); + newEnum = c4queryenum_refresh(self->_c4enum, &c4error); }]; if (!newEnum) { if (c4error.code) diff --git a/Objective-C/CBLReplicator.mm b/Objective-C/CBLReplicator.mm index c16506950..34ee7734a 100644 --- a/Objective-C/CBLReplicator.mm +++ b/Objective-C/CBLReplicator.mm @@ -289,17 +289,17 @@ - (bool) _setupC4Replicator: (C4Error*)outErr { // Create a C4Replicator: [_config.database safeBlock: ^{ - [_config.database mustBeOpenLocked]; + [self->_config.database mustBeOpenLocked]; if (remoteURL || !otherDB) - _repl = c4repl_new(_config.database.c4db, addr, dbName, params, outErr); + self->_repl = c4repl_new(self->_config.database.c4db, addr, dbName, params, outErr); else { #ifdef COUCHBASE_ENTERPRISE if (otherDB) { [otherDB safeBlock: ^{ [otherDB mustBeOpenLocked]; - _repl = c4repl_newLocal(_config.database.c4db, otherDB.c4db, params, outErr); + self->_repl = c4repl_newLocal(self->_config.database.c4db, otherDB.c4db, params, outErr); }]; } #else @@ -718,13 +718,13 @@ - (void) resolveConflict: (CBLReplicatedDocument*)doc { dispatch_async(_conflictQueue, ^{ [self _resolveConflict: doc]; CBL_LOCK(self) { - if (--_conflictCount == 0 && _deferReplicatorNotification) { - if (_rawStatus.level == kC4Stopped) { - Assert(_state == kCBLStateStopping); + if (--self->_conflictCount == 0 && self->_deferReplicatorNotification) { + if (self->_rawStatus.level == kC4Stopped) { + Assert(self->_state == kCBLStateStopping); [self stopped]; } - _deferReplicatorNotification = NO; + self->_deferReplicatorNotification = NO; [self updateAndPostStatus]; } } diff --git a/Objective-C/Internal/Replicator/CBLDNSService.mm b/Objective-C/Internal/Replicator/CBLDNSService.mm index 2eb319c8b..7ff439af2 100644 --- a/Objective-C/Internal/Replicator/CBLDNSService.mm +++ b/Objective-C/Internal/Replicator/CBLDNSService.mm @@ -174,7 +174,7 @@ - (void) start { if (!_timeoutBlock) { _timeoutBlock = dispatch_block_create(DISPATCH_BLOCK_ASSIGN_CURRENT, ^{ @synchronized (self) { - CBLWarnError(WebSocket, @"%@: Looking up '%@' timeout", self, _host); + CBLWarnError(WebSocket, @"%@: Looking up '%@' timeout", self, self->_host); [self notifyError: kDNSServiceErr_Timeout]; } }); @@ -215,7 +215,7 @@ - (BOOL) checkAlreadyIPAddress { if (info) { dispatch_async(_dnsQueue, ^{ - [_delegate didResolveSuccessWithAddress: info]; + [self->_delegate didResolveSuccessWithAddress: info]; }); return true; } diff --git a/Objective-C/Internal/Replicator/CBLReplicator+Backgrounding.m b/Objective-C/Internal/Replicator/CBLReplicator+Backgrounding.m index ed31f8ca1..e60f2d121 100644 --- a/Objective-C/Internal/Replicator/CBLReplicator+Backgrounding.m +++ b/Objective-C/Internal/Replicator/CBLReplicator+Backgrounding.m @@ -74,7 +74,7 @@ - (void) endBackgrounding { - (void) endCurrentBackgroundTask { dispatch_async(dispatch_get_main_queue(), ^{ if ([self.bgMonitor hasBackgroundTask]) { - _deepBackground = YES; + self->_deepBackground = YES; [self updateSuspended]; CBLLogInfo(Sync, @"%@: ending background task as idle.", self); [self.bgMonitor endBackgroundTask]; // will probably suspend the process immediately diff --git a/Objective-C/Internal/Replicator/CBLWebSocket.mm b/Objective-C/Internal/Replicator/CBLWebSocket.mm index 533899d7b..35dda2d19 100644 --- a/Objective-C/Internal/Replicator/CBLWebSocket.mm +++ b/Objective-C/Internal/Replicator/CBLWebSocket.mm @@ -300,9 +300,9 @@ - (void) callC4Socket: (void (^)(C4Socket*))callback { - (void) start { dispatch_async(_queue, ^{ - if (_logic.error) { + if (self->_logic.error) { // PAC resolution must have failed. Give up. - [self closeWithError: _logic.error]; + [self closeWithError: self->_logic.error]; return; } [self _connect]; @@ -389,7 +389,7 @@ - (void) connectToHostWithName: (NSString*)hostname - (void) didResolveSuccessWithAddress: (AddressInfo*)info { dispatch_async(_queue, ^{ - if (_dnsService) { + if (self->_dnsService) { CBLLogVerbose(WebSocket, @"%@: Host '%@' was resolved as ip=%@, family=%d", self, info.host, info.addrstr, info.addr->sa_family); [self _socketConnect: info]; @@ -399,7 +399,7 @@ - (void) didResolveSuccessWithAddress: (AddressInfo*)info { - (void) didResolveFailWithError: (NSError*)error { dispatch_async(_queue, ^{ - if (_dnsService) { + if (self->_dnsService) { CBLWarnError(WebSocket, @"%@: Host was failed to resolve with error '%@'", self, error.my_compactDescription); [self closeWithError: error]; @@ -453,13 +453,13 @@ - (void) _socketConnect: (AddressInfo*)info { CBLLogVerbose(WebSocket, @"%@: Connect to IP address %@", self, info.addrstr); int status = connect(sockfd, info.addr, info.length); if (status == 0) { - dispatch_async(_queue, ^{ - if (_sockfd < 0) + dispatch_async(self->_queue, ^{ + if (self->_sockfd < 0) return; // Already disconnected // Enable non-blocking mode on the socket: - int flags = fcntl(_sockfd, F_GETFL); - if (fcntl(_sockfd, F_SETFL, flags | O_NONBLOCK) < 0) { + int flags = fcntl(self->_sockfd, F_GETFL); + if (fcntl(self->_sockfd, F_SETFL, flags | O_NONBLOCK) < 0) { int errNo = errno; NSString* msg = $sprintf(@"Failed to enable non-blocking mode with errno %d", errNo); CBLWarnError(WebSocket, @"%@: %@", self, msg); @@ -470,7 +470,7 @@ - (void) _socketConnect: (AddressInfo*)info { // Create a pair steam with the socket: CFReadStreamRef readStream; CFWriteStreamRef writeStream; - CFStreamCreatePairWithSocket(kCFAllocatorDefault, _sockfd, &readStream, &writeStream); + CFStreamCreatePairWithSocket(kCFAllocatorDefault, self->_sockfd, &readStream, &writeStream); CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); @@ -487,7 +487,7 @@ - (void) _socketConnect: (AddressInfo*)info { info.interface, errNo); CBLWarnError(WebSocket, @"%@: %@", self, msg); NSError* error = posixError(errNo, msg); - dispatch_async(_queue, ^{ + dispatch_async(self->_queue, ^{ [self closeWithError: error]; }); } @@ -845,7 +845,7 @@ - (void) completedReceive: (size_t)byteCount { dispatch_async(_queue, ^{ bool wasThrottled = self.readThrottled; self->_receivedBytesPending -= byteCount; - if (_hasBytes && wasThrottled && !self.readThrottled) + if (self->_hasBytes && wasThrottled && !self.readThrottled) [self doRead]; }); } @@ -854,7 +854,7 @@ - (void) completedReceive: (size_t)byteCount { - (void) closeSocket { CBLLogInfo(WebSocket, @"%@: CBLWebSocket closeSocket requested", self); dispatch_async(_queue, ^{ - if (_in || _out || _sockfd >= 0) { + if (self->_in || self->_out || self->_sockfd >= 0) { [self closeWithError: nil]; } }); diff --git a/Swift/Tests/URLEndpointListenerTest.swift b/Swift/Tests/URLEndpointListenerTest.swift index 053a39826..d91279d8e 100644 --- a/Swift/Tests/URLEndpointListenerTest.swift +++ b/Swift/Tests/URLEndpointListenerTest.swift @@ -803,7 +803,7 @@ class URLEndpointListenerTest_Main: URLEndpointListenerTest { let urls = self.listener!.urls! /// Link local addresses cannot be assigned via network interface because they don't map to any given interface. - let notLinkLocal: [URL] = urls.filter { !$0.host!.contains("fe80::") && !$0.host!.contains(".local")} + let notLinkLocal: [URL] = urls.filter { !$0.host!.contains(":") && !$0.host!.contains(".local")} for (i, url) in notLinkLocal.enumerated() { // separate db instance! diff --git a/vendor/MYUtilities b/vendor/MYUtilities index 2326e35ec..e5d39ec66 160000 --- a/vendor/MYUtilities +++ b/vendor/MYUtilities @@ -1 +1 @@ -Subproject commit 2326e35ec192f1b59ad4e10527aaa14e0003203c +Subproject commit e5d39ec667d1fc1b6b9579b6dcb8c9ff31c20e4b diff --git a/xcconfigs/Project.xcconfig b/xcconfigs/Project.xcconfig index 72f9b27ed..fe70f0ff9 100644 --- a/xcconfigs/Project.xcconfig +++ b/xcconfigs/Project.xcconfig @@ -85,7 +85,7 @@ CLANG_WARN_ENUM_CONVERSION = YES CLANG_WARN_INFINITE_RECURSION = YES CLANG_WARN_INT_CONVERSION = YES CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO // TODO: Switch this to YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR