diff --git a/cli/transmissioncli.c b/cli/transmissioncli.c index a6126b762..db9784a37 100644 --- a/cli/transmissioncli.c +++ b/cli/transmissioncli.c @@ -127,13 +127,13 @@ int main( int argc, char ** argv ) printf( "tracker: %s:%d\n", info->trackerAddress, info->trackerPort ); printf( "announce: %s\n", info->trackerAnnounce ); - printf( "size: %lld (%lld * %d + %lld)\n", + printf( "size: %"PRIu64" (%"PRIu64" * %d + %"PRIu64")\n", info->totalSize, info->totalSize / info->pieceSize, info->pieceSize, info->totalSize % info->pieceSize ); printf( "file(s):\n" ); for( i = 0; i < info->fileCount; i++ ) { - printf( " %s (%lld)\n", info->files[i].name, + printf( " %s (%"PRIu64")\n", info->files[i].name, info->files[i].length ); } diff --git a/libtransmission/bencode.c b/libtransmission/bencode.c index fca279816..136f7898f 100644 --- a/libtransmission/bencode.c +++ b/libtransmission/bencode.c @@ -163,7 +163,7 @@ static void __bencPrint( benc_val_t * val, int space ) switch( val->type ) { case TYPE_INT: - fprintf( stderr, "int: %lld\n", val->val.i ); + fprintf( stderr, "int: %"PRIu64"\n", val->val.i ); break; case TYPE_STR: @@ -261,7 +261,7 @@ int tr_bencSave( benc_val_t * val, char ** buf, size_t * used, size_t * max ) switch( val->type ) { case TYPE_INT: - if( tr_bencSprintf( buf, used, max, "i%llde", val->val.i ) ) + if( tr_bencSprintf( buf, used, max, "i%"PRIu64"e", val->val.i ) ) { return 1; } diff --git a/libtransmission/internal.h b/libtransmission/internal.h index 351bf7771..efcbcd835 100644 --- a/libtransmission/internal.h +++ b/libtransmission/internal.h @@ -49,6 +49,12 @@ # include #endif +#ifdef __GNUC__ +# define UNUSED __attribute__((unused)) +#else +# define UNUSED +#endif + /* We use OpenSSL whenever possible, since it is likely to be more optimized and it is ok to use it with a MIT-licensed application. Otherwise, we use the included implementation by vi@nwr.jp. */ diff --git a/libtransmission/net.c b/libtransmission/net.c index b8cf5d360..c8b876d0d 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -171,7 +171,7 @@ static void resolveRelease( tr_resolve_t * r ) * Keeps waiting for addresses to resolve, and removes them from the * queue once resolution is done. **********************************************************************/ -static void resolveFunc( void * unused ) +static void resolveFunc( void * arg UNUSED ) { tr_resolve_t * r; struct hostent * host; diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index 54a618d0d..72da90e52 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -332,9 +332,9 @@ static void sendQuery( tr_tracker_t * tc ) "info_hash=%s&" "peer_id=%s&" "port=%d&" - "uploaded=%lld&" - "downloaded=%lld&" - "left=%lld&" + "uploaded=%"PRIu64"&" + "downloaded=%"PRIu64"&" + "left=%"PRIu64"&" "compact=1&" "numwant=50&" "key=%s" diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index e835810d7..38ca8c2ce 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -28,6 +28,9 @@ extern "C" { #endif #include +#ifndef PRIu64 +# define PRIu64 "lld" +#endif #define SHA_DIGEST_LENGTH 20 #ifdef __BEOS__