assorted trivial cleanup

This commit is contained in:
Mitchell Livingston
2009-02-17 04:00:53 +00:00
parent b9ff19ba38
commit 3d1cf6ba0d
5 changed files with 12 additions and 13 deletions

View File

@@ -992,9 +992,9 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt )
/* if we're seeding and we've reached our seed ratio limit, stop the torrent */ /* if we're seeding and we've reached our seed ratio limit, stop the torrent */
if( tr_torrentIsSeed( tor ) && tr_torrentGetSeedRatio( tor, &seedRatio ) ) { if( tr_torrentIsSeed( tor ) && tr_torrentGetSeedRatio( tor, &seedRatio ) ) {
double up = (double)tor->uploadedCur + (double)tor->uploadedPrev; const double up = tor->uploadedCur + tor->uploadedPrev;
double down = (double)tor->downloadedCur + (double)tor->downloadedPrev; const double down = tor->downloadedCur + tor->downloadedPrev;
double ratio = tr_getRatio( up, down ); const double ratio = tr_getRatio( up, down );
if( ratio >= seedRatio ) { if( ratio >= seedRatio ) {
tr_torrentStop( tor ); tr_torrentStop( tor );

View File

@@ -228,9 +228,9 @@ tr_torrentGetSeedRatio( const tr_torrent * tor, double * ratio )
break; break;
case TR_RATIOLIMIT_GLOBAL: case TR_RATIOLIMIT_GLOBAL:
if(( isLimited = tr_sessionIsRatioLimited( tor->session ))) isLimited = tr_sessionIsRatioLimited( tor->session );
if( ratio ) if( isLimited && ratio )
*ratio = tr_sessionGetRatioLimit( tor->session ); *ratio = tr_sessionGetRatioLimit( tor->session );
break; break;
case TR_RATIOLIMIT_UNLIMITED: case TR_RATIOLIMIT_UNLIMITED:

View File

@@ -101,7 +101,6 @@
@implementation BadgeView (Private) @implementation BadgeView (Private)
//dock icon must have locked focus
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit
{ {
if (!fAttributes) if (!fAttributes)

View File

@@ -1484,7 +1484,7 @@ int trashDataFile(const char * filename)
if (![self canChangeDownloadCheckForFile: index]) if (![self canChangeDownloadCheckForFile: index])
continue; continue;
NSInteger priority = tr_torrentGetFilePriority(fHandle, index); const NSInteger priority = tr_torrentGetFilePriority(fHandle, index);
if (priority == TR_PRI_LOW) if (priority == TR_PRI_LOW)
{ {
if (low) if (low)
@@ -1513,19 +1513,19 @@ int trashDataFile(const char * filename)
- (NSDate *) dateAdded - (NSDate *) dateAdded
{ {
time_t date = fStat->addedDate; const time_t date = fStat->addedDate;
return [NSDate dateWithTimeIntervalSince1970: date]; return [NSDate dateWithTimeIntervalSince1970: date];
} }
- (NSDate *) dateCompleted - (NSDate *) dateCompleted
{ {
time_t date = fStat->doneDate; const time_t date = fStat->doneDate;
return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil; return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil;
} }
- (NSDate *) dateActivity - (NSDate *) dateActivity
{ {
time_t date = fStat->activityDate; const time_t date = fStat->activityDate;
return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil; return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil;
} }

View File

@@ -722,7 +722,7 @@
- (void) setQuickLimitMode: (id) sender - (void) setQuickLimitMode: (id) sender
{ {
NSInteger mode; tr_speedlimit mode;
switch ([sender tag]) switch ([sender tag])
{ {
case ACTION_MENU_UNLIMITED_TAG: case ACTION_MENU_UNLIMITED_TAG:
@@ -745,7 +745,7 @@
- (void) setQuickLimit: (id) sender - (void) setQuickLimit: (id) sender
{ {
BOOL upload = [sender menu] == fUploadMenu; const BOOL upload = [sender menu] == fUploadMenu;
[fMenuTorrent setSpeedMode: TR_SPEEDLIMIT_SINGLE upload: upload]; [fMenuTorrent setSpeedMode: TR_SPEEDLIMIT_SINGLE upload: upload];
[fMenuTorrent setSpeedLimit: [[sender representedObject] intValue] upload: upload]; [fMenuTorrent setSpeedLimit: [[sender representedObject] intValue] upload: upload];