mirror of
https://github.com/transmission/transmission
synced 2025-02-04 05:22:40 +00:00
eliminate redundant code
This commit is contained in:
parent
09442cd88b
commit
5f82580e30
1 changed files with 3 additions and 21 deletions
|
@ -1542,27 +1542,6 @@ int trashDataFile(const char * filename)
|
||||||
|
|
||||||
if (torrentStruct)
|
if (torrentStruct)
|
||||||
fHandle = torrentStruct;
|
fHandle = torrentStruct;
|
||||||
else if (magnetAddress)
|
|
||||||
{
|
|
||||||
tr_ctor * ctor = tr_ctorNew(lib);
|
|
||||||
|
|
||||||
tr_ctorSetPaused(ctor, TR_FORCE, YES);
|
|
||||||
if (downloadFolder)
|
|
||||||
tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder UTF8String]);
|
|
||||||
|
|
||||||
const tr_parse_result result = tr_ctorSetMagnet(ctor, [magnetAddress UTF8String]);
|
|
||||||
|
|
||||||
if (result == TR_PARSE_OK)
|
|
||||||
fHandle = tr_torrentNew(ctor, NULL);
|
|
||||||
|
|
||||||
tr_ctorFree(ctor);
|
|
||||||
|
|
||||||
if (!fHandle)
|
|
||||||
{
|
|
||||||
[self release];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//set libtransmission settings for initialization
|
//set libtransmission settings for initialization
|
||||||
|
@ -1578,6 +1557,9 @@ int trashDataFile(const char * filename)
|
||||||
if (path)
|
if (path)
|
||||||
result = tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
|
result = tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
|
||||||
|
|
||||||
|
if (result != TR_PARSE_OK && magnetAddress)
|
||||||
|
result = tr_ctorSetMagnet(ctor, [magnetAddress UTF8String]);
|
||||||
|
|
||||||
//backup - shouldn't be needed after upgrade to 1.70
|
//backup - shouldn't be needed after upgrade to 1.70
|
||||||
if (result != TR_PARSE_OK && hashString)
|
if (result != TR_PARSE_OK && hashString)
|
||||||
result = tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
|
result = tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
|
||||||
|
|
Loading…
Reference in a new issue