(trunk libT) fix various minor compiler warnings that show up when you build libtransmission with NDEBUG defined

This commit is contained in:
Charles Kerr 2009-12-28 23:27:17 +00:00
parent ee58472ec2
commit 1eb0cdd7c6
5 changed files with 24 additions and 16 deletions

View File

@ -128,6 +128,9 @@ struct peer_atom
time_t shelf_date;
};
#ifdef NDEBUG
#define tr_isAtom(a) (TRUE)
#else
static tr_bool
tr_isAtom( const struct peer_atom * atom )
{
@ -135,6 +138,7 @@ tr_isAtom( const struct peer_atom * atom )
&& ( atom->from < TR_PEER_FROM__MAX )
&& ( tr_isAddress( &atom->addr ) );
}
#endif
static const char*
tr_atomAddrStr( const struct peer_atom * atom )

View File

@ -1377,7 +1377,9 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf, size_t inlen )
uint32_t ui32;
uint32_t msglen = msgs->incoming.length;
const uint8_t id = msgs->incoming.id;
#ifndef NDEBUG
const size_t startBufLen = EVBUFFER_LENGTH( inbuf );
#endif
const tr_bool fext = tr_peerIoSupportsFEXT( msgs->peer->io );
--msglen; /* id length */

View File

@ -170,17 +170,19 @@ tr_ptrArrayLowerBound( const tr_ptrArray * t,
return first;
}
#ifdef NDEBUG
#define assertSortedAndUnique(a,b)
#else
static void
assertSortedAndUnique( const tr_ptrArray * t,
int compare(const void*, const void*) )
{
#ifndef NDEBUG
int i;
for( i = 0; i < t->n_items - 2; ++i )
assert( compare( t->items[i], t->items[i + 1] ) <= 0 );
#endif
}
#endif
int
tr_ptrArrayInsertSorted( tr_ptrArray * t,

View File

@ -183,7 +183,7 @@ static const char*
torrentStart( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
@ -204,7 +204,7 @@ static const char*
torrentStop( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
@ -225,7 +225,7 @@ static const char*
torrentRemove( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i;
int torrentCount;
@ -252,7 +252,7 @@ static const char*
torrentReannounce( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
@ -277,7 +277,7 @@ static const char*
torrentVerify( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
@ -618,7 +618,7 @@ static const char*
torrentGet( tr_session * session,
tr_benc * args_in,
tr_benc * args_out,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
@ -737,7 +737,7 @@ static const char*
torrentSet( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
const char * errmsg = NULL;
int i, torrentCount;
@ -793,7 +793,7 @@ static const char*
torrentSetLocation( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
const char * errmsg = NULL;
const char * location = NULL;
@ -1132,7 +1132,7 @@ static const char*
sessionSet( tr_session * session,
tr_benc * args_in,
tr_benc * args_out UNUSED,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int64_t i;
double d;
@ -1207,7 +1207,7 @@ static const char*
sessionStats( tr_session * session,
tr_benc * args_in UNUSED,
tr_benc * args_out,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
int running = 0;
int total = 0;
@ -1254,7 +1254,7 @@ static const char*
sessionGet( tr_session * s,
tr_benc * args_in UNUSED,
tr_benc * args_out,
struct tr_rpc_idle_data * idle_data )
struct tr_rpc_idle_data * idle_data UNUSED )
{
const char * str;
tr_benc * d = args_out;

View File

@ -187,16 +187,16 @@ dht_bootstrap(void *closure)
if(!bootstrap_done(cl->session, 0)) {
char *bootstrap_file;
FILE *f;
FILE *f = NULL;
bootstrap_file =
tr_buildPath(cl->session->configDir, "dht.bootstrap", NULL);
if(bootstrap_file)
f = fopen(bootstrap_file, "r");
if(f) {
if(f != NULL) {
tr_ninf("DHT", "Attempting manual bootstrap");
while(1) {
for(;;) {
char buf[201];
char *p;
int port = 0;