From c9d2f7005c81cc75457bbf94859499b238df9aae Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 9 Feb 2007 15:02:25 +0000 Subject: [PATCH] Sounds pulldowns only get sounds from the built-in system sound folder. This should avoid an Apple error (and resulting crash) with some wav files on Intel macs. --- macosx/PrefsController.m | 37 ++++++++++++++++++------------------- macosx/Torrent.m | 3 +-- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index 2ce9c80f3..0f305869a 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -82,20 +82,19 @@ //set play sound NSMutableArray * sounds = [NSMutableArray array]; - NSEnumerator * soundEnumerator, - * soundDirectoriesEnumerator = [[NSArray arrayWithObjects: @"System/Library/Sounds", - [NSHomeDirectory() stringByAppendingPathComponent: @"Library/Sounds"], nil] objectEnumerator]; - NSString * soundPath, * sound; + NSEnumerator * soundEnumerator; //get list of all sounds and sort alphabetically - while ((soundPath = [soundDirectoriesEnumerator nextObject])) - if (soundEnumerator = [[NSFileManager defaultManager] enumeratorAtPath: soundPath]) - while ((sound = [soundEnumerator nextObject])) - { - sound = [sound stringByDeletingPathExtension]; - if ([NSSound soundNamed: sound]) - [sounds addObject: sound]; - } + if (soundEnumerator = [[NSFileManager defaultManager] enumeratorAtPath: @"System/Library/Sounds"]) + { + NSString * sound; + while ((sound = [soundEnumerator nextObject])) + { + sound = [sound stringByDeletingPathExtension]; + if ([NSSound soundNamed: sound]) + [sounds addObject: sound]; + } + } fSounds = [[sounds sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)] retain]; } @@ -146,7 +145,6 @@ //set port [fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]]; - [self updatePortStatus]; fNatStatus = -1; @@ -419,32 +417,33 @@ - (void) setSound: (id) sender { //play sound when selecting - NSString * soundName = [sender titleOfSelectedItem]; NSSound * sound; - if ((sound = [NSSound soundNamed: soundName])) + if ((sound = [NSSound soundNamed: [sender titleOfSelectedItem]])) [sound play]; } - (void) setUpdate: (id) sender { int index = [fUpdatePopUp indexOfSelectedItem]; + NSString * update; NSTimeInterval seconds; if (index == UPDATE_DAILY) { - [fDefaults setObject: @"Daily" forKey: @"UpdateCheck"]; + update = @"Daily"; seconds = 86400; } else if (index == UPDATE_WEEKLY) { - [fDefaults setObject: @"Weekly" forKey: @"UpdateCheck"]; + update = @"Weekly"; seconds = 604800; } else { - [fDefaults setObject: @"Never" forKey: @"UpdateCheck"]; + update = @"Never"; seconds = 0; } - + + [fDefaults setObject: update forKey: @"UpdateCheck"]; [fDefaults setInteger: seconds forKey: @"SUScheduledCheckInterval"]; if (fUpdater) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 1adb2d33f..c9523cba0 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1261,7 +1261,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (NSImage *) advancedBar { - int h; uint32_t * p; uint8_t * bitmapData = [fBitmap bitmapData]; int bytesPerRow = [fBitmap bytesPerRow]; @@ -1271,7 +1270,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 [self getAvailability: piecesAvailablity size: pieceCount]; //lines 2 to 14: blue, green, or gray depending on whether we have the piece or not - int i, index = 0; + int i, h, index = 0; float increment = (float)pieceCount / (float)MAX_PIECES, indexValue = 0; uint32_t color; BOOL change;