This commit is contained in:
Elena Subbotina
2025-10-24 10:23:24 +03:00
parent 289a77a978
commit ab052c7c59
3 changed files with 23 additions and 6 deletions

View File

@ -33,6 +33,7 @@ HEADERS += \
./../DesktopEditor/graphics/TemporaryCS.h
SOURCES += \
../OdfFile/Common/logging.cpp \
./../DesktopEditor/graphics/TemporaryCS.cpp
# THREAD

View File

@ -33,6 +33,8 @@
#include "ZipUtilsCP.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OdfFile/Common/logging.h"
#include <sstream>
COfficeUtils::COfficeUtils(OnProgressCallback* fCallback)
{
@ -48,10 +50,12 @@ HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& _zipFile, const std
std::wstring zipFile = _zipFile;
std::wstring unzipDir = _unzipDir;
#endif
_CP_LOG << L"start unzip" << std::endl;
if( ZLibZipUtils::UnzipToDir( zipFile.c_str(), unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
{
return S_OK;
_CP_LOG << L"end unzip" << std::endl;
return S_OK;
}
else
{
@ -65,11 +69,13 @@ HRESULT COfficeUtils::ExtractToDirectory(BYTE* data, size_t len, const std::wstr
std::wstring unzipDir = CorrectPathW(_unzipDir);
#else
std::wstring unzipDir = _unzipDir;
#endif
#endif
_CP_LOG << L"start unzip" << std::endl;
if( ZLibZipUtils::UnzipToDir( data, len, unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
if( ZLibZipUtils::UnzipToDir( data, len, unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
{
return S_OK;
_CP_LOG << L"end unzip" << std::endl;
return S_OK;
}
else
{
@ -87,13 +93,15 @@ HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const s
std::wstring name = _name;
std::wstring outputFile = _outputFile;
#endif
_CP_LOG << L"start zip" << std::endl;
HRESULT result = S_FALSE;
if(NSDirectory::Exists(name))
{
if ( ZLibZipUtils::ZipDir( name.c_str(), outputFile.c_str(), m_fCallback, bSorted, method, level, bDateTime ) == 0 )
{
result = S_OK;
_CP_LOG << L"end zip" << std::endl;
result = S_OK;
}
else
{
@ -104,7 +112,8 @@ HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const s
{
if ( ZLibZipUtils::ZipFile( name.c_str(), outputFile.c_str(), method, level, bDateTime ) == 0 )
{
result = S_OK;
_CP_LOG << L"end zip" << std::endl;
result = S_OK;
}
else
{

View File

@ -59,6 +59,7 @@
#include "../../DesktopEditor/doctrenderer/docbuilder.h"
#include "../../MsBinaryFile/Common/Vba/VbaReader.h"
#include "../../OdfFile/Common/logging.h"
namespace NExtractTools
{
@ -1577,6 +1578,7 @@ namespace NExtractTools
_UINT32 fromInputParams(InputParams& oInputParams)
{
_CP_LOG << L"start/detect conversion" << std::endl;
TConversionDirection conversion = oInputParams.getConversionDirection();
std::wstring sFileFrom = oInputParams.m_sFileFrom ? *oInputParams.m_sFileFrom : L"";
@ -1647,11 +1649,13 @@ namespace NExtractTools
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
return AVS_FILEUTILS_ERROR_CONVERT_LIMITS;
}
_CP_LOG << L"doct initialize" << std::endl;
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
NSDoctRenderer::CDocBuilder::Initialize();
#endif
_CP_LOG << L"start conversion" << std::endl;
_UINT32 result = 0;
switch (conversion)
{
@ -2310,10 +2314,13 @@ namespace NExtractTools
if (!sGlobalTempDir.empty())
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
_CP_LOG << L"end conversion and start dispose doctrenderer" << std::endl;
// clean up v8
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
NSDoctRenderer::CDocBuilder::Dispose();
#endif
_CP_LOG << L"finish" << std::endl;
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
{
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;