1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-19 10:15:36 +00:00

(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; time_t shelf_date;
}; };
#ifdef NDEBUG
#define tr_isAtom(a) (TRUE)
#else
static tr_bool static tr_bool
tr_isAtom( const struct peer_atom * atom ) tr_isAtom( const struct peer_atom * atom )
{ {
@ -135,6 +138,7 @@ tr_isAtom( const struct peer_atom * atom )
&& ( atom->from < TR_PEER_FROM__MAX ) && ( atom->from < TR_PEER_FROM__MAX )
&& ( tr_isAddress( &atom->addr ) ); && ( tr_isAddress( &atom->addr ) );
} }
#endif
static const char* static const char*
tr_atomAddrStr( const struct peer_atom * atom ) 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 ui32;
uint32_t msglen = msgs->incoming.length; uint32_t msglen = msgs->incoming.length;
const uint8_t id = msgs->incoming.id; const uint8_t id = msgs->incoming.id;
#ifndef NDEBUG
const size_t startBufLen = EVBUFFER_LENGTH( inbuf ); const size_t startBufLen = EVBUFFER_LENGTH( inbuf );
#endif
const tr_bool fext = tr_peerIoSupportsFEXT( msgs->peer->io ); const tr_bool fext = tr_peerIoSupportsFEXT( msgs->peer->io );
--msglen; /* id length */ --msglen; /* id length */

View file

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

View file

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

View file

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