1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 07:33:02 +00:00

(trunk libT) back out the changes for #1580; closing that ticket as invalid

This commit is contained in:
Charles Kerr 2008-12-11 00:39:47 +00:00
parent 4ad84bb275
commit 23b8321463

View file

@ -30,8 +30,6 @@
#include "torrent.h" #include "torrent.h"
#include "utils.h" #include "utils.h"
#define TR_HASH_BUFSIZE (64*1024)
/**** /****
***** Low-level IO functions ***** Low-level IO functions
****/ ****/
@ -217,15 +215,11 @@ recalculateHash( const tr_torrent * tor,
tr_piece_index_t pieceIndex, tr_piece_index_t pieceIndex,
uint8_t * setme ) uint8_t * setme )
{ {
static uint8_t * buf = NULL; size_t bytesLeft;
size_t bytesLeft;
uint32_t offset = 0; uint32_t offset = 0;
int success = TRUE; int success = TRUE;
SHA_CTX sha; SHA_CTX sha;
if( buf == NULL )
buf = tr_new( uint8_t, TR_HASH_BUFSIZE );
assert( tor ); assert( tor );
assert( setme ); assert( setme );
assert( pieceIndex < tor->info.pieceCount ); assert( pieceIndex < tor->info.pieceCount );
@ -235,7 +229,8 @@ recalculateHash( const tr_torrent * tor,
while( bytesLeft ) while( bytesLeft )
{ {
const int len = MIN( bytesLeft, TR_HASH_BUFSIZE ); uint8_t buf[8192];
const int len = MIN( bytesLeft, sizeof( buf ) );
success = !tr_ioRead( tor, pieceIndex, offset, len, buf ); success = !tr_ioRead( tor, pieceIndex, offset, len, buf );
if( !success ) if( !success )
break; break;