Changeset 3568 for trunk/libtransmission/fastresume.c
- Timestamp:
- Oct 26, 2007, 1:13:43 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/fastresume.c
r3430 r3568 440 440 FILE * file ) 441 441 { 442 int i;443 442 const size_t len = FR_PROGRESS_LEN( tor ); 444 443 uint8_t * buf = calloc( len, 1 ); 445 uint8_t * walk = buf; 446 447 if( len != fread( buf, 1, len, file ) ) { 444 int ret = 0; 445 int i; 446 447 if( len != fread( buf, 1, len, file ) ) 448 { 448 449 tr_inf( "Couldn't read from resume file" ); 449 free( buf ); 450 return TR_ERROR_IO_OTHER; 451 } 452 453 /* compare file mtimes */ 454 if (1) { 450 tr_bitfieldAddRange( uncheckedPieces, 0, tor->info.pieceCount ); 451 ret = TR_ERROR_IO_OTHER; 452 } 453 else 454 { 455 455 int n; 456 tr_bitfield bitfield; 457 458 /* compare file mtimes */ 456 459 tr_time_t * curMTimes = getMTimes( tor, &n ); 460 uint8_t * walk = buf; 457 461 const tr_time_t * oldMTimes = (const tr_time_t *) walk; 458 462 for( i=0; i<n; ++i ) { 459 if ( curMTimes[i]!=oldMTimes[i]) {463 if ( !curMTimes[i] || ( curMTimes[i] != oldMTimes[i] ) ) { 460 464 const tr_file * file = &tor->info.files[i]; 461 465 tr_dbg( "File '%s' mtimes differ-- flagging pieces [%d..%d] for recheck", … … 467 471 free( curMTimes ); 468 472 walk += n * sizeof(tr_time_t); 469 } 470 471 /* get the completion bitfield */ 472 if (1) { 473 tr_bitfield bitfield; 473 474 /* get the completion bitfield */ 474 475 memset( &bitfield, 0, sizeof bitfield ); 475 476 bitfield.len = FR_BLOCK_BITFIELD_LEN( tor ); … … 486 487 487 488 free( buf ); 488 return TR_OK;489 return ret; 489 490 } 490 491
Note: See TracChangeset
for help on using the changeset viewer.