diff options
author | erdgeist <> | 2007-10-12 21:57:12 +0000 |
---|---|---|
committer | erdgeist <> | 2007-10-12 21:57:12 +0000 |
commit | 4c15dc7a70b189a7ae2cc66196c42f26881eb85e (patch) | |
tree | f34328ff703580dfd287a312a602ec636d27b526 | |
parent | dd82db18ad50c391c22fe3e41d25d7eedf21528d (diff) |
make 64bit safe
-rw-r--r-- | opentracker.c | 4 | ||||
-rw-r--r-- | trackerlogic.c | 2 | ||||
-rw-r--r-- | trackerlogic.h | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/opentracker.c b/opentracker.c index 67e9f9a..ad6dad4 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -318,7 +318,7 @@ static void httpresponse( const int64 s, char *data ) { | |||
318 | ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); | 318 | ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); |
319 | if( !( reply_size = return_stats_for_slash24s( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; | 319 | if( !( reply_size = return_stats_for_slash24s( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; |
320 | gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; | 320 | gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; |
321 | reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %ld\n", diff ); | 321 | reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %u\n", diff ); |
322 | break; | 322 | break; |
323 | } | 323 | } |
324 | case STATS_SLASH24S_OLD: | 324 | case STATS_SLASH24S_OLD: |
@@ -326,7 +326,7 @@ static void httpresponse( const int64 s, char *data ) { | |||
326 | ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); | 326 | ot_dword diff; struct timeval tv1, tv2; gettimeofday( &tv1, NULL ); |
327 | if( !( reply_size = return_stats_for_slash24s_old( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; | 327 | if( !( reply_size = return_stats_for_slash24s_old( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 25, 16 ) ) ) HTTPERROR_500; |
328 | gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; | 328 | gettimeofday( &tv2, NULL ); diff = ( tv2.tv_sec - tv1.tv_sec ) * 1000000 + tv2.tv_usec - tv1.tv_usec; |
329 | reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %ld\n", diff ); | 329 | reply_size += sprintf( SUCCESS_HTTP_HEADER_LENGTH + static_outbuf + reply_size, "Time taken: %u\n", diff ); |
330 | break; | 330 | break; |
331 | } | 331 | } |
332 | } | 332 | } |
diff --git a/trackerlogic.c b/trackerlogic.c index 9ca283e..239efb8 100644 --- a/trackerlogic.c +++ b/trackerlogic.c | |||
@@ -669,7 +669,7 @@ size_t return_stats_for_slash24s( char *reply, size_t amount, ot_dword thresh ) | |||
669 | byte_zero( counts, sizeof( counts ) ); | 669 | byte_zero( counts, sizeof( counts ) ); |
670 | byte_zero( slash24s, amount * 2 * sizeof(ot_dword) ); | 670 | byte_zero( slash24s, amount * 2 * sizeof(ot_dword) ); |
671 | 671 | ||
672 | r += sprintf( r, "Stats for all /24s with more than %ld announced torrents:\n\n", thresh ); | 672 | r += sprintf( r, "Stats for all /24s with more than %u announced torrents:\n\n", thresh ); |
673 | 673 | ||
674 | for( i=0; i<256; ++i ) { | 674 | for( i=0; i<256; ++i ) { |
675 | ot_vector *torrents_list = &all_torrents[i]; | 675 | ot_vector *torrents_list = &all_torrents[i]; |
diff --git a/trackerlogic.h b/trackerlogic.h index 35dd9c8..37e2451 100644 --- a/trackerlogic.h +++ b/trackerlogic.h | |||
@@ -11,9 +11,9 @@ | |||
11 | /* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */ | 11 | /* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */ |
12 | /* They mark memory used as data instead of integer or human readable string - | 12 | /* They mark memory used as data instead of integer or human readable string - |
13 | they should be cast before used as integer/text */ | 13 | they should be cast before used as integer/text */ |
14 | typedef unsigned char ot_byte; | 14 | typedef uint8_t ot_byte; |
15 | typedef unsigned short ot_word; | 15 | typedef uint16_t ot_word; |
16 | typedef unsigned long ot_dword; | 16 | typedef uint32_t ot_dword; |
17 | 17 | ||
18 | typedef ot_byte ot_hash[20]; | 18 | typedef ot_byte ot_hash[20]; |
19 | typedef ot_dword ot_ip; | 19 | typedef ot_dword ot_ip; |