make 64bit safe

dynamic-accesslists
erdgeist 17 years ago
parent dd82db18ad
commit 4c15dc7a70

@ -318,7 +318,7 @@ static void httpresponse( const int64 s, char *data ) {
ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL );
if( !( reply_size = return_stats_for_slash24s( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; if( !( reply_size = return_stats_for_slash24s( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500;
gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec;
reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %ld\n", diff ); reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %u\n", diff );
break; break;
} }
case STATS_SLASH24S_OLD: case STATS_SLASH24S_OLD:
@ -326,7 +326,7 @@ static void httpresponse( const int64 s, char *data ) {
ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL );
if( !( reply_size = return_stats_for_slash24s_old( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; if( !( reply_size = return_stats_for_slash24s_old( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500;
gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec;
reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %ld\n", diff ); reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %u\n", diff );
break; break;
} }
} }

@ -669,7 +669,7 @@ size_t return_stats_for_slash24s( char *reply, size_t amount, ot_dword thresh )
byte_zero( counts, sizeof( counts ) ); byte_zero( counts, sizeof( counts ) );
byte_zero( slash24s, amount * 2 * sizeof(ot_dword) ); byte_zero( slash24s, amount * 2 * sizeof(ot_dword) );
r += sprintf( r, "Stats for all /24s with more than %ld announced torrents:\n\n", thresh ); r += sprintf( r, "Stats for all /24s with more than %u announced torrents:\n\n", thresh );
for( i=0; i<256; ++i ) { for( i=0; i<256; ++i ) {
ot_vector *torrents_list = &all_torrents[i]; ot_vector *torrents_list = &all_torrents[i];

@ -11,9 +11,9 @@
/* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */ /* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */
/* They mark memory used as data instead of integer or human readable string - /* They mark memory used as data instead of integer or human readable string -
they should be cast before used as integer/text */ they should be cast before used as integer/text */
typedef unsigned char ot_byte; typedef uint8_t ot_byte;
typedef unsigned short ot_word; typedef uint16_t ot_word;
typedef unsigned long ot_dword; typedef uint32_t ot_dword;
typedef ot_byte ot_hash[20]; typedef ot_byte ot_hash[20];
typedef ot_dword ot_ip; typedef ot_dword ot_ip;

Loading…
Cancel
Save