Skip to content

Commit 7eaef38

Browse files
committed
Merge pull request parse-community#750 from ParsePlatform/nlutsenko.warnings
Fix static analyzer warnings.
2 parents c2b7b0b + a32d8b9 commit 7eaef38

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef struct sqlite3_stmt sqlite3_stmt;
1818

1919
@interface PFSQLiteStatement : NSObject
2020

21-
@property (nonatomic, assign, readonly) sqlite3_stmt *sqliteStatement;
21+
@property (nullable, nonatomic, assign, readonly) sqlite3_stmt *sqliteStatement;
2222
@property (nonatomic, strong, readonly) dispatch_queue_t databaseQueue;
2323

2424
- (instancetype)initWithStatement:(sqlite3_stmt *)stmt queue:(dispatch_queue_t)databaseQueue;

Parse/Internal/LocalDataStore/SQLite/PFSQLiteStatement.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (BOOL)close {
3636
}
3737

3838
int resultCode = sqlite3_finalize(_sqliteStatement);
39-
_sqliteStatement = nil;
39+
_sqliteStatement = NULL;
4040

4141
return (resultCode == SQLITE_OK || resultCode == SQLITE_DONE);
4242
});

Parse/Internal/PFCoreDataProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
4848

4949
@protocol PFObjectFilePersistenceControllerProvider <NSObject>
5050

51-
@property (nonatomic, strong, readonly) PFObjectFilePersistenceController *objectFilePersistenceController;
51+
@property (null_resettable, nonatomic, strong, readonly) PFObjectFilePersistenceController *objectFilePersistenceController;
5252

5353
@end
5454

Parse/Internal/PFDataProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
4949

5050
@protocol PFEventuallyQueueProvider <NSObject>
5151

52-
@property (nonatomic, strong, readonly) PFEventuallyQueue *eventuallyQueue;
52+
@property (null_resettable, nonatomic, strong, readonly) PFEventuallyQueue *eventuallyQueue;
5353

5454
@end
5555

Parse/PFQuery.m

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -669,20 +669,15 @@ + (instancetype)queryWithClassName:(NSString *)className predicate:(NSPredicate
669669
return [self queryWithClassName:className normalizedPredicate:normalizedPredicate];
670670
}
671671

672-
+ (instancetype)orQueryWithSubqueries:(NSArray *)queries {
673-
NSMutableArray *array = [NSMutableArray array];
674-
NSString *className = nil;
675-
for (id object in queries) {
676-
PFParameterAssert([object isKindOfClass:[PFQuery class]],
672+
+ (instancetype)orQueryWithSubqueries:(NSArray<PFQuery *> *)queries {
673+
PFParameterAssert(queries.count, @"Can't create an `or` query from no subqueries.");
674+
NSMutableArray *array = [NSMutableArray arrayWithCapacity:queries.count];
675+
NSString *className = queries.firstObject.parseClassName;
676+
for (PFQuery *query in queries) {
677+
PFParameterAssert([query isKindOfClass:[PFQuery class]],
677678
@"All elements should be instances of `PFQuery` class.");
678-
679-
PFQuery *query = (PFQuery *)object;
680-
if (!className) {
681-
className = query.parseClassName;
682-
} else {
683-
PFParameterAssert([query.parseClassName isEqualToString:className],
684-
@"All sub queries of an `or` query should be on the same class.");
685-
}
679+
PFParameterAssert([query.parseClassName isEqualToString:className],
680+
@"All sub queries of an `or` query should be on the same class.");
686681

687682
[array addObject:query];
688683
}

0 commit comments

Comments
 (0)