diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-02 19:41:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-02 19:41:36 +0300 |
commit | 186c27d5ddb18f13f68db9c4d6426993ae4b7daa (patch) | |
tree | 8e6e5d6f40178201e766c1e5c585b2b4e373d470 | |
parent | ace1f5b804a5f0d180d576b135907e2a03e0e70d (diff) |
Plugin Updater: attemt to use 64K unzip buffer instead of 8K
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 50612e8218..58b12978dc 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -19,6 +19,8 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
+#define DATA_BUF_SIZE 65536
+
static void PrepareFileName(wchar_t *dest, size_t destSize, const wchar_t *ptszPath, const wchar_t *ptszFileName)
{
mir_snwprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
@@ -31,9 +33,10 @@ static void PrepareFileName(wchar_t *dest, size_t destSize, const wchar_t *ptszP bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath, bool ch)
{
unz_file_info64 file_info;
- char filename[MAX_PATH], buf[8192];
+ char filename[MAX_PATH];
+ mir_ptr<char> buf((char *)mir_alloc(DATA_BUF_SIZE+1));
- int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, sizeof(buf), nullptr, 0);
+ int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, DATA_BUF_SIZE, nullptr, 0);
if (err != UNZ_OK)
return false;
@@ -82,7 +85,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath return false;
}
while (true) {
- err = unzReadCurrentFile(uf, buf, sizeof(buf));
+ err = unzReadCurrentFile(uf, buf, DATA_BUF_SIZE);
if (err <= 0)
break;
|