mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Replace single-character string with character literal
Also remove unnecessary dynamic allocation.
This commit is contained in:
committed by
sledgehammer999
parent
d088ab6f43
commit
9e99a0d3f5
@@ -465,7 +465,7 @@ void SyncController::torrentPeersAction()
|
||||
peer[KEY_PEER_RELEVANCE] = pi.relevance();
|
||||
peer[KEY_PEER_FILES] = torrent->info().filesForPiece(pi.downloadingPieceIndex()).join(QLatin1String("\n"));
|
||||
|
||||
peers[pi.address().ip.toString() + ":" + QString::number(pi.address().port)] = peer;
|
||||
peers[pi.address().ip.toString() + ':' + QString::number(pi.address().port)] = peer;
|
||||
}
|
||||
|
||||
data["peers"] = peers;
|
||||
|
||||
@@ -734,16 +734,16 @@ void TorrentsController::setLocationAction()
|
||||
{
|
||||
checkParams({"hashes", "location"});
|
||||
|
||||
const QStringList hashes {params()["hashes"].split("|")};
|
||||
const QStringList hashes {params()["hashes"].split('|')};
|
||||
const QString newLocation {params()["location"].trimmed()};
|
||||
|
||||
if (newLocation.isEmpty())
|
||||
throw APIError(APIErrorType::BadParams, tr("Save path is empty"));
|
||||
|
||||
|
||||
// try to create the location if it does not exist
|
||||
if (!QDir(newLocation).mkpath("."))
|
||||
throw APIError(APIErrorType::Conflict, tr("Cannot make save path"));
|
||||
|
||||
|
||||
// check permissions
|
||||
if (!QFileInfo(newLocation).isWritable())
|
||||
throw APIError(APIErrorType::AccessDenied, tr("Cannot write to directory"));
|
||||
|
||||
Reference in New Issue
Block a user