From 900aff7beb2a78304e929c8d0e8cdad6bf9eedfa Mon Sep 17 00:00:00 2001 From: Josh Elsasser Date: Wed, 18 Jul 2007 17:25:42 +0000 Subject: [PATCH] Include trcompat.h for asprintf() Don't mix function and non function pointers without casting. Replace a couple bzero()s with memset()s. Remove a stray ; Include a missing header. --- libtransmission/clients.c | 2 ++ libtransmission/http.c | 1 + libtransmission/ipcparse.c | 12 ++++++------ libtransmission/peertree.h | 2 +- libtransmission/platform.c | 2 +- libtransmission/upnp.c | 2 ++ 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libtransmission/clients.c b/libtransmission/clients.c index fed399f02..417e12e2f 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.c @@ -23,7 +23,9 @@ *****************************************************************************/ #include /* isprint */ + #include "transmission.h" +#include "trcompat.h" static int charToInt( char character ); diff --git a/libtransmission/http.c b/libtransmission/http.c index e22f97c5f..8876979ce 100644 --- a/libtransmission/http.c +++ b/libtransmission/http.c @@ -31,6 +31,7 @@ #include "transmission.h" #include "http.h" #include "net.h" +#include "trcompat.h" #define HTTP_PORT 80 /* default http port 80 */ #define HTTP_TIMEOUT 60000 /* one minute http timeout */ diff --git a/libtransmission/ipcparse.c b/libtransmission/ipcparse.c index 6035f88d1..5a7ebce92 100644 --- a/libtransmission/ipcparse.c +++ b/libtransmission/ipcparse.c @@ -240,7 +240,7 @@ ipc_initmsgs( void ) if( NULL != tree ) { RB_INIT( &tree->msgs ); - tree->def = NULL; + tree->def = (trd_msgfunc) NULL; } return tree; @@ -254,7 +254,7 @@ ipc_addmsg( struct ipc_funcs * tree, enum ipc_msg id, trd_msgfunc func ) assert( MSGVALID( id ) ); assert( IPC_MSG_VERSION != id ); - bzero( &key, sizeof key ); + memset( &key, 0, sizeof key ); key.id = id; entry = RB_FIND( functree, &tree->msgs, &key ); assert( NULL == entry ); @@ -1114,7 +1114,7 @@ gotmsg( struct ipc_info * info, benc_val_t * name, benc_val_t * val, msg = msglookup( name->val.s.s ); if( NULL != msg && msg->minvers <= info->vers ) { - bzero( &key, sizeof key ); + memset( &key, 0, sizeof key ); key.id = msg->id; handler = RB_FIND( functree, &info->funcs->msgs, &key ); if( NULL != handler ) @@ -1162,7 +1162,7 @@ ipc_ishandled( struct ipc_info * info, enum ipc_msg id ) assert( MSGVALID( id ) ); - bzero( &key, sizeof key ); + memset( &key, 0, sizeof key ); key.id = id; return ( NULL != RB_FIND( functree, &info->funcs->msgs, &key ) ); } @@ -1218,7 +1218,7 @@ ipc_infotypes( enum ipc_msg id, benc_val_t * list ) return ret; } - bzero( &key, sizeof key ); + memset( &key, 0, sizeof key ); for( jj = 0; list->val.l.count > jj; jj++ ) { name = &list->val.l.vals[jj]; @@ -1302,7 +1302,7 @@ msglookup( const char * name ) } } - bzero( &key, sizeof key ); + memset( &key, 0, sizeof key ); key.name = name; return RB_FIND( msgtree, &tree, &key ); } diff --git a/libtransmission/peertree.h b/libtransmission/peertree.h index ddff64b59..25de1c8e5 100644 --- a/libtransmission/peertree.h +++ b/libtransmission/peertree.h @@ -46,7 +46,7 @@ peertreekeycmp( tr_peertree_entry_t * aa, tr_peertree_entry_t * bb ) return memcmp( aa->peer, bb->peer, 6 ); } -RB_GENERATE_STATIC( tr_peertree_s, tr_peertree_entry_s, magic, peertreekeycmp ); +RB_GENERATE_STATIC( tr_peertree_s, tr_peertree_entry_s, magic, peertreekeycmp ) static int peertreeCount( tr_peertree_t * tree ) diff --git a/libtransmission/platform.c b/libtransmission/platform.c index 4196b41a2..8a7c87233 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.c @@ -227,7 +227,7 @@ void tr_threadCreate( tr_thread_t * t, B_NORMAL_PRIORITY, t ); resume_thread( t->thread ); #else - pthread_create( &t->thread, NULL, (void *) ThreadFunc, t ); + pthread_create( &t->thread, NULL, (void * (*) (void *)) ThreadFunc, t ); #endif } diff --git a/libtransmission/upnp.c b/libtransmission/upnp.c index c81fb569e..42ff7a0cb 100644 --- a/libtransmission/upnp.c +++ b/libtransmission/upnp.c @@ -26,11 +26,13 @@ #include #include #include +#include #include #include "transmission.h" #include "http.h" #include "net.h" +#include "trcompat.h" #include "upnp.h" #include "xml.h"