This commit is contained in:
Elena.Subbotina
2023-02-28 19:37:01 +03:00
parent 5d0f0875be
commit a7c70687c9
4 changed files with 7 additions and 10 deletions

View File

@ -47,7 +47,7 @@ using namespace CFCPP;
CompoundFile::CompoundFile() : _impl(new CFCPP::CompoundFile_impl())
{
}
CompoundFile::CompoundFile(const std::wstring &fileName, CFSUpdateMode updateMode, CFSConfiguration configParameters) :
CompoundFile::CompoundFile(const std::wstring &fileName, CFSUpdateMode updateMode, int configParameters) :
_impl(new CFCPP::CompoundFile_impl(fileName, updateMode, configParameters))
{
}
@ -115,7 +115,7 @@ CompoundFile_impl::CompoundFile_impl() :
CompoundFile_impl(CFSVersion::Ver_3, CFSConfiguration::Default)
{}
CompoundFile_impl::CompoundFile_impl(const std::wstring &fileName, CFSUpdateMode updateMode, CFSConfiguration configParameters)
CompoundFile_impl::CompoundFile_impl(const std::wstring &fileName, CFSUpdateMode updateMode, int configParameters)
{
configuration = configParameters;
isValidationExceptionEnabled = !(configParameters & CFSConfiguration::NoValidationException);
@ -1796,7 +1796,6 @@ _INT32 CompoundFile_impl::GetSectorSize()
{
return 2 << (header->sectorShift - 1);
}
void CompoundFile_impl::Dispose(bool disposing)
{
try

View File

@ -56,7 +56,7 @@ class CompoundFile_impl;
class CompoundFile
{
public:
CompoundFile(const std::wstring &fileName, CFSUpdateMode updateMode, CFSConfiguration configParameters = Default);
CompoundFile(const std::wstring &fileName, CFSUpdateMode updateMode, int configParameters = Default);
CompoundFile(CFSVersion cfsVersion, CFSConfiguration configFlags);
CompoundFile(const std::wstring &fileName);
CompoundFile(Stream stream);

View File

@ -49,7 +49,7 @@ class DirectoryEntry;
class CompoundFile_impl
{
public:
CompoundFile_impl(const std::wstring &fileName, CFSUpdateMode updateMode, CFSConfiguration configParameters = Default);
CompoundFile_impl(const std::wstring &fileName, CFSUpdateMode updateMode, int configParameters = Default);
CompoundFile_impl(CFSVersion cfsVersion, CFSConfiguration configFlags);
CompoundFile_impl(const std::wstring &fileName);
CompoundFile_impl(Stream stream);
@ -62,7 +62,6 @@ public:
void Save(std::wstring wFileName);
void Save(Stream stream);
void Commit(bool releaseMemory = false);
bool HasSourceStream() const;
bool ValidationExceptionEnabled() const;
@ -140,7 +139,7 @@ private:
CFSVersion getVersion() const;
public:
CFSConfiguration configuration = Default;
int configuration = Default;
std::unique_ptr<Header> header;
Stream sourceStream;

View File

@ -1145,9 +1145,8 @@ bool ECMACryptFile::WriteAdditional(const std::wstring &file_name, const std::ws
{
try
{
CFCPP::CompoundFile *pStorage = new CFCPP::CompoundFile(file_name, CFCPP::Update);
CFCPP::CompoundFile *pStorage = new CFCPP::CompoundFile(file_name, CFCPP::Update, (CFCPP::SectorRecycle | CFCPP::NoValidationException | CFCPP::EraseFreeSectors));
if (!pStorage)return false;
std::shared_ptr<CFCPP::CFStream> pAddit = pStorage->RootStorage()->GetStream(addit_name);
if (pAddit)
@ -1157,7 +1156,7 @@ bool ECMACryptFile::WriteAdditional(const std::wstring &file_name, const std::ws
pAddit = pStorage->RootStorage()->AddStream(addit_name);
pAddit->Write(addit_info.c_str(), 0, addit_info.size());
pStorage->Commit(true);
pStorage->Commit();
//todooo_2 flush
pStorage->Save(file_name + L"~");
pStorage->Close();