get rid of a warning

This commit is contained in:
Mitchell Livingston 2007-06-30 21:53:45 +00:00
parent 3b1597789e
commit f62addb8aa
2 changed files with 30 additions and 29 deletions

View File

@ -33,10 +33,10 @@
@interface Torrent : NSObject
{
tr_handle_t * fLib;
tr_handle_t * fLib;
tr_torrent_t * fHandle;
tr_info_t * fInfo;
tr_stat_t * fStat;
const tr_info_t * fInfo;
tr_stat_t * fStat;
int fID;
@ -222,7 +222,7 @@
- (NSNumber *) ratioSortKey;
- (int) torrentID;
- (tr_info_t *) torrentInfo;
- (const tr_info_t *) torrentInfo;
- (tr_stat_t *) torrentStat;
@end

View File

@ -818,32 +818,33 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if ([self allDownloaded] || ![fDefaults boolForKey: @"WarningRemainingSpace"])
return YES;
NSString * volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]]
objectAtIndex: 0];
NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue],
torrentRemaining = fStat->left;
if (volumeName && remainingSpace <= torrentRemaining)
NSString * volumeName;
if ((volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]] objectAtIndex: 0]))
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: [NSString stringWithFormat:
NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
"Torrent file disk space alert -> title"), [self name]]];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
"Torrent file disk space alert -> message"), volumeName]];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
int result = [alert runModal];
[alert release];
if (result == NSAlertThirdButtonReturn)
[fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
return result != NSAlertFirstButtonReturn;
if (remainingSpace <= fStat->left)
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: [NSString stringWithFormat:
NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
"Torrent file disk space alert -> title"), [self name]]];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
"Torrent file disk space alert -> message"), volumeName]];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
int result = [alert runModal];
[alert release];
if (result == NSAlertThirdButtonReturn)
[fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
return result != NSAlertFirstButtonReturn;
}
}
return YES;
}
@ -1443,7 +1444,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fID;
}
- (tr_info_t *) torrentInfo
- (const tr_info_t *) torrentInfo
{
return fInfo;
}