Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1366 closed Bug (fixed)

tr_torrentParse does not respect tr_ctorSetSave in field tr_info->torrent

Reported by: spry Owned by: charles
Priority: Normal Milestone: 1.40
Component: libtransmission Version: 1.34
Severity: Minor Keywords:


TorrentInformation^ Session::GetTorrentInformationFromFile(String^ InFileName)
    tr_ctor* pCtor = tr_ctorNew(m_SessionData);
    tr_ctorSetSave(pCtor, FALSE);
    tr_ctorSetDeleteSource(pCtor, FALSE);
    IntPtr IntPtr_value = Marshal::StringToHGlobalAnsi(InFileName);
    LPCSTR Str_value = (LPCSTR)IntPtr_value.ToPointer();

    tr_ctorSetMetainfoFromFile(pCtor, Str_value);

    tr_info *pInfo = tr_new0(tr_info, 1);
    tr_torrentParse(m_SessionData, pCtor, pInfo);
    return gcnew TorrentInformation(IntPtr(pInfo), true);

Change History (4)

comment:1 Changed 13 years ago by spry

At the end pInfo->torrent will have path like "../Torrents/[torrent_name][some_hash].torrent", but not the original file name, but since I'm telling not to save to 'Torrents/' folder via tr_ctorSetSave, it should contain original filename, seems to me..

comment:2 Changed 13 years ago by charles

  • Component changed from Transmission to libtransmission
  • Keywords libtransmission tr_torrentParse removed
  • Milestone changed from None Set to 1.40
  • Resolution set to fixed
  • Status changed from new to closed

Transmission never remembers the source filename like that -- it's only used for the torrent constructor.

I agree that the pinfo->torrent field doesn't make sense there. I've been trying to make that field private for a long time anyway but BentMyWookie? still needs it for various reasons in the Mac OS X client. I've added an annotation to reflect that in r6933.

tr_ctor{Get,Set}Save() is intended to be only package-visible s.t. we don't re-save existing torrents when we load them from the Torrents/ directory on startup. I've moved these two functions into a private header (torrent.h) in r6932.

comment:3 Changed 13 years ago by charles

As an aside, I'm enjoying this kind of feedback. It's nice to get a view of libtransmission's API quirks from a fresh pair of eyes. :)

comment:4 Changed 13 years ago by spry

:))) Always glad to help :) Also, since I can not access IRC from work, could you take a look to current win32 trunk? I've corrected some more issues in win32 part of lib

Note: See TracTickets for help on using tickets.