Changeset 3573
- Timestamp:
- Oct 26, 2007, 3:02:35 AM (15 years ago)
- Location:
- branches/0.9x
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9x/NEWS
r3569 r3573 12 12 - gtk: 13 13 + Fix 0.90 packaging errors 14 + Fix 0.90 assertion failure: "destination != (void*)0" 14 15 15 16 0.90 (2007/10/23) -
branches/0.9x/gtk/tr_core.c
r3461 r3573 448 448 path = getdownloaddir( ); 449 449 450 torrents = tr_loadTorrents ( self->handle, NULL, paused, &count );450 torrents = tr_loadTorrents ( self->handle, path, paused, &count ); 451 451 for( i=0; i<count; ++i ) 452 452 tr_core_insert( self, tr_torrent_new_preexisting( torrents[i] ) ); -
branches/0.9x/libtransmission/fastresume.c
r3569 r3573 331 331 332 332 static int 333 load FallbackDestination( tr_torrent * tor, FILE * fp)333 loadDestination( tr_torrent * tor, FILE * fp, const char * destination, int argIsFallback ) 334 334 { 335 335 int pathlen = 0; 336 336 char path[MAX_PATH_LENGTH]; 337 const int haveDestination = tor->destination && *tor->destination;338 337 339 338 for( ;; ) { … … 348 347 path[pathlen] = '\0'; 349 348 350 if( pathlen && !haveDestination ) {351 t r_free( tor->destination );352 tor->destination = tr_strdup( path );353 }349 if( argIsFallback ) 350 tor->destination = tr_strdup( pathlen ? path : destination ); 351 else 352 tor->destination = tr_strdup( destination && *destination ? destination : path ); 354 353 355 354 return TR_OK; … … 526 525 static uint64_t 527 526 fastResumeLoadImpl ( tr_torrent * tor, 528 tr_bitfield * uncheckedPieces ) 527 tr_bitfield * uncheckedPieces, 528 const char * destination, 529 int argIsFallback ) 529 530 { 530 531 char path[MAX_PATH_LENGTH]; … … 630 631 case FR_ID_DESTINATION: 631 632 { 632 const int rret = load FallbackDestination( tor, file);633 const int rret = loadDestination( tor, file, destination, argIsFallback ); 633 634 634 635 if( rret && ( feof(file) || ferror(file) ) ) … … 773 774 uint64_t 774 775 tr_fastResumeLoad( tr_torrent * tor, 775 tr_bitfield * uncheckedPieces ) 776 { 777 const uint64_t ret = fastResumeLoadImpl( tor, uncheckedPieces ); 776 tr_bitfield * uncheckedPieces, 777 const char * destination, 778 int argIsFallback ) 779 { 780 const uint64_t ret = fastResumeLoadImpl( tor, uncheckedPieces, destination, argIsFallback ); 778 781 779 782 if( ! ( ret & TR_FR_PROGRESS ) ) 780 783 tr_bitfieldAddRange( uncheckedPieces, 0, tor->info.pieceCount ); 781 784 785 if( !tor->destination ) 786 tor->destination = tr_strdup( destination ); 787 782 788 return ret; 783 789 } -
branches/0.9x/libtransmission/fastresume.h
r3418 r3573 46 46 */ 47 47 uint64_t tr_fastResumeLoad( tr_torrent * tor, 48 struct tr_bitfield * uncheckedPieces ); 48 struct tr_bitfield * uncheckedPieces, 49 const char * destination, 50 int destinationIsFallback ); 49 51 50 52 #endif -
branches/0.9x/libtransmission/torrent.c
r3492 r3573 258 258 tr_torrent * tor, 259 259 const char * destination, 260 int destinationIsFallback, 260 261 int isPaused ) 261 262 { … … 267 268 268 269 tr_globalLock( h ); 269 270 tor->destination = tr_strdup( destination );271 270 272 271 tor->handle = h; … … 340 339 uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount ); 341 340 342 loaded = tr_fastResumeLoad( tor, uncheckedPieces );341 loaded = tr_fastResumeLoad( tor, uncheckedPieces, destination, destinationIsFallback ); 343 342 assert( tor->destination != NULL ); 344 343 … … 450 449 } 451 450 451 static tr_torrent * 452 tr_torrentInitImpl( tr_handle * h, 453 const char * path, 454 const char * destination, 455 int destinationIsFallback, 456 int isPaused, 457 int * error ) 458 { 459 int val; 460 int tmpError; 461 tr_torrent * tor = NULL; 462 463 if( !error ) 464 error = &tmpError; 465 466 if(( val = tr_torrentParse( h, path, destination, NULL ))) 467 *error = val; 468 else if(!(( tor = tr_new0( tr_torrent, 1 )))) 469 *error = TR_EOTHER; 470 else { 471 tr_metainfoParseFile( &tor->info, h->tag, path, TRUE ); 472 torrentRealInit( h, tor, destination, destinationIsFallback, isPaused ); 473 } 474 475 return tor; 476 } 477 452 478 tr_torrent * 453 479 tr_torrentInit( tr_handle * h, … … 457 483 int * error ) 458 484 { 459 int val; 460 int tmpError; 461 tr_torrent * tor = NULL; 462 463 if( !error ) 464 error = &tmpError; 465 466 if(( val = tr_torrentParse( h, path, destination, NULL ))) 467 *error = val; 468 else if(!(( tor = tr_new0( tr_torrent, 1 )))) 469 *error = TR_EOTHER; 470 else { 471 tr_metainfoParseFile( &tor->info, h->tag, path, TRUE ); 472 torrentRealInit( h, tor, destination, isPaused ); 473 } 474 475 return tor; 485 return tr_torrentInitImpl( h, path, destination, FALSE, isPaused, error ); 486 } 487 488 tr_torrent * 489 tr_torrentLoad( tr_handle * h, 490 const char * metainfoFilename, 491 const char * destination, 492 int isPaused, 493 int * error ) 494 { 495 return tr_torrentInitImpl( h, metainfoFilename, destination, TRUE, isPaused, error ); 476 496 } 477 497 … … 521 541 else { 522 542 tr_metainfoParseHash( &tor->info, h->tag, hashStr ); 523 torrentRealInit( h, tor, destination, isPaused );543 torrentRealInit( h, tor, destination, FALSE, isPaused ); 524 544 } 525 545 … … 574 594 else { 575 595 tr_metainfoParseData( &tor->info, h->tag, data, size, TRUE ); 576 torrentRealInit( h, tor, destination, isPaused );596 torrentRealInit( h, tor, destination, FALSE, isPaused ); 577 597 } 578 598 … … 1304 1324 return ret; 1305 1325 } 1306 -
branches/0.9x/libtransmission/transmission.c
r3492 r3573 328 328 tr_torrent ** 329 329 tr_loadTorrents ( tr_handle * h, 330 const char * destination,330 const char * fallbackDestination, 331 331 int isPaused, 332 332 int * setmeCount ) … … 351 351 char path[MAX_PATH_LENGTH]; 352 352 tr_buildPath( path, sizeof(path), torrentDir, d->d_name, NULL ); 353 tor = tr_torrent Init( h, path, destination, isPaused, NULL );353 tor = tr_torrentLoad( h, path, fallbackDestination, isPaused, NULL ); 354 354 if( tor != NULL ) { 355 355 tr_list_append( &list, tor ); -
branches/0.9x/libtransmission/transmission.h
r3534 r3573 308 308 */ 309 309 tr_torrent ** tr_loadTorrents ( tr_handle * h, 310 const char * destination,310 const char * fallback_destination, 311 311 int isPaused, 312 312 int * setmeCount ); … … 330 330 const char * metainfo_filename, 331 331 const char * destination, 332 int isPaused, 333 int * setme_error ); 334 335 /* This is a stupid hack to fix #415. Probably I should fold all 336 * these torrent constructors into a single function that takes 337 * a function object to hold all these esoteric arguments. */ 338 tr_torrent * tr_torrentLoad( tr_handle * handle, 339 const char * metainfo_filename, 340 const char * fallback_destination, 332 341 int isPaused, 333 342 int * setme_error );
Note: See TracChangeset
for help on using the changeset viewer.