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( tr_torrentIsSeed( tor ) && tr_torrentGetSeedRatio( tor, &seedRatio ) ) {
double up = (double)tor->uploadedCur + (double)tor->uploadedPrev;
double down = (double)tor->downloadedCur + (double)tor->downloadedPrev;
double ratio = tr_getRatio( up, down );
const double up = tor->uploadedCur + tor->uploadedPrev;
const double down = tor->downloadedCur + tor->downloadedPrev;
const double ratio = tr_getRatio( up, down );
if( ratio >= seedRatio ) {
tr_torrentStop( tor );

View File

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

View File

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

View File

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

View File

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