1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

more treating-bools-as-bools

This commit is contained in:
Jordan Lee 2013-08-24 18:18:38 +00:00
parent f762c2ce6a
commit 65f15a4ba9
6 changed files with 22 additions and 17 deletions

View file

@ -198,7 +198,10 @@ tr_blocklistFileIsEnabled (tr_blocklistFile * b)
void
tr_blocklistFileSetEnabled (tr_blocklistFile * b, bool isEnabled)
{
b->isEnabled = isEnabled ? 1 : 0;
assert (b != NULL);
assert (tr_isBool (isEnabled));
b->isEnabled = isEnabled;
}
int

View file

@ -106,7 +106,7 @@ getBlockRun (const tr_cache * cache, int pos, struct run_info * info)
const struct cache_block * b = blocks[i-1];
info->last_block_time = b->time;
info->is_piece_done = tr_torrentPieceIsComplete (b->tor, b->piece);
info->is_multi_piece = b->piece != blocks[pos]->piece ? true : false;
info->is_multi_piece = b->piece != blocks[pos]->piece;
info->len = i - pos;
info->pos = pos;
}

View file

@ -449,7 +449,7 @@ tr_realMakeMetaInfo (tr_metainfo_builder * builder)
tr_variantFree (&top);
if (builder->abortFlag)
builder->result = TR_MAKEMETA_CANCELLED;
builder->isDone = 1;
builder->isDone = true;
}
/***
@ -506,11 +506,13 @@ tr_makeMetaInfo (tr_metainfo_builder * builder,
const tr_tracker_info * trackers,
int trackerCount,
const char * comment,
int isPrivate)
bool isPrivate)
{
int i;
tr_lock * lock;
assert (tr_isBool (isPrivate));
/* free any variables from a previous run */
for (i=0; i<builder->trackerCount; ++i)
tr_free (builder->trackers[i].announce);
@ -519,9 +521,9 @@ tr_makeMetaInfo (tr_metainfo_builder * builder,
tr_free (builder->outputFile);
/* initialize the builder variables */
builder->abortFlag = 0;
builder->abortFlag = false;
builder->result = 0;
builder->isDone = 0;
builder->isDone = false;
builder->pieceIndex = 0;
builder->trackerCount = trackerCount;
builder->trackers = tr_new0 (tr_tracker_info, builder->trackerCount);

View file

@ -60,7 +60,7 @@ typedef struct tr_metainfo_builder
int trackerCount;
char * comment;
char * outputFile;
int isPrivate;
bool isPrivate;
/**
*** These are set inside tr_makeMetaInfo () so the client
@ -70,8 +70,8 @@ typedef struct tr_metainfo_builder
**/
uint32_t pieceIndex;
int abortFlag;
int isDone;
bool abortFlag;
bool isDone;
tr_metainfo_builder_err result;
/* file in use when result was set to _IO_READ or _IO_WRITE,
@ -124,7 +124,7 @@ void tr_makeMetaInfo (tr_metainfo_builder * builder,
const tr_tracker_info * trackers,
int trackerCount,
const char * comment,
int isPrivate);
bool isPrivate);
#ifdef __cplusplus

View file

@ -40,7 +40,7 @@ struct tr_ctor
tr_priority_t bandwidthPriority;
bool isSet_metainfo;
bool isSet_delete;
tr_variant metainfo;
tr_variant metainfo;
char * sourceFile;
struct optional_args optionalArgs[2];
@ -77,7 +77,7 @@ clearMetainfo (tr_ctor * ctor)
{
if (ctor->isSet_metainfo)
{
ctor->isSet_metainfo = 0;
ctor->isSet_metainfo = false;
tr_variantFree (&ctor->metainfo);
}

View file

@ -853,7 +853,7 @@ setLocalErrorIfFilesDisappeared (tr_torrent * tor)
static void
torrentInit (tr_torrent * tor, const tr_ctor * ctor)
{
int doStart;
bool doStart;
uint64_t loaded;
const char * dir;
bool isNewTorrent;
@ -910,7 +910,7 @@ torrentInit (tr_torrent * tor, const tr_ctor * ctor)
refreshCurrentDir (tor);
doStart = tor->isRunning;
tor->isRunning = 0;
tor->isRunning = false;
if (!(loaded & TR_FR_SPEEDLIMIT))
{
@ -1886,8 +1886,8 @@ tr_torrentStop (tr_torrent * tor)
{
tr_sessionLock (tor->session);
tor->isRunning = 0;
tor->isStopping = 0;
tor->isRunning = false;
tor->isStopping = false;
tr_torrentSetDirty (tor);
tr_runInEventThread (tor->session, stopTorrent, tor);
@ -1917,7 +1917,7 @@ closeTorrent (void * vtor)
tr_torrentRemoveResume (tor);
}
tor->isRunning = 0;
tor->isRunning = false;
freeTorrent (tor);
}