Don't bencode signed integers as unsigned.

This commit is contained in:
Josh Elsasser 2007-05-09 07:00:08 +00:00
parent 209eb5651a
commit a3ca76cced
2 changed files with 6 additions and 3 deletions

View File

@ -187,7 +187,7 @@ static void __bencPrint( benc_val_t * val, int space )
switch( val->type ) switch( val->type )
{ {
case TYPE_INT: case TYPE_INT:
fprintf( stderr, "int: %"PRIu64"\n", val->val.i ); fprintf( stderr, "int: %"PRId64"\n", val->val.i );
break; break;
case TYPE_STR: case TYPE_STR:
@ -431,7 +431,7 @@ int tr_bencSave( benc_val_t * val, char ** buf, int * used, int * max )
switch( val->type ) switch( val->type )
{ {
case TYPE_INT: case TYPE_INT:
if( tr_sprintf( buf, used, max, "i%"PRIu64"e", val->val.i ) ) if( tr_sprintf( buf, used, max, "i%"PRId64"e", val->val.i ) )
{ {
return 1; return 1;
} }

View File

@ -32,8 +32,11 @@ extern "C" {
#include "version.h" #include "version.h"
#include <inttypes.h> #include <inttypes.h>
#ifndef PRId64
# define PRId64 "lld"
#endif
#ifndef PRIu64 #ifndef PRIu64
# define PRIu64 "lld" # define PRIu64 "llu"
#endif #endif
#include <time.h> #include <time.h>