mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
assorted trivial cleanup
This commit is contained in:
@@ -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 );
|
||||||
|
|
||||||
|
|||||||
@@ -228,8 +228,8 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user