Skip to content

Commit

Permalink
Prevent "if statement has empty body" warnings.
Browse files Browse the repository at this point in the history
Only execute the assertion macros if NS_BLOCK_ASSERTIONS is not set.
  • Loading branch information
theory committed Nov 29, 2010
1 parent 83e3eee commit efdc397
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FMDatabase.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ - (BOOL)goodConnection {
- (void)compainAboutInUse {
NSLog(@"The FMDatabase %@ is currently in use.", self);

# if !NS_BLOCK_ASSERTIONS
if (crashOnErrors) {
NSAssert1(false, @"The FMDatabase %@ is currently in use.", self);
}
#endif
}

- (NSString*)lastErrorMessage {
Expand Down Expand Up @@ -300,12 +302,14 @@ - (id)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orVA
if (logsErrors) {
NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
NSLog(@"DB Query: %@", sql);
# if !NS_BLOCK_ASSERTIONS
if (crashOnErrors) {
//#if defined(__BIG_ENDIAN__) && !TARGET_IPHONE_SIMULATOR
// asm{ trap };
//#endif
NSAssert2(false, @"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
}
#endif
}

sqlite3_finalize(pStmt);
Expand Down Expand Up @@ -432,12 +436,14 @@ - (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray*)arrayArgs or
if (logsErrors) {
NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
NSLog(@"DB Query: %@", sql);
# if !NS_BLOCK_ASSERTIONS
if (crashOnErrors) {
//#if defined(__BIG_ENDIAN__) && !TARGET_IPHONE_SIMULATOR
// asm{ trap };
//#endif
NSAssert2(false, @"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
}
#endif
}

sqlite3_finalize(pStmt);
Expand Down

0 comments on commit efdc397

Please sign in to comment.