From cb3e797ef4a2814dd6ae22eaf48b659d470f7ff2 Mon Sep 17 00:00:00 2001 From: "Robert M. Ryan" Date: Sat, 3 Jun 2017 13:09:04 -0700 Subject: [PATCH 1/4] Update long types ... ... in `valueLong` and `resultLong` --- src/fmdb/FMDatabase.h | 4 ++-- src/fmdb/FMDatabase.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fmdb/FMDatabase.h b/src/fmdb/FMDatabase.h index e5271606..b3bc622d 100644 --- a/src/fmdb/FMDatabase.h +++ b/src/fmdb/FMDatabase.h @@ -1065,14 +1065,14 @@ typedef NS_ENUM(int, SqliteValueType) { - (SqliteValueType)valueType:(void *)argv; - (int)valueInt:(void *)value; -- (long)valueLong:(void *)value; +- (long long)valueLong:(void *)value; - (double)valueDouble:(void *)value; - (NSData * _Nullable)valueData:(void *)value; - (NSString * _Nullable)valueString:(void *)value; - (void)resultNullInContext:(void *)context NS_SWIFT_NAME(resultNull(context:)); - (void)resultInt:(int) value context:(void *)context; -- (void)resultLong:(long)value context:(void *)context; +- (void)resultLong:(long long)value context:(void *)context; - (void)resultDouble:(double)value context:(void *)context; - (void)resultData:(NSData *)data context:(void *)context; - (void)resultString:(NSString *)value context:(void *)context; diff --git a/src/fmdb/FMDatabase.m b/src/fmdb/FMDatabase.m index b4752202..12b2214b 100644 --- a/src/fmdb/FMDatabase.m +++ b/src/fmdb/FMDatabase.m @@ -1491,7 +1491,7 @@ - (int)valueInt:(void *)value { return sqlite3_value_int(value); } -- (long)valueLong:(void *)value { +- (long long)valueLong:(void *)value { return sqlite3_value_int64(value); } @@ -1518,7 +1518,7 @@ - (void)resultInt:(int) value context:(void *)context { sqlite3_result_int(context, value); } -- (void)resultLong:(long)value context:(void *)context { +- (void)resultLong:(long long)value context:(void *)context { sqlite3_result_int64(context, value); } From e167d5494ca2672d7b3b9cfd45d5a0d9bde663a1 Mon Sep 17 00:00:00 2001 From: "Robert M. Ryan" Date: Sat, 3 Jun 2017 13:11:26 -0700 Subject: [PATCH 2/4] Explicit NSNumber pointer check The static analyzer points out a potential ambiguity where `if (number) { ... }`, where `number` is a `NSNumber` might be construed as either `if (number != nil) { ... }` or `if ([number boolValue]) { ... }`. They suggest making it explicit to avoid any ambiguity. --- src/fmdb/FMResultSet.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmdb/FMResultSet.m b/src/fmdb/FMResultSet.m index 811e47c5..2231e476 100644 --- a/src/fmdb/FMResultSet.m +++ b/src/fmdb/FMResultSet.m @@ -221,7 +221,7 @@ - (int)columnIndexForName:(NSString*)columnName { NSNumber *n = [[self columnNameToIndexMap] objectForKey:columnName]; - if (n) { + if (n != nil) { return [n intValue]; } From 0d7d2b79f85abec00c7ed4463549dfc8cbd61c5a Mon Sep 17 00:00:00 2001 From: "Robert M. Ryan" Date: Sat, 3 Jun 2017 13:12:41 -0700 Subject: [PATCH 3/4] Add doc comments warnings --- fmdb.xcodeproj/project.pbxproj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fmdb.xcodeproj/project.pbxproj b/fmdb.xcodeproj/project.pbxproj index 21cddd6d..4a533b0e 100644 --- a/fmdb.xcodeproj/project.pbxproj +++ b/fmdb.xcodeproj/project.pbxproj @@ -724,6 +724,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; @@ -745,6 +746,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; @@ -828,6 +830,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; COPY_PHASE_STRIP = NO; DSTROOT = /tmp/FMDB_IOS.dst; @@ -860,6 +863,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; COPY_PHASE_STRIP = YES; DSTROOT = /tmp/FMDB_IOS.dst; @@ -888,6 +892,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; @@ -931,6 +936,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; @@ -971,6 +977,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; @@ -1014,6 +1021,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; @@ -1053,6 +1061,7 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; COMBINE_HIDPI_IMAGES = YES; @@ -1097,6 +1106,7 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; COMBINE_HIDPI_IMAGES = YES; @@ -1130,6 +1140,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; @@ -1144,6 +1155,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; From 61b9fb76d6af2fd2e1ce899fb6673e3f81e43ebb Mon Sep 17 00:00:00 2001 From: "Robert M. Ryan" Date: Sat, 3 Jun 2017 13:13:41 -0700 Subject: [PATCH 4/4] Version 2.7.1 --- CHANGES_AND_TODO_LIST.txt | 7 +++++++ FMDB.podspec | 2 +- Tests/FMDatabaseTests.m | 2 +- src/fmdb/FMDatabase.m | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES_AND_TODO_LIST.txt b/CHANGES_AND_TODO_LIST.txt index f1fddc13..7d517682 100644 --- a/CHANGES_AND_TODO_LIST.txt +++ b/CHANGES_AND_TODO_LIST.txt @@ -3,6 +3,13 @@ Zip, nada, zilch. Got any ideas? If you would like to contribute some code ... awesome! I just ask that you make it conform to the coding conventions already set in here, and to add the necessary of tests for your new code to tests target. And of course, the code should be of general use to more than just a couple of folks. Send your patches to gus@flyingmeat.com. + +2017.06.01 Version 2.7.1 + + Adjust `valueLong` return type and `resultLong` parameter to suppress warning. + + Fix pointer comparison to avoid static analysis warning in `columnIndexForName`. + 2017.05.26 Version 2.7 Audited library for nullability, offering informational warnings for Objective-C users during static analysis, but significantly changes interface for Swift users, more accurately representing parameters and return values as optional or non-optional, as appropriate. diff --git a/FMDB.podspec b/FMDB.podspec index 2bde7972..8a56edf0 100644 --- a/FMDB.podspec +++ b/FMDB.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FMDB' - s.version = '2.7' + s.version = '2.7.1' s.summary = 'A Cocoa / Objective-C wrapper around SQLite.' s.homepage = 'https://github.com/ccgus/fmdb' s.license = 'MIT' diff --git a/Tests/FMDatabaseTests.m b/Tests/FMDatabaseTests.m index 21945708..83415db0 100644 --- a/Tests/FMDatabaseTests.m +++ b/Tests/FMDatabaseTests.m @@ -1125,7 +1125,7 @@ - (void)createCustomFunctions { } - (void)testVersionNumber { - XCTAssertTrue([FMDatabase FMDBVersion] == 0x0270); // this is going to break everytime we bump it. + XCTAssertTrue([FMDatabase FMDBVersion] == 0x0271); // this is going to break everytime we bump it. } - (void)testExecuteStatements { diff --git a/src/fmdb/FMDatabase.m b/src/fmdb/FMDatabase.m index 12b2214b..342c16e9 100644 --- a/src/fmdb/FMDatabase.m +++ b/src/fmdb/FMDatabase.m @@ -98,7 +98,7 @@ - (NSURL *)databaseURL { } + (NSString*)FMDBUserVersion { - return @"2.7.0"; + return @"2.7.1"; } // returns 0x0240 for version 2.4. This makes it super easy to do things like: