|
From: Federico A. L. <fl...@ma...> - 2003-07-09 08:47:01
|
These are the most relevant corrections up to now.
//////////////////////////////////////
[7 july 2003]
- add: PAQSolidFileManipulator::setEndOfFile to change file size (trunc
useless data to do not waste space)
This method is not suitable for read only. In addition, if you want to use
something like this in write mode (i.e. for the PAQ Explorer), you should use
the defrag.
//////////////////////////////////////
//////////////////////////////////////
In paqmanager.cpp
PAQSolidFile * PAQManager::openPAQFile(std::string filename)
{
PAQSolidFile *newSolidFile;
std::string tempFilename;
register UInt32 vectorSize = this.solidFileList.size();
// is more readable than your code
for (Index i = 0; i < vectorSize; i++)
{
if (filename.compare (this.solidFileList[i]->getFilename()) ==
0)
{
// the second parameter must be incremented! (you have
modified
// it on the closePAQFile, but not here)
this->solidFileList[i].second++;
return (PAQSolidFile*)(this.solidFileList[i]);
};
};
// creates new file and add to internal list
newSolidFile = new PAQSolidFile(filename);
this->solidFileList.push_back( InternalSolidFileDescriptor
(newSolidFile,1) );
return newSolidFile;
};
Anyway, the pair object is not the best solution because it uses public
attributes, something we forbid explicitly. Because public attributes can be
changed without any control from the holder class, posibly introducing serious
defects on the software.
//////////////////////////////////////
Note 1: when you begin a new block of code, the "{" must be on the next line.
For example:
for (;;)
{
};
instead of
for (;;){
};
note 2: another issue is the naming of the enum. It should be "enum
FILEACCESS" instead of "enum PAQFILEACCESS"
Greetings
Red Knight and Papo
|