Small code cleanup

This commit is contained in:
Emil Axelsson
2017-12-19 11:17:56 +01:00
parent ab52504ec8
commit f7dc598f60
4 changed files with 42 additions and 29 deletions
@@ -91,7 +91,9 @@ documentation::Documentation TorrentSynchronization::Documentation() {
std::string TorrentSynchronization::uniformResourceName() const {
size_t begin = _magnetLink.find("=urn") + 1;
size_t end = _magnetLink.find('&', begin);
std::string xs = _magnetLink.substr(begin, end == std::string::npos ? end : (end - begin));
std::string xs = _magnetLink.substr(begin, end == std::string::npos ?
end : (end - begin));
std::transform(xs.begin(), xs.end(), xs.begin(), [](char x) {
if (x == ':') return '.';
return x;
@@ -150,8 +152,8 @@ void TorrentSynchronization::cancel() {
}
void TorrentSynchronization::clear() {
// Todo: remove directory!
cancel();
// TODO: Remove all files from directory.
}
bool TorrentSynchronization::hasSyncFile() {