Skip to content

Commit

Permalink
enable more warnings (and fixing them)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Lebel committed Mar 29, 2015
1 parent 763a196 commit e5b3c02
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
Expand Up @@ -199,7 +199,6 @@ void pingThreadCleanup(void *pingDetails);
- (NSString *)getLastErrorMessage;
- (void)setLastErrorMessage:(NSString *)theErrorMessage;
- (NSUInteger)getLastErrorID;
+ (BOOL)isErrorNumberConnectionError:(NSInteger)theErrorNumber;
- (void)updateErrorStatuses;

// Queries
Expand Down
8 changes: 8 additions & 0 deletions MongoHub.xcodeproj/project.pbxproj
Expand Up @@ -1172,12 +1172,16 @@
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
SDKROOT = macosx;
Expand All @@ -1191,13 +1195,17 @@
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
SDKROOT = macosx;
Expand Down
8 changes: 4 additions & 4 deletions Sources/ConnectionWindow/MHConnectionWindowController.m
Expand Up @@ -284,12 +284,12 @@ - (MODQuery *)getCollectionListForDatabaseItem:(MHDatabaseItem *)databaseItem
mongoDatabase = databaseItem.database;
[self.loaderIndicator startAnimation:nil];
result = [mongoDatabase collectionNamesWithCallback:^(NSArray *collectionList, MODQuery *mongoQuery) {
MHDatabaseItem *databaseItem;
MHDatabaseItem *newDatabaseItem;

[self.loaderIndicator stopAnimation:nil];
databaseItem = [self.clientItem databaseItemWithName:mongoDatabase.name];
if (collectionList && databaseItem) {
if ([databaseItem updateChildrenWithList:collectionList]) {
newDatabaseItem = [self.clientItem databaseItemWithName:mongoDatabase.name];
if (collectionList && newDatabaseItem) {
if ([newDatabaseItem updateChildrenWithList:collectionList]) {
[self.databaseCollectionOutlineView reloadData];
}
} else if (mongoQuery.error) {
Expand Down
18 changes: 9 additions & 9 deletions Sources/ConnectionWindow/MHQueryViewController.m
Expand Up @@ -387,12 +387,12 @@ - (void)_removeQueryWithCriteria:(MODSortedDictionary *)criteria
{
[self.removeQueryLoaderIndicator startAnimation:nil];
[self.collection countWithCriteria:criteria readPreferences:nil callback:^(int64_t count, MODQuery *mongoQuery) {
[self.collection removeWithCriteria:criteria callback:^(MODQuery *mongoQuery) {
[self.collection removeWithCriteria:criteria callback:^(MODQuery *removeQuery) {
NSColor *flashColor;

if (mongoQuery.error) {
if (removeQuery.error) {
self.removeResultsTextField.stringValue = @"Error!";
NSBeginAlertSheet(@"Error", @"OK", nil, nil, self.view.window, nil, nil, nil, NULL, @"%@", mongoQuery.error.localizedDescription);
NSBeginAlertSheet(@"Error", @"OK", nil, nil, self.view.window, nil, nil, nil, NULL, @"%@", removeQuery.error.localizedDescription);
flashColor = NSColor.redColor;
} else {
self.removeResultsTextField.stringValue = [NSString stringWithFormat:@"Removed Documents: %lld", count];
Expand Down Expand Up @@ -542,8 +542,8 @@ - (IBAction)findQuery:(id)sender
convertedDocuments = [MODHelper convertForOutlineWithObjects:documents bsonData:bsonData jsonKeySortOrder:self.connectionStore.jsonKeySortOrderInSearch];
[self.findDocumentOutlineViewController displayDocuments:convertedDocuments withLabel:nil];
[self.findDocumentOutlineViewController setBackButtonEnabled:self.findSkipTextField.stringValue.integerValue != 0];
[self.collection countWithCriteria:criteria readPreferences:nil callback:^(int64_t count, MODQuery *mongoQuery) {
[self.findDocumentOutlineViewController displayLabel:[NSString stringWithFormat:@"Total Results: %lld (%0.2fs)", count, [[mongoQuery.userInfo objectForKey:@"timequery"] duration]]];
[self.collection countWithCriteria:criteria readPreferences:nil callback:^(int64_t count, MODQuery *countQuery) {
[self.findDocumentOutlineViewController displayLabel:[NSString stringWithFormat:@"Total Results: %lld (%0.2fs)", count, [[countQuery.userInfo objectForKey:@"timequery"] duration]]];
}];
}
[self.findQueryLoaderIndicator stopAnimation:nil];
Expand Down Expand Up @@ -912,12 +912,12 @@ - (IBAction)updateQuery:(id)sender
upsert:self.updateUpsetCheckBox.state
multiUpdate:self.updateMultiCheckBox.state
writeConcern:nil
callback:^(MODQuery *mongoQuery) {
callback:^(MODQuery *updateQuery) {
NSColor *flashColor;

if (mongoQuery.error) {
if (updateQuery.error) {
self.updateResultsTextField.stringValue = @"Error!";
NSBeginAlertSheet(@"Error", @"OK", nil, nil, self.view.window, nil, nil, nil, NULL, @"%@", mongoQuery.error.localizedDescription);
NSBeginAlertSheet(@"Error", @"OK", nil, nil, self.view.window, nil, nil, nil, NULL, @"%@", updateQuery.error.localizedDescription);
flashColor = NSColor.redColor;
} else {
self.updateResultsTextField.stringValue = [NSString stringWithFormat:@"Updated Documents: %lld", count];
Expand Down Expand Up @@ -1105,7 +1105,7 @@ - (IBAction)aggregationRunAction:(id)sender
[allData addObject:documentData];
return YES;
}
endCallback:^(uint64_t documentCounts, BOOL cursorStopped, MODQuery *mongoQuery) {
endCallback:^(uint64_t documentCounts, BOOL cursorStopped, MODQuery *forEachQuery) {
NSString *label = [NSString stringWithFormat:@"%lld documents", documentCounts];
NSArray *displayedDocuments = [MODHelper convertForOutlineWithObjects:documents bsonData:allData jsonKeySortOrder:self.connectionStore.jsonKeySortOrderInSearch];
[self.aggregationDocumentOutlineViewController displayDocuments:displayedDocuments withLabel:label];
Expand Down
5 changes: 0 additions & 5 deletions Sources/DatabaseCollectionOutlineView/MHDatabaseItem.m
Expand Up @@ -63,11 +63,6 @@ - (MHCollectionItem *)collectionItemWithName:(NSString *)name
return self.collectionItems[name];
}

static NSInteger collectionItemSortFunction(id element1, id element2, void *context)
{
return [[element1 name] compare:[element2 name] options:0];
}

- (BOOL)updateChildrenWithList:(NSArray *)list
{
BOOL result = NO;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Exporter-Importer/MHFileExporter.m
Expand Up @@ -75,7 +75,7 @@ - (void)export
[NSNotificationCenter.defaultCenter postNotificationName:MHImporterExporterProgressNotification object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithDouble:(double)self.documentProcessedCount / count], MHImporterExporterNotificationProgressKey, nil]];
}
return YES;
} endCallback:^(uint64_t documentCounts, BOOL cursorStopped, MODQuery *mongoQuery) {
} endCallback:^(uint64_t documentCounts, BOOL cursorStopped, MODQuery *forEachQuery) {
close(fileDescriptor);
[NSNotificationCenter.defaultCenter postNotificationName:MHImporterExporterStopNotification object:self userInfo:nil];
}];
Expand Down

0 comments on commit e5b3c02

Please sign in to comment.