(libT) fix some minor warnings foudn by clang's scan-build and reported by m1b

This commit is contained in:
Charles Kerr 2008-07-17 20:33:34 +00:00
parent 1489451d7e
commit 2eb89eb2a7
6 changed files with 4 additions and 11 deletions

View File

@ -446,7 +446,6 @@ static void grow_parse_buffer(JSON_parser jc)
static int parse_parse_buffer(JSON_parser jc)
{
if (jc->callback) {
int result = 1;
JSON_value value, *arg = NULL;
if (jc->type != JSON_T_NONE) {
@ -466,12 +465,12 @@ static int parse_parse_buffer(JSON_parser jc)
value.vu.str.value = jc->parse_buffer;
value.vu.str.length = jc->parse_buffer_count;
} else {
result = sscanf(jc->parse_buffer, "%Lf", &value.vu.float_value);
sscanf(jc->parse_buffer, "%Lf", &value.vu.float_value);
}
break;
case JSON_T_INTEGER:
arg = &value;
result = sscanf(jc->parse_buffer, JSON_PARSER_INTEGER_SSCANF_TOKEN, &value.vu.integer_value);
sscanf(jc->parse_buffer, JSON_PARSER_INTEGER_SSCANF_TOKEN, &value.vu.integer_value);
break;
case JSON_T_STRING:
arg = &value;

View File

@ -232,7 +232,6 @@ recalculateHash( const tr_torrent * tor,
int n;
tr_errno err;
const tr_info * info;
/* only check one block at a time to prevent disk thrashing.
* this also lets us reuse the same buffer each time. */
@ -245,7 +244,6 @@ recalculateHash( const tr_torrent * tor,
assert( setme != NULL );
assert( pieceIndex < tor->info.pieceCount );
info = &tor->info;
n = tr_torPieceCountBytes( tor, pieceIndex );
if( buflen < n ) {

View File

@ -404,8 +404,7 @@ tr_metainfoParse( const tr_handle * handle,
/* get file or top directory name */
val = tr_bencDictFindFirst( beInfo, "name.utf-8", "name", NULL );
if( parseFiles( inf, tr_bencDictFindFirst( beInfo,
"name.utf-8", "name", NULL ),
if( parseFiles( inf, val,
tr_bencDictFind( beInfo, "files" ),
tr_bencDictFind( beInfo, "length" ) ) )
{

View File

@ -73,7 +73,6 @@ tr_peerIdNew( void )
}
val = total % base ? base - (total % base) : 0;
total += val;
buf[19] = pool[val];
buf[20] = '\0';

View File

@ -241,7 +241,7 @@ getBytePiece( const tr_info * info, uint64_t byteOffset )
static void
initFilePieces ( tr_info * info, tr_file_index_t fileIndex )
{
tr_file * file = &info->files[fileIndex];
tr_file * file;
uint64_t firstByte, lastByte;
assert( info != NULL );

View File

@ -57,7 +57,6 @@ processCompletedTasks( tr_web * web )
{
CURL * easy;
CURLMsg * msg;
CURLcode res;
do {
/* this convoluted loop is from the "hiperinfo.c" sample which
@ -68,7 +67,6 @@ processCompletedTasks( tr_web * web )
while(( msg = curl_multi_info_read( web->cm, &more ))) {
if( msg->msg == CURLMSG_DONE ) {
easy = msg->easy_handle;
res = msg->data.result;
break;
}
}