From 7ddc2b64cddf0fcb2b23c6bfcd1463fbec22f511 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Tue, 14 Aug 2007 05:21:02 +0000 Subject: [PATCH] various negligible cleanup --- macosx/Controller.m | 1 - macosx/CreatorWindowController.m | 3 +-- macosx/DragOverlayView.m | 6 ++---- macosx/ExpandedPathToPathTransformer.m | 2 +- macosx/FilterBarButton.m | 6 +++--- macosx/ImageBackgroundView.m | 6 ++---- macosx/InfoWindowController.m | 18 ++++++------------ macosx/PiecesView.m | 24 +++++++++++++----------- 8 files changed, 28 insertions(+), 38 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 9daf81235..ead6cc97e 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -958,7 +958,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; } -#warning combine - (void) openURLEndSheet: (id) sender { [fURLSheetWindow orderOut: sender]; diff --git a/macosx/CreatorWindowController.m b/macosx/CreatorWindowController.m index 07692549f..a46177e8f 100644 --- a/macosx/CreatorWindowController.m +++ b/macosx/CreatorWindowController.m @@ -159,8 +159,7 @@ - (void) dealloc { [fPath release]; - if (fLocation) - [fLocation release]; + [fLocation release]; if (fInfo) tr_metaInfoBuilderFree(fInfo); diff --git a/macosx/DragOverlayView.m b/macosx/DragOverlayView.m index a4322e24a..db8c58b1c 100644 --- a/macosx/DragOverlayView.m +++ b/macosx/DragOverlayView.m @@ -74,10 +74,8 @@ { [fBackBadge release]; - if (fBadge) - [fBadge release]; - if (fAppIcon) - [fAppIcon release]; + [fBadge release]; + [fAppIcon release]; [fMainLineAttributes release]; [fSubLineAttributes release]; diff --git a/macosx/ExpandedPathToPathTransformer.m b/macosx/ExpandedPathToPathTransformer.m index 564ad4b2e..27232f09f 100644 --- a/macosx/ExpandedPathToPathTransformer.m +++ b/macosx/ExpandedPathToPathTransformer.m @@ -38,7 +38,7 @@ - (id) transformedValue: (id) value { - return value == nil ? nil : [value lastPathComponent]; + return value == nil ? nil : [value lastPathComponent]; } @end \ No newline at end of file diff --git a/macosx/FilterBarButton.m b/macosx/FilterBarButton.m index d7054b535..a34a6830b 100644 --- a/macosx/FilterBarButton.m +++ b/macosx/FilterBarButton.m @@ -70,7 +70,7 @@ [super dealloc]; } -- (void)sizeToFit +- (void) sizeToFit { NSSize size = [[self title] sizeWithAttributes: fNormalAttributes]; size.width = floorf(size.width + 18.5); @@ -80,12 +80,12 @@ [self createPaths]; } -- (BOOL)isFlipped +- (BOOL) isFlipped { return NO; } -- (void)drawRect:(NSRect)rect +- (void) drawRect: (NSRect) rect { // draw background if ([[self cell] isHighlighted]) diff --git a/macosx/ImageBackgroundView.m b/macosx/ImageBackgroundView.m index 2a56af838..479855fa3 100644 --- a/macosx/ImageBackgroundView.m +++ b/macosx/ImageBackgroundView.m @@ -28,8 +28,7 @@ - (void) setBackgroundImage: (NSImage *) image { - if (fBackgroundColor) - [fBackgroundColor release]; + [fBackgroundColor release]; fBackgroundColor = [[NSColor colorWithPatternImage: image] retain]; [self setNeedsDisplay: YES]; @@ -37,8 +36,7 @@ - (void) dealloc { - if (fBackgroundColor) - [fBackgroundColor release]; + [fBackgroundColor release]; [super dealloc]; } diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index aea0489a3..949097168 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -115,20 +115,16 @@ - (void) dealloc { - if (fTorrents) - [fTorrents release]; - if (fPeers) - [fPeers release]; - if (fFiles) - [fFiles release]; + [fTorrents release]; + [fPeers release]; + [fFiles release]; [super dealloc]; } - (void) updateInfoForTorrents: (NSArray *) torrents { - if (fTorrents) - [fTorrents release]; + [fTorrents release]; fTorrents = [torrents retain]; int numberSelected = [fTorrents count]; @@ -286,8 +282,7 @@ //set file table [fFileOutline deselectAll: nil]; - if (fFiles) - [fFiles release]; + [fFiles release]; fFiles = [[torrent fileList] retain]; [self updateInfoFiles]; @@ -435,8 +430,7 @@ [fDownloadingFromField setStringValue: active ? [NSString stringWithInt: [torrent peersSendingToUs]] : @""]; [fUploadingToField setStringValue: active ? [NSString stringWithInt: [torrent peersGettingFromUs]] : @""]; - if (fPeers) - [fPeers release]; + [fPeers release]; fPeers = [[[torrent peers] sortedArrayUsingDescriptors: [self peerSortDescriptors]] retain]; [fPeerTable reloadData]; diff --git a/macosx/PiecesView.m b/macosx/PiecesView.m index 68e7075c4..a0168c848 100644 --- a/macosx/PiecesView.m +++ b/macosx/PiecesView.m @@ -151,20 +151,13 @@ [fGreen2Piece release]; [fGreen3Piece release]; - if (fTorrent) - [fTorrent release]; + [fTorrent release]; [super dealloc]; } - (void) setTorrent: (Torrent *) torrent { - if (fTorrent) - { - [fTorrent release]; - - if (!torrent) - fTorrent = nil; - } + [fTorrent release]; if (torrent) { @@ -192,7 +185,12 @@ } else { - [self setImage: [[fBack copy] autorelease]]; + fTorrent = nil; + + NSImage * newBack = [fBack copy]; + [self setImage: newBack]; + [newBack release]; + [self setNeedsDisplay]; } } @@ -203,7 +201,11 @@ return; if (first) - [self setImage: [[fBack copy] autorelease]]; + { + NSImage * newBack = [fBack copy]; + [self setImage: newBack]; + [newBack release]; + } NSImage * image = [self image]; int8_t * pieces;