void
tr_blocklistFileSetEnabled (tr_blocklistFile * b, bool isEnabled)
{
- b->isEnabled = isEnabled ? 1 : 0;
+ assert (b != NULL);
+ assert (tr_isBool (isEnabled));
+
+ b->isEnabled = isEnabled;
}
int
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;
}
tr_variantFree (&top);
if (builder->abortFlag)
builder->result = TR_MAKEMETA_CANCELLED;
- builder->isDone = 1;
+ builder->isDone = true;
}
/***
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);
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);
int trackerCount;
char * comment;
char * outputFile;
- int isPrivate;
+ bool isPrivate;
/**
*** These are set inside tr_makeMetaInfo () so the client
**/
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,
const tr_tracker_info * trackers,
int trackerCount,
const char * comment,
- int isPrivate);
+ bool isPrivate);
#ifdef __cplusplus
tr_priority_t bandwidthPriority;
bool isSet_metainfo;
bool isSet_delete;
- tr_variant metainfo;
+ tr_variant metainfo;
char * sourceFile;
struct optional_args optionalArgs[2];
{
if (ctor->isSet_metainfo)
{
- ctor->isSet_metainfo = 0;
+ ctor->isSet_metainfo = false;
tr_variantFree (&ctor->metainfo);
}
static void
torrentInit (tr_torrent * tor, const tr_ctor * ctor)
{
- int doStart;
+ bool doStart;
uint64_t loaded;
const char * dir;
bool isNewTorrent;
refreshCurrentDir (tor);
doStart = tor->isRunning;
- tor->isRunning = 0;
+ tor->isRunning = false;
if (!(loaded & TR_FR_SPEEDLIMIT))
{
{
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);
tr_torrentRemoveResume (tor);
}
- tor->isRunning = 0;
+ tor->isRunning = false;
freeTorrent (tor);
}