Changeset 4275 for trunk/macosx/Controller.m
- Timestamp:
- Dec 22, 2007, 3:31:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r4266 r4275 740 740 location = [torrentPath stringByDeletingLastPathComponent]; 741 741 742 if (tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info) == TR_EDUPLICATE) 742 tr_ctor * ctor = tr_ctorNew(fLib); 743 tr_ctorSetMetainfoFromFile(ctor, [torrentPath UTF8String]); 744 if (tr_torrentParseFromCtor(fLib, ctor, &info) == TR_EDUPLICATE) 743 745 { 744 746 [self duplicateOpenAlert: [NSString stringWithUTF8String: info.name]]; … … 747 749 } 748 750 tr_metainfoFree(&info); 751 tr_ctorFree(ctor); 749 752 750 753 if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location deleteTorrentFile: deleteTorrent lib: fLib])) … … 807 810 int canAdd; 808 811 tr_info info; 812 tr_ctor * ctor; 809 813 while ([files count] > 0) 810 814 { 811 815 torrentPath = [[files objectAtIndex: 0] retain]; 812 canAdd = tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info); 816 817 ctor = tr_ctorNew(fLib); 818 tr_ctorSetMetainfoFromFile(ctor, [torrentPath UTF8String]); 819 canAdd = tr_torrentParseFromCtor(fLib, ctor, &info); 820 tr_ctorFree(ctor); 821 813 822 if (canAdd == TR_OK) 814 823 break; … … 2322 2331 NSEnumerator * enumerator = [newNames objectEnumerator]; 2323 2332 int canAdd, count; 2333 tr_ctor * ctor; 2324 2334 while ((file = [enumerator nextObject])) 2325 2335 { 2326 canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL); 2336 tr_ctor * ctor = tr_ctorNew(fLib); 2337 tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]); 2338 canAdd = tr_torrentParseFromCtor(fLib, ctor, NULL); 2339 tr_ctorFree(ctor); 2340 2327 2341 if (canAdd == TR_OK) 2328 2342 { … … 2476 2490 BOOL torrent = NO; 2477 2491 int canAdd; 2492 tr_ctor * ctor; 2478 2493 while ((file = [enumerator nextObject])) 2479 2494 { 2480 2495 if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) 2481 2496 { 2482 switch (canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL)) 2497 ctor = tr_ctorNew(fLib); 2498 tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]); 2499 switch (tr_torrentParseFromCtor(fLib, ctor, NULL)) 2483 2500 { 2484 2501 case TR_OK: … … 2492 2509 torrent = YES; 2493 2510 } 2511 tr_ctorFree(ctor); 2494 2512 } 2495 2513 } … … 2539 2557 NSEnumerator * enumerator = [files objectEnumerator]; 2540 2558 NSString * file; 2559 tr_ctor * ctor; 2541 2560 while ((file = [enumerator nextObject])) 2542 2561 { 2543 2562 if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) 2544 2563 { 2545 switch(tr_torrentParse(fLib, [file UTF8String], NULL, NULL)) 2564 ctor = tr_ctorNew(fLib); 2565 tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]); 2566 switch (tr_torrentParseFromCtor(fLib, ctor, NULL)) 2546 2567 { 2547 2568 case TR_OK: … … 2553 2574 torrent = YES; 2554 2575 } 2576 tr_ctorFree(ctor); 2555 2577 } 2556 2578 }
Note: See TracChangeset
for help on using the changeset viewer.