From 2eb89eb2a78b30d765b0b9a84a9a6f3f162514e6 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 17 Jul 2008 20:33:34 +0000 Subject: [PATCH] (libT) fix some minor warnings foudn by clang's scan-build and reported by m1b --- libtransmission/JSON_parser.c | 5 ++--- libtransmission/inout.c | 2 -- libtransmission/metainfo.c | 3 +-- libtransmission/session.c | 1 - libtransmission/torrent.c | 2 +- libtransmission/web.c | 2 -- 6 files changed, 4 insertions(+), 11 deletions(-) diff --git a/libtransmission/JSON_parser.c b/libtransmission/JSON_parser.c index 99f0a4af5..21c7f353b 100644 --- a/libtransmission/JSON_parser.c +++ b/libtransmission/JSON_parser.c @@ -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; diff --git a/libtransmission/inout.c b/libtransmission/inout.c index 3ce85ba45..e516ba440 100644 --- a/libtransmission/inout.c +++ b/libtransmission/inout.c @@ -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 ) { diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index ea36bd08c..8531f37d5 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -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" ) ) ) { diff --git a/libtransmission/session.c b/libtransmission/session.c index 8fe972601..bead81f07 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -73,7 +73,6 @@ tr_peerIdNew( void ) } val = total % base ? base - (total % base) : 0; - total += val; buf[19] = pool[val]; buf[20] = '\0'; diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 7bd2b8f11..5b4ff7674 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -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 ); diff --git a/libtransmission/web.c b/libtransmission/web.c index d41f206f6..2c2a145e3 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -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; } } -- 2.40.0