fix pad file bug in create_torrent and amend docs about pad files

This commit is contained in:
Arvid Norberg 2011-11-25 09:45:28 +00:00
parent 38889d4bda
commit 6aba061cb8
2 changed files with 4 additions and 2 deletions

View File

@ -319,7 +319,8 @@ piece_size will be calculated such that the torrent file is roughly 40 kB.
If a ``pad_size_limit`` is specified (other than -1), any file larger than
the specified number of bytes will be preceeded by a pad file to align it
with the start of a piece. The pad_file_limit is ignored unless the
``optimize`` flag is passed.
``optimize`` flag is passed. Typically it doesn't make sense to set this
any lower than 4kiB.
The overload that takes a ``torrent_info`` object will make a verbatim
copy of its info dictionary (to preserve the info-hash). The copy of

View File

@ -540,7 +540,8 @@ namespace libtorrent
i->offset = off;
char name[30];
snprintf(name, sizeof(name), ".____padding_file/%d", padding_file);
i->set_name(name);
std::string path = combine_path(m_name, name);
i->set_name(path.c_str());
i->pad_file = true;
off += pad_size;
++padding_file;