Code cleanup

pull/4/head
Tatsuhiro Tsujikawa 2011-11-12 17:13:43 +09:00
parent f1f1b991f1
commit c4e66390ac
5 changed files with 10 additions and 5 deletions

View File

@ -386,7 +386,8 @@ bool CookieStorage::load(const std::string& filename, time_t now)
bool CookieStorage::saveNsFormat(const std::string& filename) bool CookieStorage::saveNsFormat(const std::string& filename)
{ {
std::string tempfilename = filename+"__temp"; std::string tempfilename = filename;
tempfilename += "__temp";
{ {
BufferedFile fp(tempfilename, BufferedFile::WRITE); BufferedFile fp(tempfilename, BufferedFile::WRITE);
if(!fp) { if(!fp) {

View File

@ -78,7 +78,8 @@ void DHTRoutingTableSerializer::setNodes
void DHTRoutingTableSerializer::serialize(const std::string& filename) void DHTRoutingTableSerializer::serialize(const std::string& filename)
{ {
A2_LOG_INFO(fmt("Saving DHT routing table to %s.", filename.c_str())); A2_LOG_INFO(fmt("Saving DHT routing table to %s.", filename.c_str()));
std::string filenameTemp = filename+"__temp"; std::string filenameTemp = filename;
filenameTemp += "__temp";
BufferedFile fp(filenameTemp, BufferedFile::WRITE); BufferedFile fp(filenameTemp, BufferedFile::WRITE);
if(!fp) { if(!fp) {
throw DL_ABORT_EX(fmt("Failed to save DHT routing table to %s.", throw DL_ABORT_EX(fmt("Failed to save DHT routing table to %s.",

View File

@ -111,7 +111,8 @@ bool DefaultBtProgressInfoFile::isTorrentDownload()
void DefaultBtProgressInfoFile::save() void DefaultBtProgressInfoFile::save()
{ {
A2_LOG_INFO(fmt(MSG_SAVING_SEGMENT_FILE, filename_.c_str())); A2_LOG_INFO(fmt(MSG_SAVING_SEGMENT_FILE, filename_.c_str()));
std::string filenameTemp = filename_+"__temp"; std::string filenameTemp = filename_;
filenameTemp += "__temp";
{ {
BufferedFile fp(filenameTemp, BufferedFile::WRITE); BufferedFile fp(filenameTemp, BufferedFile::WRITE);
if(!fp) { if(!fp) {

View File

@ -63,7 +63,8 @@ SessionSerializer::SessionSerializer
bool SessionSerializer::save(const std::string& filename) const bool SessionSerializer::save(const std::string& filename) const
{ {
std::string tempFilename = strconcat(filename, "__temp"); std::string tempFilename = filename;
tempFilename += "__temp";
{ {
BufferedFile fp(tempFilename, BufferedFile::WRITE); BufferedFile fp(tempFilename, BufferedFile::WRITE);
if(!fp) { if(!fp) {

View File

@ -1346,7 +1346,8 @@ bool saveAs
if(!overwrite && File(filename).exists()) { if(!overwrite && File(filename).exists()) {
return false; return false;
} }
std::string tempFilename = strconcat(filename, "__temp"); std::string tempFilename = filename;
tempFilename += "__temp";
{ {
BufferedFile fp(tempFilename, BufferedFile::WRITE); BufferedFile fp(tempFilename, BufferedFile::WRITE);
if(!fp) { if(!fp) {