(trunk libT) fix some code that the newly-added gcc warnings didn't like
This commit is contained in:
parent
0e072e7c25
commit
13c22f88ff
|
@ -10,23 +10,31 @@
|
|||
#include "json.h"
|
||||
#include "utils.h" /* tr_free */
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
static int test = 0;
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ ); \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
testInt( void )
|
||||
|
|
|
@ -6,22 +6,29 @@
|
|||
#include "net.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A )\
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
createTestBlocklist( const char * tmpfile )
|
||||
|
@ -45,11 +52,11 @@ int
|
|||
main( void )
|
||||
{
|
||||
#ifndef WIN32
|
||||
char * tmpfile_txt = "/tmp/transmission-blocklist-test.txt";
|
||||
char * tmpfile_bin = "/tmp/transmission-blocklist-test.bin";
|
||||
const char * tmpfile_txt = "/tmp/transmission-blocklist-test.txt";
|
||||
const char * tmpfile_bin = "/tmp/transmission-blocklist-test.bin";
|
||||
#else
|
||||
char * tmpfile_txt = "transmission-blocklist-test.txt";
|
||||
char * tmpfile_bin = "transmission-blocklist-test.bin";
|
||||
const char * tmpfile_txt = "transmission-blocklist-test.txt";
|
||||
const char * tmpfile_bin = "transmission-blocklist-test.bin";
|
||||
#endif
|
||||
struct tr_address addr;
|
||||
int test = 0;
|
||||
|
|
|
@ -4,22 +4,29 @@
|
|||
#include "transmission.h"
|
||||
#include "clients.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TEST_CLIENT( A, B ) \
|
||||
tr_clientForId( buf, sizeof( buf ), A ); \
|
||||
|
|
|
@ -5,23 +5,31 @@
|
|||
#include "json.h"
|
||||
#include "utils.h" /* tr_free */
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
static int test = 0;
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ ); \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "ConvertUTF.h"
|
||||
|
||||
|
|
|
@ -4,22 +4,29 @@
|
|||
#include "peer-msgs.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main( void )
|
||||
|
|
|
@ -2,23 +2,31 @@
|
|||
#include "transmission.h"
|
||||
#include "request-list.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
static int test = 0;
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ ); \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
testFoo( void )
|
||||
|
|
|
@ -5,24 +5,31 @@
|
|||
#include "rpcimpl.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
static int test = 0;
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
test_list( void )
|
||||
|
|
|
@ -510,7 +510,7 @@ torrentGet( tr_session * session,
|
|||
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
|
||||
tr_benc * list = tr_bencDictAddList( args_out, "torrents", torrentCount );
|
||||
tr_benc * fields;
|
||||
char * msg = NULL;
|
||||
const char * msg = NULL;
|
||||
|
||||
assert( idle_data == NULL );
|
||||
|
||||
|
|
|
@ -5,22 +5,29 @@
|
|||
#include "session.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main( void )
|
||||
|
|
|
@ -25,7 +25,7 @@ int tr_optind = 1;
|
|||
static const char*
|
||||
getArgName( const tr_option * opt )
|
||||
{
|
||||
char * arg;
|
||||
const char * arg;
|
||||
|
||||
if( !opt->has_arg )
|
||||
arg = "";
|
||||
|
|
|
@ -30,11 +30,11 @@ extern int tr_optind;
|
|||
typedef struct tr_option
|
||||
{
|
||||
int val; /* the value to return from tr_getopt() */
|
||||
char * longName; /* --long-form */
|
||||
char * description; /* option's description for tr_getopt_usage() */
|
||||
char * shortName; /* short form */
|
||||
const char * longName; /* --long-form */
|
||||
const char * description; /* option's description for tr_getopt_usage() */
|
||||
const char * shortName; /* short form */
|
||||
int has_arg; /* 0 for no argument, 1 for argument */
|
||||
char * argName; /* argument's description for tr_getopt_usage() */
|
||||
const char * argName; /* argument's description for tr_getopt_usage() */
|
||||
}
|
||||
tr_option;
|
||||
|
||||
|
|
|
@ -6,32 +6,39 @@
|
|||
#include "utils.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#undef VERBOSE
|
||||
#define NUM_LOOPS 1
|
||||
#define SPEED_TEST 0
|
||||
|
||||
#if SPEED_TEST
|
||||
#undef VERBOSE
|
||||
#define VERBOSE 0
|
||||
#define VERBOSE
|
||||
#undef NUM_LOOPS
|
||||
#define NUM_LOOPS 200
|
||||
#endif
|
||||
|
||||
static int test = 0;
|
||||
|
||||
#define check( A ) \
|
||||
#ifdef VERBOSE
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( A ){ \
|
||||
if( VERBOSE ) \
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ );\
|
||||
fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
} else { \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__,\
|
||||
__LINE__ ); \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define check( A ) \
|
||||
{ \
|
||||
++test; \
|
||||
if( !( A ) ){ \
|
||||
fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
|
||||
return test; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
test_bitfields( void )
|
||||
|
@ -187,8 +194,7 @@ main( void )
|
|||
int l;
|
||||
|
||||
/* base64 */
|
||||
in = "YOYO!";
|
||||
out = tr_base64_encode( in, -1, &len );
|
||||
out = tr_base64_encode( "YOYO!", -1, &len );
|
||||
check( out );
|
||||
check( !strcmp( out, "WU9ZTyE=\n" ) );
|
||||
check( len == 9 );
|
||||
|
|
Loading…
Reference in New Issue