mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Refactoring
This commit is contained in:
@ -64,6 +64,3 @@ HEADERS += \
|
||||
$$PWD/src/zlib-1.2.11/contrib/minizip/zip.h \
|
||||
$$PWD/src/zlib-1.2.11/contrib/minizip/ioapibuf.h
|
||||
|
||||
core_ios {
|
||||
OBJECTIVE_SOURCES += $$PWD/src/ZipUtilsCP_ios.mm
|
||||
}
|
||||
|
||||
@ -123,19 +123,23 @@ namespace ZLibZipUtils
|
||||
return m_unzFile;
|
||||
}
|
||||
|
||||
#ifndef _IOS
|
||||
zipFile zipOpenHelp(const wchar_t* filename)
|
||||
{
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
zlib_filefunc64_def ffunc;
|
||||
fill_win32_filefunc64W(&ffunc);
|
||||
zipFile zf = zipOpen2_64(filename, APPEND_STATUS_CREATE, NULL, &ffunc);
|
||||
#else
|
||||
#ifdef _IOS
|
||||
std::string filePath = NSFile::IOS::GetFileSystemRepresentation(filename);
|
||||
zipFile zf = filePath.empty() ? NULL : zipOpen(filePath.c_str(), APPEND_STATUS_CREATE);
|
||||
#else
|
||||
BYTE* pUtf8 = NULL;
|
||||
LONG lLen = 0;
|
||||
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(filename, wcslen(filename), pUtf8, lLen, false);
|
||||
zipFile zf = zipOpen( (char*)pUtf8, APPEND_STATUS_CREATE );
|
||||
delete [] pUtf8;
|
||||
#endif
|
||||
#endif
|
||||
return zf;
|
||||
}
|
||||
@ -145,16 +149,21 @@ namespace ZLibZipUtils
|
||||
zlib_filefunc64_def ffunc;
|
||||
fill_win32_filefunc64W(&ffunc);
|
||||
unzFile uf = unzOpen2_64(filename, &ffunc);
|
||||
#else
|
||||
#ifdef _IOS
|
||||
std::string filePath = NSFile::IOS::GetFileSystemRepresentation(filename);
|
||||
unzFile zf = filePath.empty() ? NULL : unzOpen(filePath.c_str());
|
||||
#else
|
||||
BYTE* pUtf8 = NULL;
|
||||
LONG lLen = 0;
|
||||
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(filename, wcslen(filename), pUtf8, lLen, false);
|
||||
unzFile uf = unzOpen( (char*)pUtf8 );
|
||||
delete [] pUtf8;
|
||||
#endif
|
||||
#endif
|
||||
return uf;
|
||||
}
|
||||
#endif
|
||||
|
||||
static std::wstring ascii_to_unicode(const char *src)
|
||||
{
|
||||
// TODO: check codepage of system (for "bad" archive)
|
||||
|
||||
@ -57,7 +57,6 @@ using namespace std;
|
||||
|
||||
namespace ZLibZipUtils
|
||||
{
|
||||
|
||||
zipFile zipOpenHelp(const wchar_t* filename);
|
||||
unzFile unzOpenHelp(const wchar_t* filename);
|
||||
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "ZipUtilsCP.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
namespace ZLibZipUtils
|
||||
{
|
||||
zipFile zipOpenHelp(const wchar_t* filename)
|
||||
{
|
||||
NSString *path =[[NSString alloc] initWithBytes:filename
|
||||
length:wcslen(filename)*sizeof(*filename)
|
||||
encoding:NSUTF32LittleEndianStringEncoding];
|
||||
if (path && path.length > 0) {
|
||||
return zipOpen( (const char*)[path fileSystemRepresentation], APPEND_STATUS_CREATE );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
unzFile unzOpenHelp(const wchar_t* filename)
|
||||
{
|
||||
NSString *path =[[NSString alloc] initWithBytes:filename
|
||||
length:wcslen(filename)*sizeof(*filename)
|
||||
encoding:NSUTF32LittleEndianStringEncoding];
|
||||
if (path && path.length > 0) {
|
||||
return unzOpen ((const char*)[path fileSystemRepresentation]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user