mirror of https://github.com/aria2/aria2
2008-06-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed repeated call of getTopDirPath(). Instead, call it once and cache the result. * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h (mkdir, openFile, initAndOpenFile, openExistingFile)pull/1/head
parent
1f084fc5dc
commit
0c22b9faf0
|
@ -1,3 +1,11 @@
|
|||
2008-06-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Removed repeated call of getTopDirPath(). Instead, call it once and
|
||||
cache the result.
|
||||
* src/MultiDiskAdaptor.cc
|
||||
* src/MultiDiskAdaptor.h
|
||||
(mkdir, openFile, initAndOpenFile, openExistingFile)
|
||||
|
||||
2008-06-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed compile error on debian etch.
|
||||
|
|
|
@ -133,47 +133,50 @@ std::string MultiDiskAdaptor::getTopDirPath() const
|
|||
return storeDir+"/"+topDir;
|
||||
}
|
||||
|
||||
void MultiDiskAdaptor::mkdir() const
|
||||
void MultiDiskAdaptor::mkdir(const std::string& topDirPath) const
|
||||
{
|
||||
for(FileEntries::const_iterator itr = fileEntries.begin();
|
||||
itr != fileEntries.end(); itr++) {
|
||||
(*itr)->setupDir(getTopDirPath());
|
||||
(*itr)->setupDir(topDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiDiskAdaptor::openFile()
|
||||
{
|
||||
mkdir();
|
||||
const std::string topDirPath = getTopDirPath();
|
||||
mkdir(topDirPath);
|
||||
resetDiskWriterEntries();
|
||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||
itr != diskWriterEntries.end(); itr++) {
|
||||
(*itr)->openFile(getTopDirPath());
|
||||
itr != diskWriterEntries.end(); ++itr) {
|
||||
(*itr)->openFile(topDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiDiskAdaptor::initAndOpenFile()
|
||||
{
|
||||
mkdir();
|
||||
const std::string topDirPath = getTopDirPath();
|
||||
mkdir(topDirPath);
|
||||
resetDiskWriterEntries();
|
||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||
itr != diskWriterEntries.end(); itr++) {
|
||||
(*itr)->initAndOpenFile(getTopDirPath());
|
||||
itr != diskWriterEntries.end(); ++itr) {
|
||||
(*itr)->initAndOpenFile(topDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiDiskAdaptor::openExistingFile()
|
||||
{
|
||||
const std::string topDirPath = getTopDirPath();
|
||||
resetDiskWriterEntries();
|
||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||
itr != diskWriterEntries.end(); itr++) {
|
||||
(*itr)->openExistingFile(getTopDirPath());
|
||||
itr != diskWriterEntries.end(); ++itr) {
|
||||
(*itr)->openExistingFile(topDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiDiskAdaptor::closeFile()
|
||||
{
|
||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||
itr != diskWriterEntries.end(); itr++) {
|
||||
itr != diskWriterEntries.end(); ++itr) {
|
||||
(*itr)->closeFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ private:
|
|||
|
||||
void resetDiskWriterEntries();
|
||||
|
||||
void mkdir() const;
|
||||
void mkdir(const std::string& topDirPath) const;
|
||||
|
||||
std::string getTopDirPath() const;
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue