(trunk libT) experimental commit for wereHamster

This commit is contained in:
Charles Kerr 2009-04-26 16:14:47 +00:00
parent 71060402ab
commit a84a1720a7
3 changed files with 5 additions and 3 deletions

View File

@ -36,6 +36,8 @@ FILE* tr_open_file_for_scanning( const char * filename );
void tr_close_file( FILE * fp );
int64_t tr_lseek( int fd, int64_t offset, int whence );
/**
* Returns an fd to the specified filename.

View File

@ -48,7 +48,7 @@
enum { TR_IO_READ, TR_IO_WRITE };
static int64_t
int64_t
tr_lseek( int fd, int64_t offset, int whence )
{
#if defined(_LARGEFILE_SOURCE)

View File

@ -43,7 +43,7 @@ verifyTorrent( tr_torrent * tor, tr_bool * stopFlag )
{
SHA_CTX sha;
FILE * fp = NULL;
size_t filePos = 0;
int64_t filePos = 0;
tr_bool changed = 0;
tr_bool hadPiece = 0;
uint32_t piecePos = 0;
@ -88,7 +88,7 @@ verifyTorrent( tr_torrent * tor, tr_bool * stopFlag )
/* fprintf( stderr, "reading this pass: %d\n", (int)bytesThisPass ); */
/* read a bit */
if( fp && !fseek( fp, filePos, SEEK_SET ) ) {
if( fp && tr_lseek( fileno(fp), filePos, SEEK_SET ) != -1 ) {
const int64_t numRead = fread( buffer, 1, bytesThisPass, fp );
if( numRead == bytesThisPass )
SHA1_Update( &sha, buffer, numRead );