Pass std::string directly

This commit is contained in:
Chocobo1 2015-07-11 15:39:00 +08:00
parent e8a02b85b8
commit b743ef44e9
1 changed files with 6 additions and 6 deletions

View File

@ -633,7 +633,7 @@ void load_torrent(libtorrent::sha1_hash const& ih, std::vector<char>& buf, libto
ec.assign(boost::system::errc::no_such_file_or_directory, boost::system::generic_category()); ec.assign(boost::system::errc::no_such_file_or_directory, boost::system::generic_category());
return; return;
} }
load_file(i->second.c_str(), buf, ec); load_file(i->second, buf, ec);
} }
// if non-empty, a peer that will be added to all torrents // if non-empty, a peer that will be added to all torrents
@ -710,7 +710,7 @@ void add_torrent(libtorrent::session& ses
, leaf_path(torrent) + ".resume")); , leaf_path(torrent) + ".resume"));
error_code ec; error_code ec;
load_file(filename.c_str(), p.resume_data, ec); load_file(filename, p.resume_data, ec);
p.url = path_to_url(torrent); p.url = path_to_url(torrent);
p.save_path = save_path; p.save_path = save_path;
@ -745,7 +745,7 @@ std::vector<std::string> list_dir(std::string path
std::string p = fd.cFileName; std::string p = fd.cFileName;
if (filter_fun(p)) if (filter_fun(p))
ret.push_back(p); ret.push_back(p);
} while (FindNextFileA(handle, &fd)); } while (FindNextFileA(handle, &fd));
FindClose(handle); FindClose(handle);
#else #else
@ -846,7 +846,7 @@ void scan_dir(std::string const& dir_path
files.erase(i++); files.erase(i++);
continue; continue;
} }
h.auto_managed(false); h.auto_managed(false);
h.pause(); h.pause();
// the alert handler for save_resume_data_alert // the alert handler for save_resume_data_alert
@ -1638,7 +1638,7 @@ int main(int argc, char* argv[])
std::string filename = path_append(save_path, path_append(".resume" std::string filename = path_append(save_path, path_append(".resume"
, to_hex(tmp.info_hash.to_string()) + ".resume")); , to_hex(tmp.info_hash.to_string()) + ".resume"));
load_file(filename.c_str(), p.resume_data, ec); load_file(filename, p.resume_data, ec);
} }
printf("adding URL: %s\n", i->c_str()); printf("adding URL: %s\n", i->c_str());
@ -1779,7 +1779,7 @@ int main(int argc, char* argv[])
std::string filename = path_append(save_path, path_append(".resume" std::string filename = path_append(save_path, path_append(".resume"
, to_hex(tmp.info_hash.to_string()) + ".resume")); , to_hex(tmp.info_hash.to_string()) + ".resume"));
load_file(filename.c_str(), p.resume_data, ec); load_file(filename, p.resume_data, ec);
} }
printf("adding URL: %s\n", url); printf("adding URL: %s\n", url);