diff --git a/libtransmission/session.c b/libtransmission/session.c index cd3d30654..7bff0381d 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -126,7 +126,7 @@ loadBlocklists( tr_session * session ) char * dirname; DIR * odir = NULL; tr_list * list = NULL; - const int isEnabled = session->isBlocklistEnabled; + const tr_bool isEnabled = session->isBlocklistEnabled; /* walk through the directory and find blocklists */ dirname = tr_buildPath( session->configDir, "blocklists", NULL ); @@ -759,12 +759,13 @@ tr_blocklistIsEnabled( const tr_session * session ) void tr_blocklistSetEnabled( tr_session * session, - int isEnabled ) + tr_bool isEnabled ) { tr_list * l; - session->isBlocklistEnabled = isEnabled ? 1 : 0; - for( l = session->blocklists; l; l = l->next ) + session->isBlocklistEnabled = isEnabled != 0; + + for( l=session->blocklists; l!=NULL; l=l->next ) _tr_blocklistSetEnabled( l->data, isEnabled ); } @@ -1073,9 +1074,9 @@ tr_sessionIsProxyEnabled( const tr_session * session ) void tr_sessionSetProxyEnabled( tr_session * session, - int isEnabled ) + tr_bool isEnabled ) { - session->isProxyEnabled = isEnabled ? 1 : 0; + session->isProxyEnabled = isEnabled != 0; } tr_proxy_type @@ -1116,7 +1117,7 @@ tr_sessionSetProxy( tr_session * session, void tr_sessionSetProxyPort( tr_session * session, - int port ) + tr_port port ) { session->proxyPort = port; } @@ -1129,9 +1130,9 @@ tr_sessionIsProxyAuthEnabled( const tr_session * session ) void tr_sessionSetProxyAuthEnabled( tr_session * session, - int isEnabled ) + tr_bool isEnabled ) { - session->isProxyAuthEnabled = isEnabled ? 1 : 0; + session->isProxyAuthEnabled = isEnabled != 0; } const char* diff --git a/libtransmission/torrent-ctor.c b/libtransmission/torrent-ctor.c index edbcfde8c..fbaeba100 100644 --- a/libtransmission/torrent-ctor.c +++ b/libtransmission/torrent-ctor.c @@ -154,9 +154,9 @@ tr_ctorSetMetainfoFromHash( tr_ctor * ctor, void tr_ctorSetDeleteSource( tr_ctor * ctor, - uint8_t deleteSource ) + tr_bool deleteSource ) { - ctor->doDelete = deleteSource ? 1 : 0; + ctor->doDelete = deleteSource != 0; ctor->isSet_delete = 1; } @@ -180,9 +180,9 @@ tr_ctorGetDeleteSource( const tr_ctor * ctor, void tr_ctorSetSave( tr_ctor * ctor, - int saveInOurTorrentsDir ) + tr_bool saveInOurTorrentsDir ) { - ctor->saveInOurTorrentsDir = saveInOurTorrentsDir ? 1 : 0; + ctor->saveInOurTorrentsDir = saveInOurTorrentsDir != 0; } int @@ -194,7 +194,7 @@ tr_ctorGetSave( const tr_ctor * ctor ) void tr_ctorSetPaused( tr_ctor * ctor, tr_ctorMode mode, - uint8_t isPaused ) + tr_bool isPaused ) { struct optional_args * args = &ctor->optionalArgs[mode]; diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index 7f3a2221f..47927e295 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -37,7 +37,7 @@ struct tr_ratecontrol; **/ void tr_ctorSetSave( tr_ctor * ctor, - int saveMetadataInOurTorrentsDir ); + tr_bool saveMetadataInOurTorrentsDir ); int tr_ctorGetSave( const tr_ctor * ctor ); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index ac94eb9a8..e0e97a91f 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -460,32 +460,26 @@ const char* tr_sessionGetProxyUsername( const tr_session * ); const char* tr_sessionGetProxyPassword( const tr_session * ); -void tr_sessionSetProxyEnabled( tr_session *, - int isEnabled ); +void tr_sessionSetProxyEnabled( tr_session * session, + tr_bool isEnabled ); -void tr_sessionSetProxyAuthEnabled( tr_session *, - int isEnabled ); +void tr_sessionSetProxyAuthEnabled( tr_session * session, + tr_bool isEnabled ); -void tr_sessionSetProxy( - tr_session *, - const char * - proxy ); +void tr_sessionSetProxy( tr_session * session, + const char * proxy ); -void tr_sessionSetProxyPort( tr_session *, - int port ); +void tr_sessionSetProxyPort( tr_session * session, + tr_port port ); -void tr_sessionSetProxyType( tr_session *, - tr_proxy_type ); +void tr_sessionSetProxyType( tr_session * session, + tr_proxy_type proxy_type ); -void tr_sessionSetProxyUsername( - tr_session *, - const char * - username ); +void tr_sessionSetProxyUsername( tr_session * session, + const char * username ); -void tr_sessionSetProxyPassword( - tr_session *, - const char * - password ); +void tr_sessionSetProxyPassword( tr_session * session, + const char * password ); /** *** @@ -689,7 +683,7 @@ int tr_blocklistExists( const tr_session * session ); int tr_blocklistIsEnabled( const tr_session * session ); void tr_blocklistSetEnabled( tr_session * session, - int isEnabled ); + tr_bool isEnabled ); /** @} */ @@ -738,7 +732,7 @@ tr_ctor* tr_ctorNew( const tr_session * session ); void tr_ctorFree( tr_ctor * ctor ); void tr_ctorSetDeleteSource( tr_ctor * ctor, - uint8_t doDelete ); + tr_bool doDelete ); int tr_ctorSetMetainfo( tr_ctor * ctor, const uint8_t * metainfo, @@ -765,9 +759,9 @@ void tr_ctorSetDownloadDir( tr_ctor * ctor, /** Set whether or not the torrent begins downloading/seeding when created. (Default: not paused) */ -void tr_ctorSetPaused( tr_ctor * ctor, - tr_ctorMode mode, - uint8_t isPaused ); +void tr_ctorSetPaused( tr_ctor * ctor, + tr_ctorMode mode, + tr_bool isPaused ); int tr_ctorGetPeerLimit( const tr_ctor * ctor, tr_ctorMode mode, @@ -775,7 +769,7 @@ int tr_ctorGetPeerLimit( const tr_ctor * ctor, int tr_ctorGetPaused( const tr_ctor * ctor, tr_ctorMode mode, - uint8_t * setmeIsPaused ); + tr_bool * setmeIsPaused ); int tr_ctorGetDownloadDir( const tr_ctor * ctor, tr_ctorMode mode, @@ -785,7 +779,7 @@ int tr_ctorGetMetainfo( const tr_ctor * ctor, const struct tr_benc ** setme ); int tr_ctorGetDeleteSource( const tr_ctor * ctor, - uint8_t * setmeDoDelete ); + tr_bool * setmeDoDelete ); /* returns NULL if tr_ctorSetMetainfoFromFile() wasn't used */ const char* tr_ctorGetSourceFile( const tr_ctor * ctor );