From 8f6691751aef55d5fdb96dace0e2aa1c58a5cbbe Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Fri, 17 Jul 2020 15:13:29 +0300 Subject: [PATCH] change return type --- Fb2File/Fb2File.cpp | 15 +++++++-------- Fb2File/Fb2File.h | 3 ++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Fb2File/Fb2File.cpp b/Fb2File/Fb2File.cpp index 9508b2d580..f83ee2ff3c 100644 --- a/Fb2File/Fb2File.cpp +++ b/Fb2File/Fb2File.cpp @@ -1204,7 +1204,7 @@ void CFb2File::SetTmpDirectory(const std::wstring& sFolder) // Проверяет, соответствует ли fb2 файл формату // sPath - путь к файлу fb2, sDirectory - директория, где формируется и создается docx -int CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory, CFb2Params* oParams) +HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory, CFb2Params* oParams) { if(m_internal->m_sTmpFolder == L"") SetTmpDirectory(sDirectory + L"/tmp"); @@ -1212,7 +1212,7 @@ int CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory, CF // Копирование шаблона if(!ExtractTemplate(sTmp)) - return FALSE; + return S_FALSE; // Начало файла NSStringUtils::CStringBuilder oDocument; @@ -1249,10 +1249,10 @@ int CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory, CF bNeedContents = oParams->bNeedContents; NSStringUtils::CStringBuilder oContents; if(!m_internal->readText(sPath, sMediaDirectory, oContents, oRels, oFootnotes)) - return FALSE; + return S_FALSE; if(!m_internal->m_oLightReader.MoveToStart()) - return FALSE; + return S_FALSE; int nDeath = m_internal->m_oLightReader.GetDepth(); while(m_internal->m_oLightReader.ReadNextSiblingNode(nDeath)) @@ -1382,13 +1382,12 @@ int CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory, CF { COfficeUtils oZip; HRESULT oRes = oZip.CompressFileOrDirectory(sTmp, sDirectory + L"/" + NSFile::GetFileName(sPath) + L".docx"); - if(oRes == S_FALSE) - return FALSE; + return oRes; } else { if(!NSDirectory::CopyDirectory(sTmp, sDirectory)) - return FALSE; + return S_FALSE; } - return TRUE; + return S_OK; } diff --git a/Fb2File/Fb2File.h b/Fb2File/Fb2File.h index 9fdd5320a2..cda589065d 100644 --- a/Fb2File/Fb2File.h +++ b/Fb2File/Fb2File.h @@ -2,6 +2,7 @@ #define _FB2FILE_FB2FILE_H #include +#include "../DesktopEditor/common/Types.h" #ifndef FB2FILE_USE_DYNAMIC_LIBRARY #define FB2FILE_DECL_EXPORT @@ -33,7 +34,7 @@ public: bool IsFb2File(const std::wstring& sFile); void SetTmpDirectory(const std::wstring& sFolder); - int Open(const std::wstring& sPath, const std::wstring& sDirectory, CFb2Params* oParams = NULL); + HRESULT Open(const std::wstring& sPath, const std::wstring& sDirectory, CFb2Params* oParams = NULL); }; #endif // _FB2FILE_FB2FILE_H