diff --git a/macosx/BlocklistDownloaderViewController.m b/macosx/BlocklistDownloaderViewController.m index 2d0c79e5b..7087f7bde 100644 --- a/macosx/BlocklistDownloaderViewController.m +++ b/macosx/BlocklistDownloaderViewController.m @@ -47,7 +47,7 @@ { [fButton setTitle: NSLocalizedString(@"Cancel", "Blocklist -> cancel button")]; - CGFloat oldWidth = [fButton frame].size.width; + const CGFloat oldWidth = [fButton frame].size.width; [fButton sizeToFit]; NSRect buttonFrame = [fButton frame]; buttonFrame.size.width += 12.0f; //sizeToFit sizes a bit too small diff --git a/macosx/Controller.m b/macosx/Controller.m index 0b63bf9ce..cd093a228 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -893,7 +893,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy //ensure torrent doesn't already exist tr_ctor * ctor = tr_ctorNew(fLib); tr_ctorSetMetainfoFromFile(ctor, [torrentPath UTF8String]); - int result = tr_torrentParse(ctor, &info); + tr_parse_result result = tr_torrentParse(ctor, &info); if (result != TR_PARSE_OK) { if (result == TR_PARSE_DUPLICATE) @@ -903,8 +903,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy if (type != ADD_AUTO) [self invalidOpenAlert: [torrentPath lastPathComponent]]; } - else //this shouldn't happen - NSLog(@"Unknown error code (%d) when attempting to open \"%@\"", result, torrentPath); + else + NSAssert2(NO, @"Unknown error code (%d) when attempting to open \"%@\"", result, torrentPath); tr_ctorFree(ctor); tr_metainfoFree(&info); @@ -3983,7 +3983,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy if (seeding > 0 || downloading > 0) { if (!hasSeparator) - [fDockMenu insertItem: [NSMenuItem separatorItem] atIndex: seeding > 0 && downloading > 0 ? 2 : 1]; + [fDockMenu insertItem: [NSMenuItem separatorItem] atIndex: (seeding > 0 && downloading > 0) ? 2 : 1]; } else { diff --git a/macosx/StatsWindowController.m b/macosx/StatsWindowController.m index 87a1e9a5f..1a607880e 100644 --- a/macosx/StatsWindowController.m +++ b/macosx/StatsWindowController.m @@ -72,7 +72,7 @@ tr_session * fLib; stringByAppendingString: @":"]]; //size all elements - CGFloat oldWidth = [fUploadedLabelField frame].size.width; + const CGFloat oldWidth = [fUploadedLabelField frame].size.width; [fUploadedLabelField sizeToFit]; [fDownloadedLabelField sizeToFit]; @@ -111,7 +111,7 @@ tr_session * fLib; [[self window] setFrame: windowRect display: YES]; //resize reset button - CGFloat oldButtonWidth = [fResetButton frame].size.width; + const CGFloat oldButtonWidth = [fResetButton frame].size.width; [fResetButton setTitle: NSLocalizedString(@"Reset", "Stats window -> reset button")]; [fResetButton sizeToFit]; diff --git a/macosx/Torrent.h b/macosx/Torrent.h index f7c76f778..d614545db 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -161,7 +161,7 @@ - (BOOL) allDownloaded; - (BOOL) isComplete; - (BOOL) isError; -- (BOOL) isErrorOrWarning; +- (BOOL) isAnyErrorOrWarning; - (NSString *) errorMessage; - (NSArray *) peers; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 07334b75b..52bf8a65a 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -851,17 +851,17 @@ int trashDataFile(const char * filename) - (BOOL) isError { - return fStat->error == TR_STAT_LOCAL_ERROR || fStat->error == TR_STAT_TRACKER_ERROR; + return fStat->error == TR_STAT_LOCAL_ERROR; } -- (BOOL) isErrorOrWarning +- (BOOL) isAnyErrorOrWarning { return fStat->error != TR_STAT_OK; } - (NSString *) errorMessage { - if (![self isErrorOrWarning]) + if (![self isAnyErrorOrWarning]) return @""; NSString * error; @@ -994,7 +994,7 @@ int trashDataFile(const char * filename) { NSString * string; - if ([self isErrorOrWarning]) + if ([self isAnyErrorOrWarning]) { switch (fStat->error) { diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 2a6eb0322..d4c1c2b12 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -429,7 +429,7 @@ [gradient release]; } - const BOOL error = [torrent isErrorOrWarning]; + const BOOL error = [torrent isAnyErrorOrWarning]; //icon if (!minimal || !(!fTracking && fHoverAction)) //don't show in minimal mode when hovered over diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 3d9ab2be3..948e92440 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -139,7 +139,7 @@ - (NSCell *) outlineView: (NSOutlineView *) outlineView dataCellForTableColumn: (NSTableColumn *) tableColumn item: (id) item { - BOOL group = ![item isKindOfClass: [Torrent class]]; + const BOOL group = ![item isKindOfClass: [Torrent class]]; if (!tableColumn) return !group ? fTorrentCell : nil; else