Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
remittor committed Dec 10, 2019
2 parents f76c8d5 + 1cc6de3 commit 8c10a46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
13 changes: 9 additions & 4 deletions src/wcx_archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,15 @@ int archive::extract_paxzst(LPCWSTR fn, UINT64 file_size, HANDLE & hDstFile)
ZSTD_outBuffer outBuff = { m_dst.data(), m_dst.size(), 0 };
size_t readSizeHint = ZSTD_decompressStream(m_zst.ctx.get_ctx(), &outBuff, &inBuff);
FIN_IF(ZSTD_isError(readSizeHint), 0x7176300 | E_EREAD);
if (outBuff.pos) {
BOOL x = WriteFile(hDstFile, m_dst.c_data(), (DWORD)outBuff.pos, &dw, NULL);
FIN_IF(!x || outBuff.pos != dw, 0x7176600 | E_EWRITE);
written += dw;
size_t sz = outBuff.pos;
if (written + sz >= m_cur_file->data_size) {
sz = (size_t)(m_cur_file->data_size - written);
readSizeHint = 0; /* stop decoding */
}
if (sz) {
BOOL x = WriteFile(hDstFile, m_dst.c_data(), (DWORD)sz, &dw, NULL);
FIN_IF(!x || sz != dw, 0x7176600 | E_EWRITE);
written += sz;
int ret = m_cb.tell_process_data(written);
FIN_IF(ret == psCancel, 0); // user press Cancel
}
Expand Down
16 changes: 7 additions & 9 deletions src/wcx_packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,13 @@ int packer::set_compression_level(int cpr_level)
if (cpr_level <= 0)
cpr_level = -1;

if (m_ctype == ctLz4) {
if (cpr_level > LZ4HC_CLEVEL_DEFAULT)
cpr_level = LZ4HC_CLEVEL_DEFAULT;
}
if (m_ctype == ctZstd) {
if (cpr_level > zst::MAX_CLEVEL)
cpr_level = zst::MAX_CLEVEL;
}
if (cpr_level > 9)
cpr_level = 9; /* LZ4HC_CLEVEL_DEFAULT = 9; ZSTD_MAX_CLEVEL = 22; */

m_cpr_level = cpr_level;
if (m_ctype == ctZstd && m_cpr_level >= 1) {
m_cpr_level += 1; /* 9 -> 10 */
}
return 0;
}

Expand Down Expand Up @@ -245,8 +243,8 @@ int packer::pack_files(LPCWSTR SubPath, LPCWSTR SrcPath, LPCWSTR AddList)
}

set_block_size(m_buf.size());
LOGi("%s: compression level = %d", __func__, m_cfg.get_compression_level());
set_compression_level(m_cfg.get_compression_level());
LOGi("%s: compression level = %d", __func__, m_cpr_level);
m_start_time = GetTickCount();
reset_ctx(true);

Expand Down
2 changes: 1 addition & 1 deletion src/wcx_version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define WCX_VER_MAJOR 0
#define WCX_VER_MINOR 3
#define WCX_VER_MINOR 4

#define WCX_VER_GET_STR(num) WCX_VER_GET_STR2(num)
#define WCX_VER_GET_STR2(num) #num
Expand Down

0 comments on commit 8c10a46

Please sign in to comment.