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>
|
2008-06-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Fixed compile error on debian etch.
|
Fixed compile error on debian etch.
|
||||||
|
|
|
@ -133,47 +133,50 @@ std::string MultiDiskAdaptor::getTopDirPath() const
|
||||||
return storeDir+"/"+topDir;
|
return storeDir+"/"+topDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDiskAdaptor::mkdir() const
|
void MultiDiskAdaptor::mkdir(const std::string& topDirPath) const
|
||||||
{
|
{
|
||||||
for(FileEntries::const_iterator itr = fileEntries.begin();
|
for(FileEntries::const_iterator itr = fileEntries.begin();
|
||||||
itr != fileEntries.end(); itr++) {
|
itr != fileEntries.end(); itr++) {
|
||||||
(*itr)->setupDir(getTopDirPath());
|
(*itr)->setupDir(topDirPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDiskAdaptor::openFile()
|
void MultiDiskAdaptor::openFile()
|
||||||
{
|
{
|
||||||
mkdir();
|
const std::string topDirPath = getTopDirPath();
|
||||||
|
mkdir(topDirPath);
|
||||||
resetDiskWriterEntries();
|
resetDiskWriterEntries();
|
||||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||||
itr != diskWriterEntries.end(); itr++) {
|
itr != diskWriterEntries.end(); ++itr) {
|
||||||
(*itr)->openFile(getTopDirPath());
|
(*itr)->openFile(topDirPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDiskAdaptor::initAndOpenFile()
|
void MultiDiskAdaptor::initAndOpenFile()
|
||||||
{
|
{
|
||||||
mkdir();
|
const std::string topDirPath = getTopDirPath();
|
||||||
|
mkdir(topDirPath);
|
||||||
resetDiskWriterEntries();
|
resetDiskWriterEntries();
|
||||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||||
itr != diskWriterEntries.end(); itr++) {
|
itr != diskWriterEntries.end(); ++itr) {
|
||||||
(*itr)->initAndOpenFile(getTopDirPath());
|
(*itr)->initAndOpenFile(topDirPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDiskAdaptor::openExistingFile()
|
void MultiDiskAdaptor::openExistingFile()
|
||||||
{
|
{
|
||||||
|
const std::string topDirPath = getTopDirPath();
|
||||||
resetDiskWriterEntries();
|
resetDiskWriterEntries();
|
||||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||||
itr != diskWriterEntries.end(); itr++) {
|
itr != diskWriterEntries.end(); ++itr) {
|
||||||
(*itr)->openExistingFile(getTopDirPath());
|
(*itr)->openExistingFile(topDirPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDiskAdaptor::closeFile()
|
void MultiDiskAdaptor::closeFile()
|
||||||
{
|
{
|
||||||
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
|
||||||
itr != diskWriterEntries.end(); itr++) {
|
itr != diskWriterEntries.end(); ++itr) {
|
||||||
(*itr)->closeFile();
|
(*itr)->closeFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ private:
|
||||||
|
|
||||||
void resetDiskWriterEntries();
|
void resetDiskWriterEntries();
|
||||||
|
|
||||||
void mkdir() const;
|
void mkdir(const std::string& topDirPath) const;
|
||||||
|
|
||||||
std::string getTopDirPath() const;
|
std::string getTopDirPath() const;
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue