mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
for bug #61780
This commit is contained in:
@ -68,6 +68,9 @@ public:
|
|||||||
inline void close() override {
|
inline void close() override {
|
||||||
std::fstream::close();
|
std::fstream::close();
|
||||||
}
|
}
|
||||||
|
inline bool isError() override {
|
||||||
|
return (std::fstream::bad() || std::fstream::fail());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,7 @@ namespace CFCPP
|
|||||||
virtual void write (const char* buffer, _INT64 len) = 0;
|
virtual void write (const char* buffer, _INT64 len) = 0;
|
||||||
virtual void flush() = 0;
|
virtual void flush() = 0;
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
|
virtual bool isError() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Stream = std::shared_ptr<IStream>;
|
using Stream = std::shared_ptr<IStream>;
|
||||||
|
|||||||
@ -123,6 +123,14 @@ void StreamView::close()
|
|||||||
if (std::dynamic_pointer_cast<std::iostream>(stream) != nullptr)
|
if (std::dynamic_pointer_cast<std::iostream>(stream) != nullptr)
|
||||||
stream->close();
|
stream->close();
|
||||||
}
|
}
|
||||||
|
bool StreamView::isError()
|
||||||
|
{
|
||||||
|
if (std::dynamic_pointer_cast<std::iostream>(stream) == nullptr) return true;
|
||||||
|
if ((std::dynamic_pointer_cast<std::iostream>(stream))->bad()) return true;
|
||||||
|
if ((std::dynamic_pointer_cast<std::iostream>(stream))->fail()) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_INT64 StreamView::read(char *buffer, _INT64 len)
|
_INT64 StreamView::read(char *buffer, _INT64 len)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,14 +46,13 @@ public:
|
|||||||
StreamView(const SVector<Sector> §orChain, _INT32 sectorSize, _INT64 length,
|
StreamView(const SVector<Sector> §orChain, _INT32 sectorSize, _INT64 length,
|
||||||
SList<Sector> &availableSectors, Stream stream, bool isFatStream = false);
|
SList<Sector> &availableSectors, Stream stream, bool isFatStream = false);
|
||||||
|
|
||||||
|
|
||||||
_INT64 tell() override;
|
_INT64 tell() override;
|
||||||
_INT64 seek(_INT64 offset, std::ios_base::seekdir mode = std::ios::beg) override;
|
_INT64 seek(_INT64 offset, std::ios_base::seekdir mode = std::ios::beg) override;
|
||||||
_INT64 read(char *buffer, _INT64 count) override;
|
_INT64 read(char *buffer, _INT64 count) override;
|
||||||
void write(const char *buffer, _INT64 count) override;
|
void write(const char *buffer, _INT64 count) override;
|
||||||
void flush() override {}
|
void flush() override {}
|
||||||
void close() override;
|
void close() override;
|
||||||
|
bool isError() override;
|
||||||
|
|
||||||
_INT64 getPosition() const;
|
_INT64 getPosition() const;
|
||||||
void SetLength(_INT64 value);
|
void SetLength(_INT64 value);
|
||||||
|
|||||||
@ -942,9 +942,10 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
bool result = true;
|
||||||
if (bLargeFile)
|
if (bLargeFile)
|
||||||
{
|
{
|
||||||
pStorageNew->Save(file_name_out);
|
result = pStorageNew->Save(file_name_out);
|
||||||
pStorageNew->Close();
|
pStorageNew->Close();
|
||||||
delete pStorageNew;
|
delete pStorageNew;
|
||||||
}
|
}
|
||||||
@ -974,7 +975,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
|||||||
// }
|
// }
|
||||||
////test back---------------------------------------------------------------------------------test back
|
////test back---------------------------------------------------------------------------------test back
|
||||||
|
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const std::wstring &file_name_out, const std::wstring &password, bool & bDataIntegrity)
|
bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const std::wstring &file_name_out, const std::wstring &password, bool & bDataIntegrity)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3049,11 +3049,12 @@ namespace NExtractTools
|
|||||||
NSDirectory::CreateDirectory(sTempUnpackedOox);
|
NSDirectory::CreateDirectory(sTempUnpackedOox);
|
||||||
|
|
||||||
_UINT32 nRes = odf_flat2oox_dir(sFrom, sTempUnpackedOox, sTemp, params);
|
_UINT32 nRes = odf_flat2oox_dir(sFrom, sTempUnpackedOox, sTemp, params);
|
||||||
if(SUCCEEDED_X2T(nRes))
|
|
||||||
{
|
if (SUCCEEDED_X2T(nRes))
|
||||||
COfficeUtils oCOfficeUtils(NULL);
|
{
|
||||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedOox, sTo, true)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
nRes = dir2zipMscrypt(sTempUnpackedOox, sTo, sTemp, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nRes;
|
return nRes;
|
||||||
}
|
}
|
||||||
_UINT32 odf_flat2oox_dir(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
_UINT32 odf_flat2oox_dir(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||||
|
|||||||
Reference in New Issue
Block a user