(qt) #5248 'fails to create torrent with multiple trackers': patch by rb07

This commit is contained in:
Jordan Lee 2013-01-24 15:34:45 +00:00
parent 644c647799
commit 1d63fc7d22
1 changed files with 5 additions and 6 deletions

View File

@ -113,8 +113,8 @@ MakeDialog :: makeTorrent( )
// get the tiers
int tier = 0;
QList<tr_tracker_info> trackers;
foreach( QString line, myTrackerEdit->toPlainText().split(QChar::fromAscii('\n')) ) {
QVector<tr_tracker_info> trackers;
foreach( QString line, myTrackerEdit->toPlainText().split("\n") ) {
line = line.trimmed( );
if( line.isEmpty( ) )
++tier;
@ -147,10 +147,9 @@ MakeDialog :: makeTorrent( )
myTimer.start( 100 );
// the file to create
const QString path = QString::fromLocal8Bit( myBuilder->top );
const QString torrentName = QFileInfo(path).completeBaseName() + QString::fromAscii(".torrent");
const QString path = QString::fromUtf8( myBuilder->top );
const QString torrentName = QFileInfo(path).completeBaseName() + ".torrent";
myTarget = QDir( myDestination ).filePath( torrentName );
std::cerr << qPrintable(myTarget) << std::endl;
// comment
QString comment;
@ -160,7 +159,7 @@ MakeDialog :: makeTorrent( )
// start making the torrent
tr_makeMetaInfo( myBuilder,
myTarget.toUtf8().constData(),
(trackers.isEmpty() ? 0 : &trackers.front()),
(trackers.isEmpty() ? NULL : trackers.data()),
trackers.size(),
(comment.isEmpty() ? NULL : comment.toUtf8().constData()),
myPrivateCheck->isChecked() );